From 7fdb996f491b64b9e40ce11418214cc7d278b9fd Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 9 Jul 2019 14:13:44 +0200 Subject: [PATCH] not everyone supports preload, #75061 --- .../resources/browser/resourceServiceWorkerMain.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerMain.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerMain.ts index 6da4d5302f159..8ddec567e097b 100644 --- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerMain.ts +++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerMain.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ // trigger service worker updates -const _tag = 'e4d8e56a-394f-4541-b817-421b1e2feed1'; +const _tag = '586d4b79-f5c4-4aff-9a14-2139ddfbb486'; (function () { @@ -38,12 +38,7 @@ const _tag = 'e4d8e56a-394f-4541-b817-421b1e2feed1'; return value; } // try the network (prefetch or fetch) - const res = await event.preloadResponse; - if (res) { - return res; - } else { - return fetch(event.request); - } + return event.preloadResponse || fetch(event.request); })); }); self.addEventListener('install', (event: any) => { @@ -53,7 +48,9 @@ const _tag = 'e4d8e56a-394f-4541-b817-421b1e2feed1'; self.addEventListener('activate', (event: any) => { event.waitUntil((async () => { - await (self as any).registration.navigationPreload.enable(); // Enable navigation preloads! + if ((self as any).registration.navigationPreload) { + await (self as any).registration.navigationPreload.enable(); // Enable navigation preloads! + } await (self as any).clients.claim(); // Become available to all pages })()); });