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

Add some more error handling code during the bootstrapping process.

This commit is contained in:
Kris Maglione
2010-12-30 20:20:57 -05:00
parent 5f47d83f76
commit 85947d4645
5 changed files with 46 additions and 23 deletions

20
common/bootstrap.js vendored
View File

@@ -18,6 +18,11 @@ const categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICa
const manager = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
const storage = Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication).storage;
function reportError(e) {
dump("dactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack));
Cu.reportError(e);
}
function httpGet(url) {
let xmlhttp = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
xmlhttp.open("GET", url, false);
@@ -93,10 +98,17 @@ FactoryProxy.prototype = {
manager.unregisterFactory(this.classID, this);
},
get module() {
Object.defineProperty(this, "module", { value: {}, enumerable: true });
JSMLoader.load(this.url, this.module);
JSMLoader.registerGlobal(this.url, this.module.global);
return this.module;
try {
Object.defineProperty(this, "module", { value: {}, enumerable: true });
JSMLoader.load(this.url, this.module);
JSMLoader.registerGlobal(this.url, this.module.global);
return this.module;
}
catch (e) {
delete this.module;
reportError(e);
throw e;
}
},
createInstance: function (iids) {
return let (factory = this.module.NSGetFactory(this.classID))