From eed6d2f22c046fb29547645aebdca4d29bac1a50 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 19 Jan 2013 20:05:21 -0600 Subject: [PATCH 1/2] Pass responseCharset to subsequent doGet calls --- chrome/content/zotero/xpcom/http.js | 5 +++-- chrome/content/zotero/xpcom/utilities_translate.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index fc02bd8082..436b308753 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -576,9 +576,10 @@ Zotero.HTTP = new function() { /** * Handler for XMLHttpRequest state change * - * @param {nsIXMLHttpRequest} XMLHttpRequest whose state just changed - * @param {Function} [onDone] Callback for request completion + * @param {nsIXMLHttpRequest} xmlhttp XMLHttpRequest whose state just changed + * @param {Function} [callback] Callback for request completion * @param {String} [responseCharset] Character set to force on the response + * @param {*} [data] Data to be passed back to callback as the second argument * @private */ function _stateChange(xmlhttp, callback, responseCharset, data) { diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 3d1df5a403..300b3a4c9e 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -402,7 +402,7 @@ Zotero.Utilities.Translate.prototype.doGet = function(urls, processor, done, res } if(callAgain) { - me.doGet(urls, processor, done); + me.doGet(urls, processor, done, responseCharset); } else { if(done) { done(); From 6b878ba9f192692f1dcbd6eccc04cc644bebaf27 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Thu, 31 Jan 2013 19:50:57 -0600 Subject: [PATCH 2/2] Delete hidden browser even if processDocuments exception handler does not fail. --- chrome/content/zotero/xpcom/utilities_translate.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 300b3a4c9e..777605604b 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -208,14 +208,22 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor var translate = this._translate; if(exception) { var myException = function(e) { + var browserDeleted; try { exception(e); } catch(e) { try { Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); } catch(e) {} + browserDeleted = true; translate.complete(false, e); } + + if(!browserDeleted) { + try { + Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); + } catch(e) {} + } } } else { var myException = function(e) {