www

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

commit 0a71d9219bfd2e6b7058baa29f628b76462cd18b
parent d4738017bf247575007329df1fa949ab7fdd24c1
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 25 Aug 2011 04:23:39 +0000

Don't destroy hidden browsers until translation is complete, part 1: Zotero for Firefox and Zotero Standalone


Diffstat:
Mchrome/content/zotero/xpcom/utilities.js | 27+++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -1264,9 +1264,23 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor // Unless the translator has proposed some way to handle an error, handle it // by throwing a "scraping error" message - if(!exception) { - var translate = this._translate; - var exception = function(e) { + var translate = this._translate; + if(exception) { + var myException = function(e) { + try { + exception(e); + } catch(e) { + try { + Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); + } catch(e) {} + translate.complete(false, e); + } + } + } else { + var myException = function(e) { + try { + Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); + } catch(e) {} translate.complete(false, e); } } @@ -1276,7 +1290,12 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor var hiddenBrowser = Zotero.HTTP.processDocuments(urls, processor, function() { if(done) done(); translate.decrementAsyncProcesses(); - }, exception, false, translate.cookieSandbox); + translate.setHandler("done", function() { + try { + Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); + } catch(e) {} + }); + }, myException, true, translate.cookieSandbox); } /**