commit 2e4a21857579922715e7227b76312157733c1006
parent 63f1dd163de0ccd9c21af4f1efc54d9d447a0c94
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 25 Nov 2012 16:26:09 -0500
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
Diffstat:
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
@@ -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;
}