From 289abf6133cdd2f3d6800f3fc7d7b2ef812fd49c Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 14 Aug 2007 21:45:34 +0000 Subject: [PATCH] - fix highlights - improve error handling in annotations --- chrome/content/zotero/browser.js | 9 +++++++-- chrome/content/zotero/xpcom/annotate.js | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index 6a9e4f600..290a6451c 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -335,8 +335,13 @@ var Zotero_Browser = new function() { Zotero.Annotate.setAnnotated(tab.annotateID, true); browser.contentWindow.addEventListener('beforeunload', function() { // save annotations - tab.page.annotations.save(); - Zotero.Annotate.setAnnotated(tab.page.annotations.itemID, false); + try { + tab.page.annotations.save(); + } catch(e) { + throw(e); + } finally { + Zotero.Annotate.setAnnotated(tab.page.annotations.itemID, false); + } }, false); } } diff --git a/chrome/content/zotero/xpcom/annotate.js b/chrome/content/zotero/xpcom/annotate.js index 2dc5f3621..4cec0d291 100644 --- a/chrome/content/zotero/xpcom/annotate.js +++ b/chrome/content/zotero/xpcom/annotate.js @@ -501,6 +501,7 @@ Zotero.Annotations.prototype.save = function() { } Zotero.DB.commitTransaction(); } catch(e) { + throw(e); Zotero.DB.rollbackTransaction(); } } @@ -1021,7 +1022,7 @@ Zotero.Highlight.prototype.save = function(index) { var start = Zotero.Annotate.getPathForPoint(this.range.startContainer, this.range.startOffset); var end = Zotero.Annotate.getPathForPoint(this.range.endContainer, this.range.endOffset); - var query = "INSERT INTO highlights VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)"; + var query = "INSERT INTO highlights VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, DATETIME('now'))"; var parameters = [ this.annotationsObj.itemID, // itemID start.parent, // startParent