From ca994fd22b595b742697d7a3a533490bf630c183 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 14 Feb 2012 22:55:35 -0500 Subject: [PATCH] Prevent accept from being called twice --- chrome/content/zotero/xpcom/integration.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index b4d4c7d060..02eab15991 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1768,9 +1768,15 @@ Zotero.Integration.CitationEditInterface.prototype = { * Accept changes to the citation * @param {Function} [progressCallback] A callback to be run when progress has changed. * Receives a number from 0 to 100 indicating current status. + * @param {Boolean} [force] Whether to run accept even if it has been run previously. */ - "accept":function(progressCallback) { + "accept":function(progressCallback, force) { var me = this; + + // Don't allow accept to be called multiple times + if(!force && this._haveAccepted) return; + this._haveAccepted = true; + this._fields.progressCallback = progressCallback; if(this._errorOccurred) { @@ -1779,7 +1785,7 @@ Zotero.Integration.CitationEditInterface.prototype = { Zotero.setTimeout(function() { me._fields.updateSession(function() { me._errorOccurred = false; - me.accept(progressCallback); + me.accept(progressCallback, true); }) }, 0); return;