Re: [w3c/ServiceWorker] SharedWorker script interception after redirects (#1289)

> I briefly tested service worker generated redirects and Firefox seems to treat those the same as network redirects, but I may be missing something.

Can you share what you tested here?  I tried to reproduce, but can't.

Note, please test with FF60+ as this code has changed recently.  FF59 and earlier did not properly control the shared worker at all.  Only the initial script load was intercepted, but not subresource requests.

My test is here:

https://sw-shared-worker-wanderview.glitch.me/

Click register and then "start shared worker (sw redirect)".  This will do a `respondWith(Response.redirect(url))`.

In the console I see that the shared worker ends up getting handled by the scope 2 service worker.
```
making shared worker with service worker redirect
===> scope 1 fetch event: https://sw-shared-worker-wanderview.glitch.me/scope1/sw-302
===> scope 2 fetch event: https://sw-shared-worker-wanderview.glitch.me/scope2/service-worker-served-shared-worker.js
serving...
hi i am a shared worker SERVED by the sw
https://sw-shared-worker-wanderview.glitch.me/scope2/service-worker-served-shared-worker.js
onconnect
msg from worker: hello from shared worker SERVED by the sw: https://sw-shared-worker-wanderview.glitch.me/scope2/service-worker-served-shared-worker.js
===> scope 2 fetch event: https://sw-shared-worker-wanderview.glitch.me/hello
msg from worker: fetched: hello from the service worker
```

I think this is correct.  Even though the response returned from the service worker is a redirect status code, its still a non-null response so we don't set the service worker mode to none.

-- 
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/1289#issuecomment-375172408

Received on Thursday, 22 March 2018 04:00:32 UTC