1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-06 15:05:44 +01:00

[bootstrap] Purge stale modules on upgrade as well as explicit rehash.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-25 18:41:32 -05:00
parent e5fd0ccf18
commit 26bd1c1075
6 changed files with 22 additions and 15 deletions

3
common/bootstrap.js vendored
View File

@@ -186,6 +186,9 @@ function init() {
function shutdown(data, reason) {
dump("dactyl: bootstrap: shutdown " + reasonToString(reason) + "\n");
if (reason != APP_SHUTDOWN) {
if ([ADDON_UPGRADE, ADDON_DOWNGRADE, ADDON_UNINSTALL].indexOf(reason) >= 0)
services.observer.notifyObservers(null, "dactyl-purge", null);
services.observer.notifyObservers(null, "dactyl-cleanup", null);
for (let factory in values(components))
// TODO: Categories;

View File

@@ -1249,9 +1249,9 @@ var CommandLine = Module("commandline", {
availableHeight -= extra || 0;
doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px";
this.widgets.mowContainer.height = Math.min(doc.height, availableHeight) + "px";
this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px";
this.timeout(function ()
this.widgets.mowContainer.height = Math.min(doc.height, availableHeight) + "px",
this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px",
0);
doc.body.style.minWidth = "";

View File

@@ -13,7 +13,6 @@
*/
var Events = Module("events", {
init: function () {
let _events = "if (window.dactyl && dactyl.modules.loaded.events) return dactyl.modules.events"
util.overlayWindow(window, {
append: <e4x xmlns={XUL}>
<window id={document.documentElement.id}>
@@ -21,9 +20,9 @@ var Events = Module("events", {
from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !-->
<!-- I don't think we really need this. Kris -->
<commandset id="onPentadactylFocus" commandupdater="true" events="focus"
oncommandupdate={_events + ".onFocusChange(event);"}/>
oncommandupdate="dactyl.modules.events.onFocusChange(event);"/>
<commandset id="onPentadactylSelect" commandupdater="true" events="select"
oncommandupdate={_events + ".onSelectionChange(event);"}/>
oncommandupdate="dactyl.modules.events.onSelectionChange(event);"/>
</window>
</e4x>.elements()
});
@@ -121,7 +120,8 @@ var Events = Module("events", {
*/
wrapListener: function wrapListener(method, self) {
self = self || this;
return function wrappedListener(event) {
method.wrapped = wrappedListener;
function wrappedListener(event) {
try {
method.apply(self, arguments);
}
@@ -133,6 +133,7 @@ var Events = Module("events", {
dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
}
};
return wrappedListener;
},
/**

View File

@@ -249,10 +249,10 @@ var Overlay = Module("Overlay", {
util.dump("Loaded in " + (Date.now() - start) + "ms");
modules.events.addSessionListener(window, "unload", function onUnload() {
window.removeEventListener("unload", onUnload, false);
window.removeEventListener("unload", onUnload.wrapped, false);
for (let [, mod] in iter(modules))
if (mod instanceof ModuleBase && "destroy" in mod)
mod.destroy();
util.trapErrors(mod.destroy, mod);
}, false);
}
}));

View File

@@ -949,6 +949,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
module.init();
}
},
"dactyl-purge": function () {
this.rehashing = true;
},
"toplevel-window-ready": function (window, data) {
window.addEventListener("DOMContentLoaded", wrapCallback(function listener(event) {
if (event.originalTarget === window.document) {
@@ -1163,9 +1166,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}),
rehash: function () {
this.rehashing = true;
this.addon.userDisabled = true;
this.timeout(function () {
this.rehashing = true;
this.addon.userDisabled = true;
this.addon.userDisabled = false;
});
},

View File

@@ -26,28 +26,28 @@ const Config = Module("config", ConfigBase, {
group="sidebar"
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
sidebartitle="Add-ons"
oncommand="toggleSidebar('pentadactyl-viewAddonsSidebar');"/>
oncommand="toggleSidebar(this.id);"/>
<broadcaster id="pentadactyl-viewConsoleSidebar"
autoCheck="false"
type="checkbox"
group="sidebar"
sidebarurl="chrome://global/content/console.xul"
sidebartitle="Console"
oncommand="toggleSidebar('pentadactyl-viewConsoleSidebar');"/>
oncommand="toggleSidebar(this.id);"/>
<broadcaster id="pentadactyl-viewDownloadsSidebar"
autoCheck="false"
type="checkbox"
group="sidebar"
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
sidebartitle="Downloads"
oncommand="toggleSidebar('pentadactyl-viewDownloadsSidebar');"/>
oncommand="toggleSidebar(this.id);"/>
<broadcaster id="pentadactyl-viewPreferencesSidebar"
autoCheck="false"
type="checkbox"
group="sidebar"
sidebarurl="about:config"
sidebartitle="Preferences"
oncommand="toggleSidebar('pentadactyl-viewPreferencesSidebar');"/>
oncommand="toggleSidebar(this.id);"/>
</broadcasterset>
</e4x>.elements()
});
@@ -223,7 +223,7 @@ const Config = Module("config", ConfigBase, {
},
{ argCount: "0" });
commands.add(["sideb[ar]", "sb[ar]", "sbope[n]"],
commands.add(["sideb[ar]", "sb[ar]", "sbop[en]"],
"Open the sidebar window",
function (args) {
function compare(a, b) util.compareIgnoreCase(a, b) == 0