Closed Bug 1763137 Opened 3 years ago Closed 2 years ago

EventsDispatcher should filter Events by context descriptor

Categories

(Remote Protocol :: Agent, defect, P1)

defect
Points:
2

Tracking

(firefox106 fixed)

RESOLVED FIXED
106 Branch
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
Severity: -- → S3
Points: --- → 2
Priority: -- → P3
Whiteboard: [bidi-m3-mvp]
Priority: P3 → P2
Whiteboard: [bidi-m3-mvp] → [webdriver:backlog]
Depends on: 1783177
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Priority: P2 → P1
Whiteboard: [webdriver:backlog] → [webdriver:m4]
Blocks: 1741834
Blocks: 1723102
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a7f1e13009f6 [messagehandler] Filter events based on context descriptor used to subscribe to them r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: