1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 22:35:47 +01:00

Fix about:pentadactyl by registering the component manually. Et cetera.

This commit is contained in:
Kris Maglione
2011-01-03 17:06:28 -05:00
parent e8c5664c8f
commit 30ec5fc393
9 changed files with 98 additions and 46 deletions

View File

@@ -7,7 +7,9 @@
if (!JSMLoader)
var JSMLoader = {
builtin: Components.utils.Sandbox(this),
factories: [],
globals: {},
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
stale: {},
load: function load(url, target) {
if (this.stale[url]) {
@@ -32,6 +34,10 @@ if (!JSMLoader)
}
Components.utils.import(url, target);
},
cleanup: function unregister() {
for each (let factory in this.factories.splice(0))
this.manager.unregisterFactory(factory.classID, factory);
},
purge: function purge() {
for (let [url, global] in Iterator(this.globals))
this.stale[url] = true;
@@ -39,6 +45,13 @@ if (!JSMLoader)
registerGlobal: function registerGlobal(uri, obj) {
if (Cu.getGlobalForObject)
this.globals[uri.replace(/.* -> /, "")] = Cu.getGlobalForObject(obj);
},
registerFactory: function registerFactory(factory) {
this.manager.registerFactory(factory.classID,
String(factory.classID),
factory.contractID,
factory);
this.factories.push(factory);
}
};