Verify explicit activation and legacy incremental migration

This commit is contained in:
Jonathan Sykes
2026-10-08 00:03:14 +08:00
parent bb446c717f
commit 5d1e5ec791
7 changed files with 96 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
/* ============================================================================
* sw-update — makes "Refresh UI" actually land the new build.
*
* Framework-free and dependency-free on purpose (same pattern as
* Framework-free, with a shared sync core and a legacy fallback (same pattern as
* async-guard.js):
* • Loads as a plain <script> under CSP `script-src 'self'` (browser
* global `window.SwUpdate`).
@@ -17,7 +17,7 @@
* already current (a failed install leaves a partial cache that the
* activate handler then mistook for a previous deploy).
*
* The fix no longer depends on the service-worker install lifecycle:
* Legacy fallback (retained for ASSET_SYNC=0):
* 1. refreshShellInPlace() downloads a fresh copy of every file the shell
* caches hold (cache-busted, so even an old worker's cache-first
* handler can't answer with the stale copy) — ALL of them or nothing —
@@ -25,6 +25,10 @@
* serves the next load, it serves the new build.
* 2. Only then is a waiting worker (if any) activated, and the page
* reloaded once.
* Incremental mode uses AssetSyncCore to fetch only missing verified hash URLs
* and publishes a complete blocking set. Playback guards cover activation and
* reload callbacks; PLAYING reports provide an additional worker guard.
*
* The banner itself only opens when the build the page is running differs
* from the server's (see app.js maybeShowUpdateBanner), so no lifecycle
* event can re-open it once the page is current.