- From: Monica Chintala <notifications@github.com>
- Date: Wed, 02 Sep 2026 10:45:04 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1848@github.com>
Part of #1846.
Adds a new exported [`Register a Service Worker`](https://w3c.github.io/ServiceWorker/#register-a-service-worker-algorithm) algorithm so other specifications (FedCM, Payment Handler) can register a service worker without going through a client-driven flow (for example, on behalf of a browser feature such as an identity handler or payment app).
## Algorithm
The algorithm is a thin wrapper around [`Create Job`](https://w3c.github.io/ServiceWorker/#create-job-algorithm) and [`Schedule Job`](https://w3c.github.io/ServiceWorker/#schedule-job-algorithm) with `job type = register`:
**Input:** `storage key`, script URL, scope URL, worker type, update via cache mode
**Output:** None
Steps:
1. Assert: script URL's origin and scope URL's origin are same origin.
2. If potentially trustworthy origin check on the script URL's origin is Not Trusted, return.
3. Create Job with *register* and the given inputs (null client, null promise).
4. Set worker type and update via cache mode on the job.
5. Schedule the job.
## Design notes
Two Notes are included in the spec text:
- **Fire-and-forget contract**: callers do not receive a completion or failure signal.
- **Referrer-null semantics**: because the algorithm passes `null` for the job's `client`, the resulting job has no `referrer`. The [`Register`](https://w3c.github.io/ServiceWorker/#register-algorithm) algorithm's same-origin check between the job's script URL and the job's referrer is therefore skipped. Callers must satisfy the same-origin precondition asserted in step 1.
## Placement
New section inserted between [`Register`](https://w3c.github.io/ServiceWorker/#register-algorithm) and [`Update`](https://w3c.github.io/ServiceWorker/#update-algorithm).
## Diff
**+26 / −0** in `index.bs`. No existing algorithm text is modified.
## Related
- #1846 — umbrella issue
- w3c-fedid/FedCM#842 — motivating PR
- #1847 — sibling PR (`Soft Update` export)
You can view, comment on, or merge this pull request online at:
https://github.com/w3c/ServiceWorker/pull/1848
-- Commit Summary --
* Editorial: add exported Register a Service Worker algorithm
-- File Changes --
M index.bs (26)
-- Patch Links --
https://github.com/w3c/ServiceWorker/pull/1848.patch
https://github.com/w3c/ServiceWorker/pull/1848.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1848
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/ServiceWorker/pull/1848@github.com>
Received on Wednesday, 2 September 2026 17:45:09 UTC