commit ca994fd22b595b742697d7a3a533490bf630c183
parent 65a024e980c9ab1b13acf996fc6910ca971ee5f1
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 14 Feb 2012 22:55:35 -0500
Prevent accept from being called twice
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git 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;