Contact emails
yu...@chromium.org, nhi...@chromium.org, fal...@chromium.org
Spec
https://w3c.github.io/ServiceWorker/#service-worker-registration-updateviacache (also https://github.com/w3c/ServiceWorker/issues/1104)
Summary
updateViaCache is an attribute on ServiceWorkerRegistration that controls whether the browser cache (the HTTP cache) is used when performing an update check.
Service workers consist of a main script and possibly imported scripts. The service worker update check involves fetching the current scripts and comparing them to the installed scripts. This intent to ship concerns whether fetching the current scripts uses or bypasses the browser cache.
Currently the update check uses the browser cache by default. The one exception is that every 24 hours, the cache is force bypassed.
The proposed change is to change this behavior to bypass the cache by default for main scripts.
Developers will be able to control the behavior using the updateViaCache attribute.
Motivation
Using Cache-control: no-cache or max-age: 0 on their service worker script resources has been a best practice among developers in order to detect script updates. The spec is updated to reflect this practice and now includes a new parameter, updateViaCache for cache control for service worker registrations.
Interoperability and Compatibility Risk
Low. This changes the default behavior of the service worker update check to bypass the browser cache. The most noticeable change is that the server is pinged more often.
Firefox is also implementing this change.
Blink currently doesn't consider imported scripts during the service worker update check (issue 648295). Currently imported scripts are only updated when the update check determined that the main script changed. In this scenario, the updateViaCache value will be taken into account for imported scripts.
We intend to fix issue 648295, but developer feedback has caused us to believe that changing the default caching behavior is high priority, so want to ship this change first.
Edge: No signals
Firefox: In Development/ (https://bugzilla.mozilla.org/show_bug.cgi?id=1353636)
Safari: No signals
Web developers: Positive (example: https://github.com/facebookincubator/create-react-app/issues/2440#issuecomment-305514486)
Ongoing technical constraints
None
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
Is this feature fully tested by web-platform-tests?
Yes we will test with web-platform-tests.
OWP launch tracking bug
Link to entry on the feature dashboard
https://www.chromestatus.com/features/6059838387781632
Requesting approval to ship?
Yes.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPevTqmYZyAZd-L1B1nEN9UA0OXwym0sjUbpQY20xy6y3J4%3DBA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKXHy%3Dd3oL160YLYkGfKXYW7q8rdYOF%3DhKJOeB0mjoWZZ_nqgg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYcf2R_sMOwZCbpKAkVP%2Bd5rkmD9kwOq7vm2nMHs-PiAuQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKXHy%3Dd3oL160YLYkGfKXYW7q8rdYOF%3DhKJOeB0mjoWZZ_nqgg%40mail.gmail.com.