www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f701dd724e1e94edd7b320a110ed5ed2c0037926
parent 617646f0a26ddc653734608fa19a86da38501102
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun, 24 Jul 2011 19:16:31 +0000

Firefox 3.6 fixes (ugh)


Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 2+-
Mchrome/content/zotero/xpcom/translation/translate_firefox.js | 11++++++-----
Mchrome/content/zotero/xpcom/zotero.js | 17+++++------------
3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -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(); } diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -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); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -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") {