Firefox 3.6 fixes (ugh)
This commit is contained in:
parent
617646f0a2
commit
f701dd724e
3 changed files with 12 additions and 18 deletions
|
@ -1157,7 +1157,7 @@ Zotero.Translate.Base.prototype = {
|
|||
*/
|
||||
"_loadTranslator":function(translator, callback) {
|
||||
var sandboxLocation = this._getSandboxLocation();
|
||||
if(!this._sandboxLocation || sandboxLocation != this._sandboxLocation) {
|
||||
if(!this._sandboxLocation || sandboxLocation !== this._sandboxLocation) {
|
||||
this._sandboxLocation = sandboxLocation;
|
||||
this._generateSandbox();
|
||||
}
|
||||
|
|
|
@ -129,7 +129,11 @@ Zotero.Translate.SandboxManager.prototype = {
|
|||
* Evaluates code in the sandbox
|
||||
*/
|
||||
"eval":function(code, exported, path) {
|
||||
Components.utils.evalInSandbox(code, this.sandbox, "1.8", path, 1);
|
||||
if(Zotero.isFx4) {
|
||||
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;
|
||||
if(newExposedProps) newExposedProps[localKey] = "r";
|
||||
|
||||
// magical XPCSafeJSObjectWrappers for sandbox
|
||||
var type = typeof object[localKey];
|
||||
var isFunction = type === "function";
|
||||
var isObject = typeof object[localKey] === "object";
|
||||
|
@ -171,9 +174,7 @@ Zotero.Translate.SandboxManager.prototype = {
|
|||
}
|
||||
|
||||
for(var i=0, nArgs=arguments.length; i<nArgs; i++) {
|
||||
args[i+offset] = (((typeof arguments[i] === "object" && arguments[i] !== null)
|
||||
|| typeof arguments[i] === "function")
|
||||
? new XPCSafeJSObjectWrapper(arguments[i]) : arguments[i]);
|
||||
args[i+offset] = arguments[i];
|
||||
}
|
||||
|
||||
return object[localKey].apply(object, args);
|
||||
|
|
|
@ -37,17 +37,6 @@ const ZOTERO_CONFIG = {
|
|||
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
|
||||
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||
getService(Components.interfaces.nsIXULAppInfo);
|
||||
|
@ -392,7 +381,11 @@ if(appInfo.platformVersion[0] >= 2) {
|
|||
|
||||
// evaluate
|
||||
Components.utils.evalInSandbox(prefsJs, sandbox);
|
||||
var prefs = new XPCSafeJSObjectWrapper(sandbox.prefs);
|
||||
if(Zotero.isFx4) {
|
||||
var prefs = sandbox.prefs;
|
||||
} else {
|
||||
var prefs = new XPCSafeJSObjectWrapper(sandbox.prefs);
|
||||
}
|
||||
for(var key in prefs) {
|
||||
if(key.substr(0, ZOTERO_CONFIG.PREF_BRANCH.length) === ZOTERO_CONFIG.PREF_BRANCH
|
||||
&& key !== "extensions.zotero.firstRun2") {
|
||||
|
|
Loading…
Add table
Reference in a new issue