Don't let translators try to load the current document a second time

This commit is contained in:
Simon Kornblith 2012-03-08 14:47:29 -05:00
parent 1475a79cd1
commit 814b15c23a

View file

@ -241,6 +241,17 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor
}
}
for(var i=0; i<urls.length; i++) {
if("document" in this._translate && "location" in this._translate.document
&& this._translate.document.location.toString() === urls[i]) {
// Document is attempting to reload itself
Zotero.debug("Translate: Attempted to load the current document using processDocuments; using loaded document instead");
processor(this._translate.document, urls[i]);
urls.splice(i, 1);
i--;
}
}
translate.incrementAsyncProcesses("Zotero.Utilities.Translate#processDocuments");
var hiddenBrowser = Zotero.HTTP.processDocuments(urls, function(doc) {
if(!processor) return;