commit 764e851e11295c3a29f32604b115613afcef09d6
parent 335395f05f03426886d33e203f974badee1adcdf
Author: Simon Kornblith <simon@simonster.com>
Date: Sat, 31 Dec 2011 18:06:58 +0000
Duplicate handler list before running handlers, in case it is modified while running.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js
@@ -849,10 +849,11 @@ Zotero.Translate.Base.prototype = {
args.push(arguments[i]);
}
- for(var i=0; i<this._handlers[type].length; i++) {
+ var handlers = this._handlers[type].slice();
+ for(var i=0, n=handlers.length; i<n; i++) {
Zotero.debug("Translate: Running handler "+i+" for "+type, 5);
try {
- returnValue = this._handlers[type][i].apply(null, args);
+ returnValue = handlers[i].apply(null, args);
} catch(e) {
if(this._parentTranslator) {
// throw handler errors if they occur when a translator is