Conversation
Add a new exported algorithm that other specifications (FedCM, Payment Handler) can call to unregister all service worker registrations for a given storage key (for example, when an identity handler or payment app declaration has been removed). The algorithm iterates the registration map for entries matching the given storage key, parses each serialized scope URL, and schedules an unregister job per scope. Fire-and-forget: no completion or failure signal is delivered to the caller. Part of w3c#1846.
8cc9612 to
5aef2ee
Compare
|
@yoshisatoyanagisawa CYTAL, thanks! |
|
The algorithm reminds me Clear-Site-Data: "storage" (https://w3c.github.io/webappsec-clear-site-data/#clear-dom). Overall looks good to me, but let me ask if we need to allow callers to ensure the removal or not. |
Use structural storage-key equality and document that the exported bulk unregister algorithm schedules jobs without waiting for registration-map removal or eventual registration clearing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e60256f0-04fc-4a2f-b93c-ca14f2fea252
|
Thanks @yoshisatoyanagisawa. I investigated the completion question and kept this fire-and-forget. FedCM only needs to stop dispatching when the declaration disappears and permits cleanup to happen asynchronously, so ordinary bulk unregistration appears sufficient here. @Brandr0id, could you confirm that this asynchronous contract works for the FedCM identity-handler teardown path? |
Part of #1846.
This introduces a new exported algorithm — a stable public surface that external specifications can bind to.
Change
Adds an exported
Unregister Service Workersalgorithm so other specifications such as FedCM and Payment Handler can schedule unregistration of all service worker registrations for a storage key.Algorithm
Input: storage key
Output: none
The algorithm:
Collecting the scopes before scheduling avoids iterating the registration map while unregister jobs can modify it.
Completion contract
The algorithm is intentionally fire-and-forget. It does not wait for the unregister jobs to finish, so matching registration-map entries might still exist when it returns.
Waiting for the jobs would only guarantee removal from the registration map. It would not guarantee physical destruction:
Clear Registrationcan remain delayed while a client uses the registration or the registration's workers have pending lifetime work.This matches the current FedCM teardown model, which stops dispatching to the identity handler when its declaration is removed and allows the registration itself to be removed asynchronously. Clear-Site-Data similarly invokes service worker unregistration without waiting for its promise.
Adoption implications
Related
Request Soft UpdateRegister a Service WorkerPreview | Diff