Closed Bug 1343308 Opened 7 years ago Closed 7 years ago

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

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

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()`.
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+
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
https://hg.mozilla.org/mozilla-central/rev/1a34bdb0c31a
https://hg.mozilla.org/mozilla-central/rev/b8a79ad3b03e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.