mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 13:07:59 +01:00
Add some more error handling code during the bootstrapping process.
This commit is contained in:
12
common/bootstrap.js
vendored
12
common/bootstrap.js
vendored
@@ -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() {
|
||||
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))
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 +
|
||||
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.getMode(1 << i).name for (i in util.range(0, 32)) if (modes.getMode(1 << i) && (this.extended & (1 << i)))].join("|") +
|
||||
")") + "]";
|
||||
return struct;
|
||||
"(" + modes.all.filter(function (m) this.extended & m)
|
||||
.join("|") +
|
||||
")") + "]"
|
||||
});
|
||||
return StackElement;
|
||||
})(),
|
||||
cacheId: 0,
|
||||
boundProperty: function boundProperty(desc) {
|
||||
|
||||
Reference in New Issue
Block a user