Re: [w3c/ServiceWorker] how does service worker interact with html imports? (#1095)

I am not very familiar with Service Worker either ;)
Here's what I understand, but could be wrong.

As `navigator.serviceWorker` interface is shared between the master document and its imported document, I think it is natural to assume the service worker controller is shared among all imports with the master document.

FWIW, `document.URL` is same for all (the master document and all dependent imports).
An idiomatic way to access from script inside an import is to use `document.currentScript.ownerDocument`.   So `document.currentScript.ownerDocument.URL` returns the real URL for the import in which script is running.

So using any service worker APIs in the master document or imports doesn't make any difference basically - though CORS handling etc. could have some subtlety.

So answers would be (be careful - I haven't verified):
1. YES
2. NO
3. the master document URL
4. the master document URL

I don't think it's worth spending time to update specs for HTML Imports or Service Worker for clarification  of this, but do think it is enough to let the current Chrome behavior be de facto standard (as no other vendor cares). @wanderview do you have any particular concern (e.g. security) for this uncertainty of HTML Imports + Service Worker integration?

-- 
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/1095#issuecomment-290031264

Received on Wednesday, 29 March 2017 09:14:28 UTC