1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-15 19:13:32 +01:00

Move the ACR disabler to common/, pass it an add-on ID.

--HG--
rename : pentadactyl/content/disable-acr.jsm => common/content/disable-acr.jsm
This commit is contained in:
Kris Maglione
2011-02-06 17:32:42 -05:00
parent 4d9c196b6c
commit a1f291a9ec
3 changed files with 17 additions and 16 deletions

12
common/bootstrap.js vendored
View File

@@ -169,9 +169,11 @@ function init() {
} }
try { 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 if (JSMLoader && JSMLoader.bump != 3) // Temporary hack
Services.scriptloader.loadSubScript("resource://dactyl" + suffix + "/bootstrap.jsm", Services.scriptloader.loadSubScript("resource://dactyl" + suffix + "/bootstrap.jsm",
@@ -197,9 +199,11 @@ function shutdown(data, reason) {
dump("dactyl: bootstrap: shutdown " + reasonToString(reason) + "\n"); dump("dactyl: bootstrap: shutdown " + reasonToString(reason) + "\n");
if (reason != APP_SHUTDOWN) { if (reason != APP_SHUTDOWN) {
try { 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) if ([ADDON_UPGRADE, ADDON_DOWNGRADE, ADDON_UNINSTALL].indexOf(reason) >= 0)
Services.obs.notifyObservers(null, "dactyl-purge", null); Services.obs.notifyObservers(null, "dactyl-purge", null);

View File

@@ -1,7 +1,7 @@
// By Kris Maglione. Public Domain. // By Kris Maglione. Public Domain.
// Please feel free to copy and use at will. // Please feel free to copy and use at will.
const ADDON_ID = "pentadactyl@dactyl.googlecode.com"; var ADDON_ID;
const OVERLAY_URLS = [ const OVERLAY_URLS = [
"about:addons", "about:addons",
@@ -18,12 +18,15 @@ function observe(window, topic, url) {
if (topic === "chrome-document-global-created") if (topic === "chrome-document-global-created")
checkDocument(window.document); checkDocument(window.document);
} }
function init(disable) { function init(id) {
Services.obs[disable ? "removeObserver" : "addObserver"](observe, "chrome-document-global-created", false); if (id)
ADDON_ID = id;
Services.obs[id ? "addObserver" : "removeObserver"](observe, "chrome-document-global-created", false);
for (let doc in chromeDocuments) for (let doc in chromeDocuments)
checkDocument(doc, disable); checkDocument(doc, !id);
} }
function cleanup() { init(true); } function cleanup() { init(null); }
function checkPopup(event) { function checkPopup(event) {
let doc = event.originalTarget.ownerDocument; let doc = event.originalTarget.ownerDocument;

View File

@@ -249,13 +249,7 @@ var Overlay = Module("Overlay", {
defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber); defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber);
let obj = defineModule.time(module.className, "init", module); let obj = defineModule.time(module.className, "init", module);
try { Class.replaceProperty(modules, module.className, obj);
delete modules[module.className];
modules[module.className] = obj;
}
catch (e) {
Class.replaceProperty(modules, module.className, obj);
}
loaded[module.className] = true; loaded[module.className] = true;
frob(module.className); frob(module.className);