Firefox 3.6 fixes (ugh)
This commit is contained in:
parent
617646f0a2
commit
f701dd724e
|
@ -1157,7 +1157,7 @@ Zotero.Translate.Base.prototype = {
|
||||||
*/
|
*/
|
||||||
"_loadTranslator":function(translator, callback) {
|
"_loadTranslator":function(translator, callback) {
|
||||||
var sandboxLocation = this._getSandboxLocation();
|
var sandboxLocation = this._getSandboxLocation();
|
||||||
if(!this._sandboxLocation || sandboxLocation != this._sandboxLocation) {
|
if(!this._sandboxLocation || sandboxLocation !== this._sandboxLocation) {
|
||||||
this._sandboxLocation = sandboxLocation;
|
this._sandboxLocation = sandboxLocation;
|
||||||
this._generateSandbox();
|
this._generateSandbox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,11 @@ Zotero.Translate.SandboxManager.prototype = {
|
||||||
* Evaluates code in the sandbox
|
* Evaluates code in the sandbox
|
||||||
*/
|
*/
|
||||||
"eval":function(code, exported, path) {
|
"eval":function(code, exported, path) {
|
||||||
|
if(Zotero.isFx4) {
|
||||||
Components.utils.evalInSandbox(code, this.sandbox, "1.8", path, 1);
|
Components.utils.evalInSandbox(code, this.sandbox, "1.8", path, 1);
|
||||||
|
} else {
|
||||||
|
Components.utils.evalInSandbox(code, this.sandbox);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,7 +151,6 @@ Zotero.Translate.SandboxManager.prototype = {
|
||||||
let localKey = key;
|
let localKey = key;
|
||||||
if(newExposedProps) newExposedProps[localKey] = "r";
|
if(newExposedProps) newExposedProps[localKey] = "r";
|
||||||
|
|
||||||
// magical XPCSafeJSObjectWrappers for sandbox
|
|
||||||
var type = typeof object[localKey];
|
var type = typeof object[localKey];
|
||||||
var isFunction = type === "function";
|
var isFunction = type === "function";
|
||||||
var isObject = typeof object[localKey] === "object";
|
var isObject = typeof object[localKey] === "object";
|
||||||
|
@ -171,9 +174,7 @@ Zotero.Translate.SandboxManager.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i=0, nArgs=arguments.length; i<nArgs; i++) {
|
for(var i=0, nArgs=arguments.length; i<nArgs; i++) {
|
||||||
args[i+offset] = (((typeof arguments[i] === "object" && arguments[i] !== null)
|
args[i+offset] = arguments[i];
|
||||||
|| typeof arguments[i] === "function")
|
|
||||||
? new XPCSafeJSObjectWrapper(arguments[i]) : arguments[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return object[localKey].apply(object, args);
|
return object[localKey].apply(object, args);
|
||||||
|
|
|
@ -37,17 +37,6 @@ const ZOTERO_CONFIG = {
|
||||||
PREF_BRANCH: 'extensions.zotero.'
|
PREF_BRANCH: 'extensions.zotero.'
|
||||||
};
|
};
|
||||||
|
|
||||||
const ZOTERO_METAREGEXP = /[-[\]{}()*+?.\\^$|,#\s]/g;
|
|
||||||
|
|
||||||
// Fx4.0b8+ use implicit SJOWs and get rid of explicit XPCSafeJSObjectWrapper constructor
|
|
||||||
// Ugly hack to get around this until we can just kill the XPCSafeJSObjectWrapper calls (when we
|
|
||||||
// drop Fx3.6 support)
|
|
||||||
try {
|
|
||||||
XPCSafeJSObjectWrapper;
|
|
||||||
} catch(e) {
|
|
||||||
eval("var XPCSafeJSObjectWrapper = function(arg) { return arg }");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load AddonManager for Firefox 4
|
// Load AddonManager for Firefox 4
|
||||||
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
|
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||||
getService(Components.interfaces.nsIXULAppInfo);
|
getService(Components.interfaces.nsIXULAppInfo);
|
||||||
|
@ -392,7 +381,11 @@ if(appInfo.platformVersion[0] >= 2) {
|
||||||
|
|
||||||
// evaluate
|
// evaluate
|
||||||
Components.utils.evalInSandbox(prefsJs, sandbox);
|
Components.utils.evalInSandbox(prefsJs, sandbox);
|
||||||
|
if(Zotero.isFx4) {
|
||||||
|
var prefs = sandbox.prefs;
|
||||||
|
} else {
|
||||||
var prefs = new XPCSafeJSObjectWrapper(sandbox.prefs);
|
var prefs = new XPCSafeJSObjectWrapper(sandbox.prefs);
|
||||||
|
}
|
||||||
for(var key in prefs) {
|
for(var key in prefs) {
|
||||||
if(key.substr(0, ZOTERO_CONFIG.PREF_BRANCH.length) === ZOTERO_CONFIG.PREF_BRANCH
|
if(key.substr(0, ZOTERO_CONFIG.PREF_BRANCH.length) === ZOTERO_CONFIG.PREF_BRANCH
|
||||||
&& key !== "extensions.zotero.firstRun2") {
|
&& key !== "extensions.zotero.firstRun2") {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user