From 2e4a21857579922715e7227b76312157733c1006 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 25 Nov 2012 16:26:09 -0500 Subject: [PATCH] Fix cross-domain wrapping under most circumstances. Cross-domain wrapping was previously broken when a page loaded a page from a different SOP, which then loaded another page. Thanks to @aurimasv for debugging this. It's still broken if one page sets document.domain and another does not, since we should wrap in this case but we won't. Fixes #202 --- chrome/content/zotero/xpcom/utilities_translate.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 8be8830a89..3d1df5a403 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -227,15 +227,13 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor } if(Zotero.isFx) { - var translate = this._translate; - if(translate.document) { - var protocol = translate.document.location.protocol, - host = translate.document.location.host; - } else { + if(typeof translate._sandboxLocation === "object") { + var protocol = translate._sandboxLocation.location.protocol, + host = translate._sandboxLocation.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), + .newURI(translate._sandboxLocation, null, null), protocol = url.scheme+":", host = url.host; }