Re: [ServiceWorker] importScripts() should throw? (#642)

Currently, the spec has changed to allow `importScript(urls)` only in oninstall based on the discussion in this thread and https://github.com/slightlyoff/ServiceWorker/issues/730.

However, I don't feel like it's a right behavior as even the cached scripts will not have any chance to execute again later when other functional events are dispatched.

As the service worker's [imported scripts updated flag](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-imported-scripts-updated-flag) already guarantees the network fetch will occur only during the update phase and in the later runs the cached scripts are always used (cache miss is a network error), I suggest we remove this restriction that limits the use only in oninstall.

> As an implementer I like the idea of allowing it only at startup

To make it clear, the importScripts in the current spec runs only at startup as [Run Service Worker](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#run-service-worker-algorithm) algorithm just returns early when called while it's already running.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/642#issuecomment-137631700

Received on Friday, 4 September 2015 02:44:11 UTC