The following is a mix of spec and implementation issues that I
encountered in my as-of-yet unsuccessful attempt to make use of service
workers in the ASF Board Agenda tool.
1) the "offline fallback" use case for Service Workers involves
intercepting fetch requests, issuing the request, and then recovering
from any errors that may occur. Unfortunately, issuing the
event.request will not faithfully reproduce the original navigate
request, in particular, credentials are not included.
2) passing credentials: 'include' on fetch requests within a service
worker will succeed if the browser has access to the credentials (e.g.
due to prompting the user earlier in the browser session). If the
credentials are not present, Firefox will prompt for this information.
Chrome will not. This is a showstopper for offline access to an
authenticated web page with Chrome.
3) event.request.headers.get("Authorization") is available on Firefox
but not on Chrome.
4) cache.keys() is supposed to return a promise. On both Firefox and
Chrome, cache.keys() returns an empty array instead. cache.matchAll()
can be used to get all of the responses, but not the keys.
5) calling registration.unregister() followed by
navigator.serviceWorker.getRegistrations() will still return a list
containing the now unregistered service worker in both Firefox and Chrome.
6) EventSource is available to service workers in Chrome but not in
Firefox. Using importScripts in an attempt to load the Yaffle polyfill
Advice on how to proceed with these issues (filing bugs on the spec
and/or one or more implementations, perhaps?) would be greatly appreciated.
- Sam Ruby
- Service Worker issues Sam Ruby