angular-cn/packages/service-worker/worker/test
George Kalpakas cc30dc0713 fix(service-worker): ensure obsolete caches are always cleaned up (#42622)
Previously, the SW was only able to clean up caches for app-versions
found in the `Driver`'s `versions` map. If (for some reason) the
`Driver` failed to load a valid stored state (including app-versions)
and ended up with an [empty `versions` map][1], any obsolete versions
would remain in the cache storage. This case was rare but possible.

This commit makes the cache clean-up logic more robust by ensuring that
all app-version caches are removed unless they are currently used by the
SW to serve active clients (with the exception of the latest
app-version, which is always retained).

Fixes #41728

[1]: 9de65dbdce/packages/service-worker/worker/src/driver.ts (L515-L529)

PR Close #42622
2021-06-24 09:55:32 -07:00
..
BUILD.bazel test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
data_spec.ts refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622) 2021-06-24 09:55:32 -07:00
happy_spec.ts fix(service-worker): ensure obsolete caches are always cleaned up (#42622) 2021-06-24 09:55:32 -07:00
idle_spec.ts fix(service-worker): allow checking for updates when constantly polling the server (#40234) 2021-01-11 10:42:50 -08:00
prefetch_spec.ts refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622) 2021-06-24 09:55:32 -07:00