1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 18:14:12 +01:00

Bootstrap cleanup work.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-23 23:27:33 -05:00
parent c396c279c4
commit 33e16f3183
11 changed files with 89 additions and 23 deletions

View File

@@ -961,9 +961,21 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
observe: {
"dactyl-cleanup": function () {
for (let module in values(defineModule.modules))
if (module.cleanup)
module.cleanup();
// Let window cleanup functions run synchronously before we
// destroy modules.
util.timeout(function () {
for (let module in values(defineModule.modules))
if (module.cleanup)
module.cleanup();
let getOwnPropertyNames = Object.getOwnPropertyNames;
for each (let global in defineModule.globals.reverse())
for each (let k in getOwnPropertyNames(global))
try {
delete global[k];
}
catch (e) {}
});
},
"toplevel-window-ready": function (window, data) {
window.addEventListener("DOMContentLoaded", wrapCallback(function listener(event) {
@@ -1141,6 +1153,7 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
}
catch (e) {
this.dump(e);
try { util.dump(e.stack) } catch (e) {}
}
},