1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-10 16:54:13 +01:00

Fix error trapping in events.feedkeys.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-27 01:49:10 -05:00
parent 15b2909bc1
commit 163539ab29
3 changed files with 19 additions and 13 deletions

View File

@@ -410,6 +410,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
util.dump(elem);
util.reportError(e);
}
if (services.focus.focusedWindow == null)
util.dumpStack("focusedWindow == null");
},
/**
@@ -455,6 +457,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (elem && elem != dactyl.focusedElement)
dactyl.focus(elem);
if (services.focus.focusedWindow == null)
util.dumpStack("focusedWindow == null");
},
/** @property {Element} The currently focused element. */

View File

@@ -255,15 +255,15 @@ var Events = Module("events", {
* @returns {boolean}
*/
feedkeys: function (keys, noremap, quiet, mode) {
let wasFeeding = this.feedingKeys;
this.feedingKeys = true;
this.duringFeed = this.duringFeed || [];
let wasQuiet = commandline.quiet;
if (quiet)
commandline.quiet = quiet;
try {
var wasFeeding = this.feedingKeys;
this.feedingKeys = true;
this.duringFeed = this.duringFeed || [];
var wasQuiet = commandline.quiet;
if (quiet)
commandline.quiet = quiet;
util.threadYield(1, true);
for (let [, evt_obj] in Iterator(events.fromString(keys))) {

View File

@@ -355,13 +355,15 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
while (!(node instanceof Ci.nsIDOMElement) && node.parentNode)
node = node.parentNode;
try {
return node.ownerDocument.defaultView.getComputedStyle(node, null);
var res = node.ownerDocument.defaultView.getComputedStyle(node, null);
}
catch (e) {
util.reportError(e);
util.dump(String(node));
catch (e) {}
if (res == null) {
util.dumpStack("Computed style is null: " + node);
Cu.reportError(Error("Computed style is null: " + node));
return {};
}
return res;
},
/**
@@ -484,7 +486,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
*/
dumpStack: function dumpStack(msg, frames) {
let stack = util.stackLines(Error().stack);
stack = stack.slice(2, 2 + (frames || 0)).join("\n");
stack = stack.slice(2, 2 + (frames || stack.length)).join("\n");
util.dump((arguments.length == 0 ? "Stack" : msg) + "\n" + stack + "\n");
},