Re: [whatwg/fetch] Resource fetches for notifications shown from a service worker should trigger onfetch (#303)

Thinking about this again, I still think individual APIs should set the skip-service-worker-flag. The following APIs should set that flag *if* the request's client is a service worker:

* `fetch` - else you get loops
* `cache.add`/`addAll` - else an existing service worker can break installing ones
* `importScripts` - these have special caching & fetching behaviour
* `import` & `import()` - these should follow the same caching & fetching behaviour as `importScripts`

I think notifications should use the current settings object as their client, and shouldn't be a client of their own (they don't have their own CSP rules and can't perform fetches after creation etc etc).

There's the issue of using fetches to keep the service worker open, but I think we can solve that (and other issues) using the timeout pattern described in https://github.com/w3c/ServiceWorker/issues/980#issuecomment-248920422. A fetch from one service worker to another (or itself) will get an expiry time equal to the longest expiry time currently holding the originating service worker open.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/303#issuecomment-265483054

Received on Wednesday, 7 December 2016 15:50:12 UTC