fix(service-worker): clean up caches from old SW versions (#26319)
Since the SW immediately takes over all clients, it is safe to delete caches used by older (e.g. beta) `@angular/service-worker` versions to avoid running into browser storage quota limitations. PR Close #26319
This commit is contained in:

committed by
Miško Hevery

parent
96f38562bd
commit
00b5c7b49b
@ -79,6 +79,7 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
|
||||
private skippedWaiting = true;
|
||||
|
||||
private selfMessageQueue: any[] = [];
|
||||
autoAdvanceTime = false;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
unregistered !: boolean;
|
||||
readonly notifications: {title: string, options: Object}[] = [];
|
||||
@ -228,7 +229,7 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
|
||||
}
|
||||
|
||||
timeout(ms: number): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const promise = new Promise<void>(resolve => {
|
||||
this.timers.push({
|
||||
at: this.time + ms,
|
||||
duration: ms,
|
||||
@ -236,6 +237,12 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context
|
||||
fired: false,
|
||||
});
|
||||
});
|
||||
|
||||
if (this.autoAdvanceTime) {
|
||||
this.advance(ms);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
advance(by: number): void {
|
||||
|
Reference in New Issue
Block a user