Service Worker Issues In Edge Browser
Some unmentioned issues I’ve found trying to use Service Workers in Edge.
The ServiceWorkerRegistration.update method
From the Spec:
Returns: A Promise
that resolves with a ServiceWorkerRegistration
object.
Calling this is supposed to return a Promise with the SWRegistration object as a value. That value should contain a new Service Worker in the ‘installing’ property.
While this is correctly implemented in Chrome. In Edge there is no SWRegistration object returned. Which seems like a bug to me and means that I can’t use .update() as a cross browser safe implementation.
The ServiceWorkerRegistration.onupdatefound callback
From the spec:
The onupdatefound
property of the ServiceWorkerRegistration
interface is an EventListener
property called whenever an event of type statechange
is fired; it is fired any time the ServiceWorkerRegistration.installing
property acquires a new service worker.
So if you listened to onupdatefound and then called SWRegistration.update(), then changed the sw.js file. The event should fire. It does in Chrome, but not in Edge.