Intent to Implement and Ship: updateViaCache for service workers

279 views
Skip to first unread message

Haruka Iwao

unread,
Jun 21, 2017, 5:08:36 AM6/21/17
to blin...@chromium.org, nhi...@chromium.org, fal...@chromium.org

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

http://crbug.com/675540


Link to entry on the feature dashboard

https://www.chromestatus.com/features/6059838387781632

Requesting approval to ship?

Yes.


Mike West

unread,
Jun 22, 2017, 5:35:29 AM6/22/17
to Haruka Iwao, blink-dev, Hiroki Nakagawa, Matt Falkenhagen
LGTM1. It looks like there's solid agreement between vendors on both the upstreamed tests and the spec change. Have y'all filed a bug against Edge so they can ensure that their behind-a-flag service worker implementation lines up with this enum when they ship?

-mike

--
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.

Philip Jägenstedt

unread,
Jun 22, 2017, 9:59:36 AM6/22/17
to Mike West, Haruka Iwao, blink-dev, Hiroki Nakagawa, Matt Falkenhagen

Rick Byers

unread,
Jun 22, 2017, 10:17:15 AM6/22/17
to Philip Jägenstedt, Mike West, Haruka Iwao, blink-dev, Hiroki Nakagawa, Matt Falkenhagen

Matt Falkenhagen

unread,
Jun 27, 2017, 1:44:15 AM6/27/17
to Mike West, Haruka Iwao, blink-dev, Hiroki Nakagawa
We're in pretty good contact with Edge and they were at the face-to-face meeting where updateViaCache was sketched out. I'll send them an email.

Reply all
Reply to author
Forward
0 new messages