Closed Bug 1936770 Opened 1 year ago Closed 3 months ago

Implement "script.realmCreated" and "script.realmDestroyed" events for worker realms

Categories

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

task
Points:
5

Tracking

(firefox149 fixed)

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 4 open bugs, Regressed 1 open bug)

Details

(Whiteboard: [webdriver:m19], [wptsync upstream][webdriver:relnote])

Attachments

(4 files)

We should emit script.realmCreated events when a worker realm is registered.

This should be handled in a script module in the process layer.

Points: --- → 5
Priority: -- → P2
Whiteboard: [webdriver:backlog]
No longer depends on: 1936765
Whiteboard: [webdriver:backlog] → [webdriver:m17]
Priority: P2 → P3
Priority: P3 → P2
Whiteboard: [webdriver:m17] → [webdriver:backlog]
Whiteboard: [webdriver:backlog] → [webdriver:m19]
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

I don't think it makes sense to keep Bug 1936769 as a separate bug, let's handle both events at the same time and let me summarize a bit the status.

First off, with the events, we don't actually end up creating WorkerRealm instances. This will only happen in actual worker modules / message handlers when we start handling script.evaluate.

Then, to correctly support shared and service workers - which can have more than 1 related context - we need to adapt our logic to match several browsing contexts to a single context descriptor. This is actually spelled out in the spec in the event is enabled algorithm which takes an array of navigables as parameter. In order to enable this, a few event-related APIs are modified to support matching several browsing context ids. A dedicated browser mochitest is added to check this.

However at the moment, we don't have a way to retrieve relevant browsing context ids for shared and service workers. For shared workers, this is blocked on Bug 2014206. For service workers I will need to file a follow up, but if DevTools serves as prior art, the way we addressed it at that time was to also retrieve service worker subscriptions, and based on the controlled url guess which browsing contexts are controlled by it.

Based on this I suggest to align with the current wdspec tests we have:

  • check that dedicated workers can be received globally / per context / per user context
  • check that shared and service workers can be received globally

On the topic of tests, the wdspec tests currently use while(true){} as shared worker script, which seems to prevent Firefox from destroying the worker on navigation. I'm not sure why, but this doesn't like a webdriver issue and it should not be our main test for this feature.

Blocks: 2016096
Blocks: 1788658
Summary: Implement "script.realmCreated" event for worker realms → Implement "script.realmCreated" and "script.realmDestroyed" events for worker realms
Duplicate of this bug: 1936769
Blocks: 2016813
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/57788 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m19] → [webdriver:m19], [wptsync upstream]
Regressions: 2016842
Upstream PR merged by moz-wptsync-bot
Whiteboard: [webdriver:m19], [wptsync upstream] → [webdriver:m19], [wptsync upstream][webdriver:relnote]
Regressions: 2031597
No longer regressions: 2032066
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: