1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-29 17:55:46 +01:00

Fix problem with events.dispatch. Closes issue #145.

This commit is contained in:
Kris Maglione
2010-11-21 12:56:32 -05:00
parent 88a8d07958
commit 46bf69781f

View File

@@ -358,10 +358,17 @@ const Events = Module("events", {
*/ */
dispatch: Class.memoize(function () dispatch: Class.memoize(function ()
util.haveGecko("2b") util.haveGecko("2b")
? function (target, event) // This causes a crash on Gecko<2.0, it seems. ? function (target, event) {
(target.ownerDocument || target.document || target).defaultView if (target instanceof Window)
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) target = target.document;
.dispatchDOMEventViaPresShell(target, event, true) if (target instanceof Document)
target = target.documentElement;
dactyl.assert(target);
// This causes a crash on Gecko<2.0, it seems.
target.ownerDocument.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.dispatchDOMEventViaPresShell(target, event, true)
}
: function (target, event) target.dispatchEvent(event)), : function (target, event) target.dispatchEvent(event)),
/** /**