This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 325
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Bug: Toolbox does not handle quote exceeded errors #277
Copy link
Copy link
Open
Labels
Description
If a user has too little space on their harddrive or runs chrome on a partition that is space constrained in other ways, then the serviceworker may start up, but then crash with a cryptic message in the error log:
sw.js:1 Uncaught (in promise) DOMException: Quota exceeded.
Promise rejected (async)
(anonymous) @ sw-toolbox.js:40
IMHO, this is a clear bug. SW-toolbox should at least be able let the client run but with the files uncached. As it is, other sites work, but our site just hangs...
Here's my sw.js:
(global => {
'use strict'
// PRECACHE
// Load the sw-toolbox library.
global.importScripts('/v3-files/assets/sw-toolbox.js')
// Turn on debug logging, visible in the Developer Tools' console.
global.toolbox.options.debug = false
// Set up a handler for HTTP GET requests for /data/ URLs:
global.toolbox.router.get(/https:\/\/(localhost|elev.asku.no|gt)(:3000|)\//,
global.toolbox.networkFirst, {})
global.toolbox.router.get(/https:\/\/(localhost|elev.asku.no|gt)(:3000|)\/centrifugo.+/,
global.toolbox.networkFirst, {})
global.toolbox.router.get(/https:\/\/(localhost|elev.asku.no|gt)(:3000|)\/v3-files\/assets.+/,
global.toolbox.cacheFirst, {})
global.toolbox.router.get(/https:\/\/(localhost|elev.asku.no|gt)(:3000|)\/v3-files\/js.+/,
global.toolbox.networkFirst, {})
global.toolbox.router.get(/https:\/\/(localhost|elev.asku.no|gt)(:3000|)(media|uploads)\/.+/,
global.toolbox.cacheFirst, {})
global.toolbox.router.get(/\/fonts.gstatic.com\/.+/,
global.toolbox.cacheFirst, {})
// By default, all requests that don't match our custom handler will use the
// toolbox.networkFirst cache strategy, and their responses will be stored in
// the default cache.
// global.toolbox.router.default = global.toolbox.networkOnly
var preCacheFiles = []
global.toolbox.precache(preCacheFiles)
// Boilerplate to ensure our service worker takes control of the page as soon
// as possible.
global.addEventListener('install', event => event.waitUntil(global.skipWaiting()))
global.addEventListener('activate', event => event.waitUntil(global.clients.claim()))
})(self)
liam-swinney, aleluc13, valioDOTch, identidadgh, Natanael1234 and 1 more