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.
This commit is contained in:
Dan Stillman 2017-08-16 17:58:59 +02:00
parent d1de8b751a
commit da2dedf7af

View file

@ -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() {