www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ba32544c8706e5c12b6a15350986f3c49573604f
parent ce62e7f29b6c16e918be5223ef80e2a761f9ecaf
Author: Simon Kornblith <simon@simonster.com>
Date:   Tue, 27 Aug 2013 16:00:47 -0400

Don't call done handler multiple times on import

Broken by ff0f649a4d8a7f3ebcd4aec0932667bac2a40f8a

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -1132,6 +1132,7 @@ Zotero.Translate.Base.prototype = { this._saveAttachments = saveAttachments === undefined || saveAttachments; this._savingAttachments = []; this._savingItems = 0; + this._waitingForSave = false; var me = this; if(typeof this.translator[0] === "object") { @@ -1258,7 +1259,6 @@ Zotero.Translate.Base.prototype = { } return; } - var oldState = this._currentState; // reset async processes and propagate them to parent if(this._parentTranslator && this._runningAsyncProcesses) { @@ -1271,7 +1271,7 @@ Zotero.Translate.Base.prototype = { var errorString = null; if(!returnValue && error) errorString = this._generateErrorString(error); - if(oldState === "detect") { + if(this._currentState === "detect") { if(this._potentialTranslators.length) { var lastTranslator = this._potentialTranslators.shift(); var lastProperToProxyFunction = this._properToProxyFunctions ? this._properToProxyFunctions.shift() : null; @@ -1309,6 +1309,7 @@ Zotero.Translate.Base.prototype = { if(returnValue) { if(this.saveQueue.length) { + this._waitingForSave = true; this._saveItems(this.saveQueue); this.saveQueue = []; return; @@ -1413,7 +1414,7 @@ Zotero.Translate.Base.prototype = { * Checks if saving done, and if so, fires done event */ "_checkIfDone":function() { - if(!this._savingItems && !this._savingAttachments.length) { + if(!this._savingItems && !this._savingAttachments.length && (!this._currentState || this._waitingForSave)) { this._runHandler("done", true); } },