diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-01-13 17:10:27 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-01-13 17:10:27 -0500 |
commit | 3e854158905cde79e2827addcd6d2483bb0b8849 (patch) | |
tree | 93b976fef3daaba3a4cd1898670d195aef769425 /common/modules | |
parent | 97da21c4aa6c226eb648958b48bf744b1202d2ee (diff) | |
download | pentadactyl-3e854158905cde79e2827addcd6d2483bb0b8849.tar.gz |
Cleanup module globals more eagerly.
Diffstat (limited to 'common/modules')
-rw-r--r-- | common/modules/bootstrap.jsm | 28 | ||||
-rw-r--r-- | common/modules/util.jsm | 5 |
2 files changed, 17 insertions, 16 deletions
diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index dac2201f..5609bf68 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -36,22 +36,12 @@ if (!JSMLoader || JSMLoader.bump != 1) delete this.stale[url]; let global = this.globals[url]; - for each (let prop in Object.getOwnPropertyNames(global)) - try { - if (!(prop in this.builtin) && ["JSMLoader", "set"].indexOf(prop) < 0 && - !global.__lookupGetter__(prop)) - global[prop] = undefined; - } - catch (e) { - dump("Deleting property " + prop + " on " + url + ":\n " + e + "\n"); - Components.utils.reportError(e); - } - if (stale === this.getTarget(url)) Components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getService(Components.interfaces.mozIJSSubScriptLoader) .loadSubScript(url, global.global || global); } + try { let global = Components.utils.import(url, target); @@ -73,9 +63,23 @@ if (!JSMLoader || JSMLoader.bump != 1) this.manager.unregisterFactory(factory.classID, factory); }, purge: function purge() { - for (let [url, global] in Iterator(this.globals)) + for (let [url, global] in Iterator(this.globals)) { this.stale[url] = this.getTarget(url); + + for each (let prop in Object.getOwnPropertyNames(global)) + try { + if (!(prop in this.builtin) && + ["JSMLoader", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 && + !global.__lookupGetter__(prop)) + global[prop] = undefined; + } + catch (e) { + dump("Deleting property " + prop + " on " + url + ":\n " + e + "\n"); + Components.utils.reportError(e); + } + } }, + registerFactory: function registerFactory(factory) { this.manager.registerFactory(factory.classID, String(factory.classID), diff --git a/common/modules/util.jsm b/common/modules/util.jsm index eb247eac..eaa817d5 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -965,9 +965,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), services.observer.removeObserver(this, "dactyl-rehash"); defineModule.loadLog.push("dactyl: util: observe: dactyl-rehash"); - if (this.rehashing) - JSMLoader.purge(); - else + if (!this.rehashing) for (let module in values(defineModule.modules)) { defineModule.loadLog.push("dactyl: util: init(" + module + ")"); if (module.reinit) @@ -978,7 +976,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), }, "dactyl-purge": function () { this.rehashing = 1; - JSMLoader.purge(); }, "toplevel-window-ready": function (window, data) { window.addEventListener("DOMContentLoaded", wrapCallback(function listener(event) { |