diff --git a/common/bootstrap.js b/common/bootstrap.js index bf5a1829..e356cfac 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -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)) diff --git a/common/components/protocols.js b/common/components/protocols.js index 3aacda70..330ea079 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -4,6 +4,13 @@ // given in the LICENSE.txt file included with this file. "use strict"; +function reportError(e) { + dump("dactyl: components: " + e + "\n" + (e.stack || Error().stack)); + Cu.reportError(e); +} + +try { + /* Adds support for data: URIs with chrome privileges * and fragment identifiers. * @@ -216,4 +223,6 @@ else var NSGetModule = XPCOMUtils.generateNSGetModule([AboutHandler, ChromeData, Dactyl, Shim]); var EXPORTED_SYMBOLS = ["NSGetFactory", "global"]; +} catch (e) { reportError(e) } + // vim: set fdm=marker sw=4 ts=4 et: diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 46befb3b..6f9d75a5 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -2124,7 +2124,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { dactyl.commandLineOptions.noPlugins = "++noplugin" in args; dactyl.commandLineOptions.postCommands = args["+c"]; dactyl.commandLineOptions.preCommands = args["++cmd"]; - util.dump("Processing command-line option: " + commandline); + util.dump("Processing command-line option: " + args.string); } } catch (e) { diff --git a/common/content/mappings.js b/common/content/mappings.js index 8ad3282c..ada6e35d 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -523,7 +523,7 @@ var Mappings = Module("mappings", { for (let mode in values(modes.all)) if (name == mode || name == mode.char || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase()) - return mode.mask; + return mode; return null; } function uniqueModes(modes) { diff --git a/common/content/modes.js b/common/content/modes.js index a6fd816c..a9628d89 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -108,7 +108,7 @@ var Modes = Module("modes", { hidden: true, description: "Quote mode: The next key sequence is ignored by " + config.appName + ", unless in Pass Through mode", display: function () modes.getStack(1).main == modes.PASS_THROUGH - ? (modes.getStack(2).mainMode.display() || modes.getStack(2).mainMode.name) + " (next)" + ? (modes.getStack(2).main.display() || modes.getStack(2).mainMode.name) + " (next)" : "PASS THROUGH (next)" }, { // Fix me. @@ -153,7 +153,7 @@ var Modes = Module("modes", { prefs.set("accessibility.browsewithcaret", false); statusline.updateUrl(); - if (!stack.fromFocus && (prev.mainMode.input || prev.mainMode.ownsFocus)) + if (!stack.fromFocus && (prev.main.input || prev.main.ownsFocus)) dactyl.focusContent(true); if (prev.main == modes.NORMAL) { dactyl.focusContent(true); @@ -369,18 +369,17 @@ var Modes = Module("modes", { }, { Mode: Class("Mode", Number, { init: function init(name, options, params) { - let self = new Number(1 << Modes.Mode._id++); update(this, { - mask: self, + id: 1 << Modes.Mode._id++, name: name, params: params || {} }, options); - self.__proto__ = this; - return self; }, toString: function () this.name, + valueOf: function () this.id, + count: true, get description() this.disp, @@ -393,21 +392,24 @@ var Modes = Module("modes", { hidden: false, - input: false + input: false, + + get mask() this }, { _id: 0 }), StackElement: (function () { - let struct = Struct("main", "extended", "params", "saved"); - struct.defaultValue("params", function () this.main.params); - struct.prototype.__defineGetter__("mainMode", function () modes.getMode(this.main)); - struct.prototype.toString = function () !loaded.modes ? this.main : "[mode " + - this.mainMode.name + - (!this.extended ? "" : - "(" + - [modes.getMode(1 << i).name for (i in util.range(0, 32)) if (modes.getMode(1 << i) && (this.extended & (1 << i)))].join("|") + - ")") + "]"; - return struct; + const StackElement = Struct("main", "extended", "params", "saved"); + StackElement.defaultValue("params", function () this.main.params); + update(StackElement.prototype, { + toString: function () !loaded.modes ? this.main : "[mode " + + this.main.name + + (!this.extended ? "" : + "(" + modes.all.filter(function (m) this.extended & m) + .join("|") + + ")") + "]" + }); + return StackElement; })(), cacheId: 0, boundProperty: function boundProperty(desc) {