mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-18 00:15:46 +01:00
[bootstrap] Purge stale modules on upgrade as well as explicit rehash.
--HG-- branch : bootstrapped
This commit is contained in:
3
common/bootstrap.js
vendored
3
common/bootstrap.js
vendored
@@ -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;
|
||||
|
||||
@@ -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 = "";
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user