- From: Jeffrey Yasskin <notifications@github.com>
- Date: Tue, 22 May 2018 11:05:08 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/731@github.com>
If I'm tracing this correctly, a [`fetch()`](https://fetch.spec.whatwg.org/#fetch-method) from a Window that's handled by a Service Worker returns a Response object in the Window's realm associated with the [response struct](https://fetch.spec.whatwg.org/#concept-response) created by the Service Worker and returned via https://fetch.spec.whatwg.org/#http-fetch. That response struct contains a [body](https://fetch.spec.whatwg.org/#concept-body) with a stream containing a `ReadableStream` object created in https://w3c.github.io/ServiceWorker/#fetch-event-respondwith that's associated with the Service Worker's realm. https://w3c.github.io/ServiceWorker/#fetch-event-respondwith copies the stream, and w3c/ServiceWorker#934 says it's trying to do this exactly to get the realms right, but it uses *targetRealm* defined as "relevant Realm of the context object", which is just the Service Worker's realm again, not the `fetch()` call's realm. I believe this copy needs to be done inside Fetch in order to have the right realm available, not inside the Service Worker spec. (@yutakahirano) This might be a sign that it's a mistake to have the body struct contain a Javascript object, but streams don't provide a non-Javascript abstraction for the body to contain instead. (@domenic) -- 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/731
Received on Tuesday, 22 May 2018 18:05:30 UTC