Re: [w3c/ServiceWorker] Should register() trigger byte-for-byte checking when WorkerType is updated? (#1408)

Thanks!
The current spec seems to have another edge case where install/activate events are not triggered as follows, and it also can be solved by adding a "skip byte-to-byte checking" flag.

```js
// ==== script in something.html ====
// Register a.js, and it imports b.js too.
await navigator.serviceWorker.register('a.js');
// Register b.js, but b.js is identical to the one we previously put into the script cache map.
await navigator.serviceWorker.register('b.js');

// ==== a.js ====
a = true;
if (typeof b === 'undefined') {
  importScripts('b.js');
}

// ==== b.js ====
b = true;
if (typeof a === 'undefined') {
  importScripts('a.js');
}
```

For example, does changing [[Register]] like this and refers to the flag in the [[Update]] algorithm make sense?

5. If registration is not null, then:
    ....
    4. If newestWorker is not null, job's script url doesn't equal to newestWorker's script url or job's worker type doesn't equal to newestWorker's worker type, then:
        1. Set job's skip byte-for-byte comparison to true.

-- 
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/1408#issuecomment-493890803

Received on Monday, 20 May 2019 08:35:35 UTC