Closed Bug 1155660 Opened 9 years ago Closed 6 years ago

Investigate having a message manager specific to each browser

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1311041

People

(Reporter: ato, Unassigned)

Details

(Keywords: pi-marionette-server)

To be able to implement the new dispatching technique in an elegant way in the listener, we need to implement the nsIMessageListener interface much like GeckoDriver does.

This is currently not easily possible with the way we currently send messages to the listener, through a global message manager and by appending the browser's unique ID (a number incremented on listener registration).  The listener then registers listeners for commands using that number so they can receive the messages.

In the message listener documentation on MDN there are examples of a hash map storage to keep track of message managers for individual browsers.  It would offer a much cleaner approach to chrome<->content communication, but there might be technical reasons for why we don't already do this.  And I also imagine the implementation of this would not be entirely trivial.
I've thought about this on several occasions, and at least for desktop it seems feasible and clearly the way to go. Identifying listeners by window id has lead to a lot of complexity where always sending commands to a particular browser message manager would make things explicit and obviously correct.

The only reason I haven't pursued this already is I'm not sure how the message manager hierarchy differs on B2G and whether we'd have to do a lot to account for differences.

It would be a fairly invasive change, but I think it's worth looking into.
The hierarchy differs a bit with B2G, but it's easy to get OOP-frame specific message managers there; we already do, in fact, see e.g., https://dxr.mozilla.org/mozilla-central/source/testing/marionette/frame-manager.js#108
Having a message manager specific to each browser would also reduce the complexity of the ListenerProxy/ContentSender and GeckoDriver#sendAsync.
Will be addressed, finally, in bug 1311041.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.