diff --git a/common/bootstrap.js b/common/bootstrap.js index a438a7ff..8baab0ea 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -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; diff --git a/common/content/commandline.js b/common/content/commandline.js index cc7d2895..ca8479c8 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -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 = ""; diff --git a/common/content/events.js b/common/content/events.js index 04ea77e8..93e40459 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -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: @@ -21,9 +20,9 @@ var Events = Module("events", { from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !--> + oncommandupdate="dactyl.modules.events.onFocusChange(event);"/> + oncommandupdate="dactyl.modules.events.onSelectionChange(event);"/> .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; }, /** diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index 37aaf98d..4d528b28 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -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); } })); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index cbe9496e..9ad5343f 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -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; }); }, diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js index 7df70bd2..2ab87d56 100644 --- a/pentadactyl/content/config.js +++ b/pentadactyl/content/config.js @@ -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);"/> + oncommand="toggleSidebar(this.id);"/> + oncommand="toggleSidebar(this.id);"/> + oncommand="toggleSidebar(this.id);"/> .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