Skip to content

Commit

Permalink
workaround dev tools issue, #75061
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jul 11, 2019
1 parent 5018fdf commit 0e3c50a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ self.addEventListener('fetch', async (event: FetchEvent) => {
});

async function respondWithDefault(event: FetchEvent): Promise<Response> {
if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') {
// https://bugs.chromium.org/p/chromium/issues/detail?id=823392
// https://stackoverflow.com/questions/48463483/what-causes-a-failed-to-execute-fetch-on-serviceworkerglobalscope-only-if#49719964
// https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
return new Response(undefined, { status: 504, statusText: 'Gateway Timeout (dev tools: https://bugs.chromium.org/p/chromium/issues/detail?id=823392)' });
}
return await event.preloadResponse || await fetch(event.request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// statement.

// trigger service worker updates
const _tag = '91e182d6-d06b-40ff-a517-32df368117f8';
const _tag = 'c6f6120b-1407-4dd2-84cf-0fe0ef955140';

// loader world
const baseUrl = '../../../../../';
Expand Down

0 comments on commit 0e3c50a

Please sign in to comment.