mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-27 09:42:00 +00:00
Catch navigator.serviceWorker.getRegistrations() Promise rejection (#7708)
GitOrigin-RevId: 4c68e4272ea9618503ad655dd6c24841486601b2
This commit is contained in:
parent
77747a0aca
commit
24a317a836
1 changed files with 12 additions and 4 deletions
|
@ -56,10 +56,18 @@ export function unregisterServiceWorker() {
|
|||
type: 'disable',
|
||||
})
|
||||
}
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(worker => {
|
||||
worker.unregister()
|
||||
|
||||
navigator.serviceWorker
|
||||
.getRegistrations()
|
||||
.catch(error => {
|
||||
// fail silently if permission not given (e.g. SecurityError)
|
||||
console.error('error listing service worker registrations', error)
|
||||
return []
|
||||
})
|
||||
.then(registrations => {
|
||||
registrations.forEach(worker => {
|
||||
worker.unregister()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue