Intent to Prototype: Service Worker soft update after functional events

17 views
Skip to first unread message

Xavier Leune

unread,
9:02 AM (3 hours ago) 9:02 AM
to blink-dev
Contact email: xavier...@gmail.com

Explainer: N/A (spec compliance fix)

Specification: https://w3c.github.io/ServiceWorker/#fire-functional-event-algorithm (step 8)

Summary:
The Service Worker spec requires a "soft update" after each functional event (push, notification click/close, background sync, payment, etc.) completes on a stale registration (last update check > 24h).

Chrome currently does not implement this. It updates only trigger via page navigations or a staleness timer that requires the worker to run for > 30s, which rarely happens for short-lived push event handlers.

This change adds a centralized FireFunctionalEvent() method to ServiceWorkerVersion that implements the spec's "Fire Functional Event" algorithm, including soft update triggers at steps 3 (should skip event), 5 (worker start failure), and 8 (after event completion). Each functional event dispatcher is migrated to use this method.

Blink component: Blink>ServiceWorker

Motivation: Without this, a service worker updated on the server is never detected upon receiving push notifications unless the user navigates to the page. This breaks the 24h update guarantee the spec provides.

Tracking bug: https://crbug.com/486495094

Risks: Low — ScheduleUpdate() is idempotent, and when the script is unchanged, the conditional HTTP request returns 304 with no installation overhead. The behavioral change is that stale registrations will now check for updates after background events, which is the spec-intended behavior.

Chrome status: TBD, I've requested access to add the feature on https://chromestatus.com/features, I'll update this thread when I've gained access and posted the appropriate update.

Thanks everyone,

Xavier
Reply all
Reply to author
Forward
0 new messages