Clients.matchAll() should only return Clients controlled by current ServiceWorker instance

RESOLVED FIXED in Firefox 54

Status

()

defect
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: bkelly, Assigned: bkelly)

Tracking

(Blocks 1 bug)

unspecified
mozilla54
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox54 fixed)

Details

Attachments

(2 attachments)

It appears that we've never fully implemented step 2.2.3.1 of:

https://w3c.github.io/ServiceWorker/#clients-getall

We should not only be checking the registration, but verifying the Client is controlled by the exact ServiceWorker instance calling `clients.matchAll()`.
(Assignee)

Updated

2 years ago
See Also: → 1266747
I'm going to fix this before bug 1293277 in order to make sure the new implementation passes this test.
Blocks: 1293277
By default Clients.matchAll() is supposed to return Client objects controlled by the ServiceWorker calling the API.  Our code, however, returns any Client controlled by the current registration.  This patch makes us match the spec by passing the current ServiceWorker's ID through to ServiceWorkerManager::GetAllClients().
Attachment #8842158 - Flags: review?(amarchesini)
This adds a test for the exact controller behavior in Clients.matchAll().  Basically it sets up an active worker that controls two frames and a waiting worker on the same registration.  It then verifies that the waiting worker sees nothing and the active worker sees its controllees.

We fail this test on current mozilla-central and pass it with the P1 patch.
Attachment #8842159 - Flags: review?(amarchesini)
These patches depend on the code in bug 1266747 landing first.
Depends on: 1266747
See Also: 1266747
Attachment #8842158 - Flags: review?(amarchesini) → review+
Attachment #8842159 - Flags: review?(amarchesini) → review+

Comment 6

2 years ago
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1a34bdb0c31a
P1 Make Clients.matchAll() only return Clients controlled by the current service worker. r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/b8a79ad3b03e
P2 Add a WPT test verifying Clients.matchAll() only returns Clients controlled by calling worker. r=baku

Comment 7

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/1a34bdb0c31a
https://hg.mozilla.org/mozilla-central/rev/b8a79ad3b03e
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.