angular-docs-cn/packages/service-worker
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
..
cli fix(service-worker): update type castings for JSON.parse usage (#40710) 2021-02-09 10:48:43 -08:00
config feat(service-worker): add the option to prefer network for navigation requests (#38565) 2020-09-22 09:29:20 -07:00
src feat(service-worker): add `openWindow`, `focusLastFocusedOrOpen` and `navigateLastFocusedOrOpen` (#42520) 2021-06-23 16:31:09 +00:00
test refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622) 2021-06-24 09:55:32 -07:00
testing build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
worker fix(service-worker): ensure obsolete caches are always cleaned up (#42622) 2021-06-24 09:55:32 -07:00
BUILD.bazel refactor(dev-infra): ng_rollup_bundle rule should leverage `@bazel/rollup` (#37623) 2020-06-22 10:55:28 -07:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json feat(core): support TypeScript 4.3 (#42022) 2021-06-04 11:17:09 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
safety-worker.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00