mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
Catch navigator.serviceWorker.getRegistrations() Promise rejection (#7708)
GitOrigin-RevId: 4c68e4272ea9618503ad655dd6c24841486601b2
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user