[w3c/ServiceWorker] Does changing updateViaCache mint a new ServiceWorkerRegistration or update them all? (#1189)

Suppose you have something like this:
```javascript
var reg;
navigator.serviceWorker.getRegistration(url).then(() => { reg = doc; });
reg.updateViaCache;  // 'all';
register(sw, {updateViaCache: 'none'}).then(r => {
  reg === r;  // true?
  reg.updateViaCache; // 'all' or 'none'?
});
```

I'm leaning toward updating all existing ServiceWorkerRegistration objects, because otherwise ServiceWorkerGlobalScope#registration would have to mutate to a brand new registration object after register() settled, which doesn't feel right.

However, updating them all is a bit troublesome and seems to lead to race conditions (one of them has been updated but the others haven't). Would it be worth considering changing reg.updateViaCache to a promise similar to NavigationPreloadManager state?

@wanderview what does Firefox do?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1189

Received on Monday, 21 August 2017 05:59:50 UTC