diff --git a/common/bootstrap.js b/common/bootstrap.js index 4ab93a0f..467d669d 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -169,9 +169,11 @@ function init() { } try { - module("resource://dactyl-local-content/disable-acr.jsm").init(); + module("resource://dactyl-content/disable-acr.jsm").init(addon.id); + } + catch (e) { + reportError(e); } - catch (e) {} if (JSMLoader && JSMLoader.bump != 3) // Temporary hack Services.scriptloader.loadSubScript("resource://dactyl" + suffix + "/bootstrap.jsm", @@ -197,9 +199,11 @@ function shutdown(data, reason) { dump("dactyl: bootstrap: shutdown " + reasonToString(reason) + "\n"); if (reason != APP_SHUTDOWN) { try { - module("resource://dactyl-local-content/disable-acr.jsm").cleanup(); + module("resource://dactyl-content/disable-acr.jsm").init(addon.id); + } + catch (e) { + reportError(e); } - catch (e) {} if ([ADDON_UPGRADE, ADDON_DOWNGRADE, ADDON_UNINSTALL].indexOf(reason) >= 0) Services.obs.notifyObservers(null, "dactyl-purge", null); diff --git a/pentadactyl/content/disable-acr.jsm b/common/content/disable-acr.jsm similarity index 90% rename from pentadactyl/content/disable-acr.jsm rename to common/content/disable-acr.jsm index f5ebe74b..de231635 100644 --- a/pentadactyl/content/disable-acr.jsm +++ b/common/content/disable-acr.jsm @@ -1,7 +1,7 @@ // By Kris Maglione. Public Domain. // Please feel free to copy and use at will. -const ADDON_ID = "pentadactyl@dactyl.googlecode.com"; +var ADDON_ID; const OVERLAY_URLS = [ "about:addons", @@ -18,12 +18,15 @@ function observe(window, topic, url) { if (topic === "chrome-document-global-created") checkDocument(window.document); } -function init(disable) { - Services.obs[disable ? "removeObserver" : "addObserver"](observe, "chrome-document-global-created", false); +function init(id) { + if (id) + ADDON_ID = id; + + Services.obs[id ? "addObserver" : "removeObserver"](observe, "chrome-document-global-created", false); for (let doc in chromeDocuments) - checkDocument(doc, disable); + checkDocument(doc, !id); } -function cleanup() { init(true); } +function cleanup() { init(null); } function checkPopup(event) { let doc = event.originalTarget.ownerDocument; diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index 0178e5d2..b34f60b3 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -249,13 +249,7 @@ var Overlay = Module("Overlay", { defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber); let obj = defineModule.time(module.className, "init", module); - try { - delete modules[module.className]; - modules[module.className] = obj; - } - catch (e) { - Class.replaceProperty(modules, module.className, obj); - } + Class.replaceProperty(modules, module.className, obj); loaded[module.className] = true; frob(module.className);