Re: [ServiceWorker] Support module service workers, and update for ES6 (#831)

> Hmm, does this properly take care of a same-origin request URL redirecting to a cross-origin response URL? I guess maybe that is why you are setting the redirect mode to manual?

SW doen't allow redirecting to any URL when it fetches its own script resource. That's the reason we set the redirect mode to "manual" and reject the update promise when the response's status is not an ok status. I don't see any problem using HTML's fetch worker scripts in that aspect.

> Also, I assume that we don't want to apply any of these customizations to import-ed files from the service worker? Or... do those need different customizations, like importScripts??

I don't think we want to apply any of those customizations in fetching the imported resources. But with regard to the criteria for checking if the resource has changed and needs a re-installation, we need a discussion. With importScripts currenlty, it checks (byte-by-byte match) only the main script resource. I.e., if a service worker has ever been successfully installed, it never re-fetches the impored scripts from the network but just uses the cached resources until it detects the change in the main script. For this, we're using a service worker's "imported scripts updated flag" (set upon successful installation in [Install](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#installation-algorithm) step 14).

However, with the "fetch a module script tree", the updated imported scripts will be fetched from the network regardless the changes in the main script. IMO, that should apply to the service worker too. I think [run the module script](https://html.spec.whatwg.org/multipage/webappapis.html#run-a-module-script) will take care of the rest. But I guess we still don't want to include the imported script resources in checking the changes for the re-installation decision. /cc @slightlyoff @jakearchibald @mkruisselbrink @annevk 

> How about the following changes to HTML:
> An alternative design would be:

I think I'm fine with either way, but will figure out further. @annevk's opinion will help here.

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

Received on Tuesday, 23 February 2016 02:31:15 UTC