From da2dedf7affd75b0f79c258b496bbc5ccbf794f2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 16 Aug 2017 17:58:59 +0200 Subject: [PATCH] Use passed URL rather than doc.location in translator processDocuments Outside of page contexts (e.g., from an XHR with responseType = 'document'), document.location is null. --- chrome/content/zotero/xpcom/utilities_translate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 19c53cce95..ccf7df127e 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -279,7 +279,7 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor } translate.incrementAsyncProcesses("Zotero.Utilities.Translate#processDocuments"); - var hiddenBrowser = Zotero.HTTP.processDocuments(urls, function(doc) { + var hiddenBrowser = Zotero.HTTP.processDocuments(urls, function (doc, url) { if(!processor) return; var newLoc = doc.location; @@ -289,10 +289,10 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor // DEBUG: Is there a better fix for this? || Zotero.isServer) { // Cross-site; need to wrap - processor(translate._sandboxManager.wrap(doc), newLoc.toString()); + processor(translate._sandboxManager.wrap(doc), url); } else { // Not cross-site; no need to wrap - processor(doc, newLoc.toString()); + processor(doc, url); } }, function() {