diff --git a/accessible/src/jsat/TouchAdapter.jsm b/accessible/src/jsat/TouchAdapter.jsm index 72c1c3f87ba..765a6705294 100644 --- a/accessible/src/jsat/TouchAdapter.jsm +++ b/accessible/src/jsat/TouchAdapter.jsm @@ -106,6 +106,10 @@ this.TouchAdapter = { return; } + if (aEvent.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN) { + return; + } + if (this._delayedEvent) { Utils.win.clearTimeout(this._delayedEvent); delete this._delayedEvent; diff --git a/accessible/src/jsat/content-script.js b/accessible/src/jsat/content-script.js index 90a10eb6174..17280e116b0 100644 --- a/accessible/src/jsat/content-script.js +++ b/accessible/src/jsat/content-script.js @@ -121,10 +121,17 @@ function activateCurrent(aMessage) { let x = Math.round((objX.value - docX.value) + objW.value / 2); let y = Math.round((objY.value - docY.value) + objH.value / 2); - let cwu = content.QueryInterface(Ci.nsIInterfaceRequestor). - getInterface(Ci.nsIDOMWindowUtils); - cwu.sendMouseEventToWindow('mousedown', x, y, 0, 1, 0, false); - cwu.sendMouseEventToWindow('mouseup', x, y, 0, 1, 0, false); + let node = aAccessible.DOMNode || aAccessible.parent.DOMNode; + + function dispatchMouseEvent(aEventType) { + let evt = content.document.createEvent("MouseEvents"); + evt.initMouseEvent(aEventType, true, true, content, + x, y, 0, 0, 0, false, false, false, false, 0, null); + node.dispatchEvent(evt); + } + + dispatchMouseEvent("mousedown"); + dispatchMouseEvent("mouseup"); } }