[w3c/ServiceWorker] Handling duplicate importScripts() (#1041)

What should happen when registering a service worker that does:
`importScripts('script.js'); importScripts('script.js');`

In Chrome's implementation, the response for the first importScripts() is stored (so that if SW completes installing, that is the version that is persisted), and the second one goes to network ignoring the first one and is not persisted.

That seems reasonable but as part of another bug fix, I'm thinking of changing this so that the second importScripts() returns the first stored version.

Also what should happen when a service worker recursively importScripts() itself? In Chrome's implementation, this causes a JS stack overflow, and each call goes to network, but only the first one is attempted to be stored. I think I'll simply respond with a network error in this case since handling it is wasteful and futile.

Thoughts?

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

Received on Wednesday, 28 December 2016 06:27:23 UTC