a marginally better solution to XPCCrossOriginWrapper woes achieved by binding child sandboxes to the same locations as parent sandboxes
this won't work if a web/search translator wants to call getTranslatorObject on another web/search translator, but that doesn't happen at the moment, so it should sufficie
This commit is contained in:
parent
95003c88e4
commit
f7e6843d68
1 changed files with 14 additions and 14 deletions
|
@ -929,10 +929,8 @@ Zotero.Translate.prototype._generateSandbox = function() {
|
||||||
var sandboxLocation = "http://www.example.com/";
|
var sandboxLocation = "http://www.example.com/";
|
||||||
if(this.type == "web") {
|
if(this.type == "web") {
|
||||||
// use real URL, not proxied version, to create sandbox
|
// use real URL, not proxied version, to create sandbox
|
||||||
sandboxLocation = this.document.defaultView;
|
var sandboxLocation = this.document.defaultView;
|
||||||
Zotero.debug("Translate: Binding sandbox to "+this.document.location.href, 4);
|
} else if(this.type == "search") {
|
||||||
} else {
|
|
||||||
if (this.type == "search") {
|
|
||||||
// generate sandbox for search by extracting domain from translator target
|
// generate sandbox for search by extracting domain from translator target
|
||||||
if(this.translator && this.translator[0] && this.translator[0].target) {
|
if(this.translator && this.translator[0] && this.translator[0].target) {
|
||||||
// so that web translators work too
|
// so that web translators work too
|
||||||
|
@ -941,9 +939,10 @@ Zotero.Translate.prototype._generateSandbox = function() {
|
||||||
var m = searchSandboxRe.exec(tempURL);
|
var m = searchSandboxRe.exec(tempURL);
|
||||||
if(m) sandboxLocation = m[0];
|
if(m) sandboxLocation = m[0];
|
||||||
}
|
}
|
||||||
|
} else if(this._sandboxLocation) {
|
||||||
|
sandboxLocation = this._sandboxLocation;
|
||||||
}
|
}
|
||||||
Zotero.debug("Translate: Binding sandbox to "+sandboxLocation, 4);
|
Zotero.debug("Translate: Binding sandbox to "+(typeof sandboxLocation == "object" ? sandboxLocation.document.location : sandboxLocation), 4);
|
||||||
}
|
|
||||||
|
|
||||||
// set up sandbox
|
// set up sandbox
|
||||||
this._sandbox = new Components.utils.Sandbox(sandboxLocation);
|
this._sandbox = new Components.utils.Sandbox(sandboxLocation);
|
||||||
|
@ -1002,6 +1001,7 @@ Zotero.Translate.prototype._generateSandbox = function() {
|
||||||
|
|
||||||
var translation = new Zotero.Translate(type);
|
var translation = new Zotero.Translate(type);
|
||||||
translation._parentTranslator = me;
|
translation._parentTranslator = me;
|
||||||
|
translation._sandboxLocation = sandboxLocation;
|
||||||
|
|
||||||
if(type == "export" && (me.type == "web" || me.type == "search")) {
|
if(type == "export" && (me.type == "web" || me.type == "search")) {
|
||||||
throw("for security reasons, web and search translators may not call export translators");
|
throw("for security reasons, web and search translators may not call export translators");
|
||||||
|
@ -1016,7 +1016,7 @@ Zotero.Translate.prototype._generateSandbox = function() {
|
||||||
translation.setHandler(arg1,
|
translation.setHandler(arg1,
|
||||||
function(obj, item) {
|
function(obj, item) {
|
||||||
try {
|
try {
|
||||||
if(Zotero.isFx4) {
|
if(Zotero.isFx4 && (me.type == "web" || me.type == "search")) {
|
||||||
// item is wrapped in an XPCCrossOriginWrapper that we can't get rid of
|
// item is wrapped in an XPCCrossOriginWrapper that we can't get rid of
|
||||||
// except by making a deep copy. seems to be due to
|
// except by making a deep copy. seems to be due to
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=580128
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=580128
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue