Closed Bug 1343308 Opened 5 years ago Closed 5 years ago

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


(Core :: DOM: Service Workers, defect)

Not set



Tracking Status
firefox54 --- fixed


(Reporter: bkelly, Assigned: bkelly)


(Blocks 1 open bug)



(2 files)

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

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
P1 Make Clients.matchAll() only return Clients controlled by the current service worker. r=baku
P2 Add a WPT test verifying Clients.matchAll() only returns Clients controlled by calling worker. r=baku
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.