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
This commit is contained in:
Simon Kornblith 2012-11-25 16:26:09 -05:00
parent 63f1dd163d
commit 2e4a218575

View File

@ -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;
}