Fail closed when worker update status is unavailable
This commit is contained in:
@@ -161,6 +161,9 @@
|
||||
const reg = root.navigator && await root.navigator.serviceWorker.getRegistration();
|
||||
const worker = reg && (reg.waiting || reg.active);
|
||||
const status = await askCacheStatus(worker);
|
||||
// Unknown protocol is a retryable failure, never an empty successful
|
||||
// legacy refresh followed by a reload into the old persistent manifest.
|
||||
if (worker && !status) throw new Error('Worker update status unavailable; try again');
|
||||
if (status && status.assetSync) {
|
||||
const result = await core.syncAssets(m,{cache,fetchFn:opts.fetchFn});
|
||||
if (!reg.waiting) await core.commit(m,cache);
|
||||
|
||||
Reference in New Issue
Block a user