Closed Bug 1786255 Opened 2 years ago Closed 2 years ago

All MessageHandler event subscriptions should come from SessionData

Categories

(Remote Protocol :: WebDriver BiDi, task, P1)

task
Points:
2

Tracking

(firefox106 fixed)

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

(Whiteboard: [webdriver:m4])

Attachments

(3 files)

After Bug 1783177, we will no longer have internal & protocol events. However, event subscription is still inconsistent. The events coming form content processes are using session data to start their listeners (example). However events subscribed from the parent process completely bypass SessionData and directly create subscribers after receiving a specific internal command called _subscribeEvent (example).

This makes it hard to share more logic for events. Ideally all events would be driven and tracked from a single place (EventsDispatcher) and fully stored in SessionData.

This bug is about extending SessionData updates so that they can also reach root modules. This way root modules can implement event handling in almost the same way as windowglobal modules.

There is of course a catch. For windowglobal modules, the "scope" of the listener is usually the scope of the windowglobal itself. However for modules in the root layer, they will need to check the context descriptor for which a given event is set. So there will be some additional complexity when comparing to a simple windowglobal event.

Depends on D155025
The current version returns the return value of the command (which can be a broadcast, depending on the provided descriptor).
This makes it impossible to know what to consistently expect as a return value.

It seems it was only used for a test assertion, so rewrite the test and cleanup the return value

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Depends on D155059

In order for all events to really use similar codepaths, they should not use different subscription mechanism.

Setting an event in SessionData should be the entry point for all modules to decide to update their listeners or not.
Therefore we will also call _applySessionData on root modules which support this.

Next patch will start using this for the browsingContext.contextCreated event.

Depends on D155060

The _subscribe/_unsubscribeEvent can be removed in the next patch

Julian, how many points should we account for this bug?

Flags: needinfo?(jdescottes)
Priority: -- → P1
Whiteboard: [webdriver:m4]

I think 2 points should be fine? Will set for now, feel free to update

Flags: needinfo?(jdescottes)
Points: --- → 2
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/41c91519bd36
[messagehandler] RootMessageHandler _applySessionData should return the session data update r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/cb14a1bf6b01
[messagehandler] Apply session data to Root layer modules r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/824b5bec2bed
[messagehandler] Use session data to subscribe to browsingContext.contextCreated 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: