You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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" of the FetchEvent, 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)
The text was updated successfully, but these errors were encountered:
@yutakahirano this relates to that other issue you are working on with regards to how Fetch and Service Workers should integrate when it comes to streams.
Uh oh!
There was an error while loading. Please reload this page.
If I'm tracing this correctly, a
fetch()
from a Window that's handled by a Service Worker returns a Response object in the Window's realm associated with the response struct created by the Service Worker and returned via https://fetch.spec.whatwg.org/#http-fetch. That response struct contains a body with a stream containing aReadableStream
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" of the FetchEvent, 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)
The text was updated successfully, but these errors were encountered: