Open bzbarsky opened 7 years ago
@domenic @wanderview
As far as I can tell respondWith shouldn't be running in parallel at all.
Note that targetRealm
is not the current realm of the respondWith call, so if the intent is that we have it as a current realm there is more to be done here no mattter what.
I wrote a little bit about how an implementation might implement respondWith() using a js ReadableStream in https://github.com/w3c/ServiceWorker/issues/1168#issuecomment-317031289 and https://github.com/w3c/ServiceWorker/issues/1168#issuecomment-317032758. In theory we could write the spec language in a similar way.
https://w3c.github.io/ServiceWorker/v1/#fetch-event-respondwith step 10.3.1.2.5.5 says:
and links to https://fetch.spec.whatwg.org/#concept-construct-readablestream. But it doesn't properly set up current Realms (though it does at least hint as to what the current Realm should be set up to). Worse yet, this entire part of respondWith is "in parallel", so it can't do object creation to start with.