1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-02 14:13:32 +02:00

Dispatch via the PresShell less often. Closes issue #154.

This commit is contained in:
Kris Maglione
2010-12-01 14:54:10 -05:00
parent 437cd802eb
commit e461ca9b95

View File

@@ -362,16 +362,13 @@ const Events = Module("events", {
dispatch: Class.memoize(function () dispatch: Class.memoize(function ()
util.haveGecko("2b") util.haveGecko("2b")
? function (target, event) { ? function (target, event) {
if (target instanceof Window) if (target instanceof Element)
target = target.document; // This causes a crash on Gecko<2.0, it seems.
if (target instanceof Document) (target.ownerDocument || target.document || target).defaultView
target = target.documentElement; .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
dactyl.assert(target); .dispatchDOMEventViaPresShell(target, event, true)
else
// This causes a crash on Gecko<2.0, it seems. target.dispatchEvent(event);
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)),