[w3c/ServiceWorker] [BUG] setTimeout/setInterval mix with importScripts leads to DOMExeption (#1580)

### Control Group that works
```sh
$ cat serviceWorker.js 
importScripts('/a.js'); 

setTimeout(()=>{
        importScripts('/a.js'); 
}, 1000);

setInterval(()=>{
        importScripts('/a.js'); 
}, 1000);
$ cat a.js            
console.log(42)
```
output:
```txt
42
42
42
42
42
...
```


### Experiment Group that BOOM
```sh
$ cat serviceWorker.js
setTimeout(()=>{
        importScripts('/a.hashid.js'); 
}, 1000);

setInterval(()=>{
        importScripts('/a.hashid.js'); 
}, 1000);
$ cat a.js 
console.log(42)
```

```txt
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at '<foobar>/a.js' failed to load.
    at <foobar>/serviceWorker.js
```

### Maybe
[issue838](https://github.com/w3c/ServiceWorker/issues/838) maybe related?
"setTimeout/setInterval are unreliable in ServiceWorker"

-- 
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/1580

Received on Wednesday, 14 April 2021 10:36:36 UTC