Dedicated workers as service worker clients
- Category
- Service Worker
- Type
- New or changed feature
- Status
- Enabled by default (Chrome Enabled by default)
- Intent stage
- Prepare to ship
WPT details: https://wpt.fyi/results/html/cross-origin-embedder-policy/dedicated-worker-cache-storage.https.html https://wpt.fyi/results/service-workers/service-worker/clients-matchall-blob-url-worker.https.html https://wpt.fyi/results/service-workers/service-worker/clients-get-client-types.https.html https://wpt.fyi/results/service-workers/service-worker/client-url-of-blob-url-worker.https.html https://wpt.fyi/results/service-workers/service-worker/dedicated-worker-service-worker-interception.https.html
Summary
New behaviors by this feature: 1) dedicated workers will be real service worker clients and they will be exposed via the Clients API. `Clients.matchAll({‘type’: ‘worker’})` will include dedicated workers. The ‘type’ option is an opt-in option and `Clients.matchAll()` returns only window clients by default. 2) dedicated workers will be controlled by their own service worker matched with the dedicated worker script URL.
Motivation
New behaviors are aligned with the spec.
Standards & signals
- Specification: https://w3c.github.io/ServiceWorker
- Firefox: Positive — Shipped based on the result of WPTs
- Safari: No signal
- Web developers: Mixed signals — Positive: 1) crbug has 14 stars. 2) Some developers want this feature according to crbug.com/1186571#c3 crbug.com/1190916#c1. 3) Some existing issue will be unblocked. Negative: We know of at least one site (internal) that has an out-of-scope dedicated worker that they need to be controlled for offline support. To avoid breakage, they plan to change their worker script URL to align with this change, while they don't seem to view this change as benefiting them.
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=906991
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=html%2Fcross-origin-embedder-policy%2Fdedicated-worker-cache-storage
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Dedicated%20workers%20as%20service%20worker%20clients
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Dedicated%20workers%20as%20service%20worker%20clients
- Baseline status: https://webstatus.dev/?q=Dedicated%20workers%20as%20service%20worker%20clients