EventsDispatcher should filter Events by context descriptor
Categories
(Remote Protocol :: Agent, defect, P1)
Tracking
(firefox106 fixed)
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
References
Details
(Whiteboard: [webdriver:m4])
Attachments
(1 file)
See https://phabricator.services.mozilla.com/D142514?id=564172#inline-788428
We are adding an EventsDispatcher utility to easily subscribe to internal events using session data. The API for this EventsDispatcher is: on(eventName, contextDescriptor, callback)
. However when an event comes up to the events dispatcher, we have no way to know if it actually matches the contextDescriptor for a given callback.
Imagine a situation where we have two callsites,for two different tabs:
this.messageHandler.eventsDispatcher.on("some-event", context1, cb1);
this.messageHandler.eventsDispatcher.on("some-event", context2, cb2);
Assuming context1 and context2 each correspond to a toplevel browsing context for a different tab. Today, when "some-event" is emitted from any of those tabs, both cb1 and cb2 will be triggered because we have no way to check where the event comes from.
We should:
- store the context descriptor next to the callback in EventsDispatcher
- attach the origin (message handler's type+id) to the event
- check if the event origin matches the context descriptor
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Depends on D155070
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
bugherder |
Description
•