On 06/16/2017 02:32 AM, Jim Porter wrote:
On 6/15/17 4:12 PM, Kartikaya Gupta wrote:
Not quite. For e10s, mouse events are sent across the process boundary
using the PBrowser ipdl protocol. On the parent side they go into
EventStateManager::DispatchCrossProcessEvent [1] which picks up the
TabParent and sends it over IPC to the TabChild. The TabChild then
dispatches it to the PuppetWidget in the content process.
Thanks for the code reference! That at least gives me a rough idea of
where all this is happening so I can maybe debug it.
If you set the right flags on the event it should get through.
Presumably you're creating this event from JS - you want to make sure
that it creates a WidgetMouseEvent with eContextMenu message type. I
don't know if that can be done without using the DOMWindowUtils APIs.
Posting your code snippet for event creation might help.
Here's the code I'm currently using to generate a contextmenu event:
<https://github.com/jimporter/gesticulate/blob/e10s/src/chrome/modules/mouseGestures.jsm#L214-L216>.
That just dispatches the event to dom. No forwarding to child process will
happen.
You need to use methods in nsIDOMWindowUtils to dispatch events in a way which
simulates real events better
and causes forwarding to happen.
As mentioned, it works fine for creating a context menu in chrome, but
not content. (It also works fine in non-e10s content, but that shouldn't
be surprising.) I might be missing something, but when I looked in the
inspector, I didn't see any obvious differences between this event and
the original contextmenu event that I suppressed.
Maybe there's some issue with the event target? When the original
contextmenu event is fired, it says the target is the XUL tabbrowser
(#content) and the originalTarget is the XUL browser element. I've tried
dispatching my synthetic event to both, but neither does anything.
I've also tried keeping the original contextmenu event around that I
suppressed and re-dispatching that, but it doesn't work either. However,
since I called .preventDefault()/.stopPropagation() on that object, I'm
not sure I'd expect it to work anyway.
- Jim
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform