From 78a79abfab57bb64a3a5f69129b6f33008ee7675 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 19 Dec 2011 23:11:19 -0500 Subject: [PATCH] Fix ISBN lookup on branch --- .../zotero/xpcom/utilities_translate.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 8ff3b910b..6abbd290f 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -226,14 +226,27 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor } } - var translate = this._translate; - var loc = translate.document.location; + if(Zotero.isFx) { + var translate = this._translate; + if(translate.document) { + var protocol = translate.document.location.protocol, + host = translate.document.location.host; + } else { + var url = Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService) + .newURI(typeof translate._sandboxLocation === "object" ? + translate._sandboxLocation.location : translate._sandboxLocation, null, null), + protocol = url.scheme+":", + host = url.host; + } + } + translate.incrementAsyncProcesses("Zotero.Utilities.Translate#processDocuments"); var hiddenBrowser = Zotero.HTTP.processDocuments(urls, function(doc) { if(!processor) return; var newLoc = doc.location; - if(Zotero.isFx && (loc.protocol !== newLoc.protocol || loc.host !== newLoc.host)) { + if(Zotero.isFx && (protocol != newLoc.protocol || host != newLoc.host)) { // Cross-site; need to wrap processor(Zotero.Translate.SandboxManager.Fx5DOMWrapper(doc), newLoc.toString()); } else {