[w3c/ServiceWorker] Handle Fetch "process response" callback appers to run on wrong event-loop (#1517)

Per fetch, queuing the task that does the "process response" goes via https://fetch.spec.whatwg.org/#queue-a-fetch-task

which queues a task on the event-loop of the client of the request. 

Then, in Handle Fetch, at step 14.7.1, the original request is cloned into `preloadRequest`, presumably leaving the "client" attribute as it is. 

At step 14.7.6, `preloadRequest` is fetch, and a "process response" for that fetch is defined. In this operation, among other things, `preloadResponse` is resolved. 

Note that `preloadResponse` is a  promise, that is attached to the  `FetchEvent` dispacted in the active worker's scope at step 21.3.11, by  way of a task queued on the event-loop of the worker at step 21.3.

So, from this, I conclude that `preloadResponse` is a promise "living" in the realm of the active worker, not that of the original client of request. 

So it appears that the SW spec expects "process response" to happen by way of a task queued on the worker event-loop, which doesn't match the fetch spec, where the task is queued on the event-loop of client of the request. 

I think what the SW spec wants, is for fetch to actually queue parallel steps back to SW, and then queue a task on the active worker event-loops at step 14.7.6, finally resolving `preloadResponse`. 

See discussion at https://github.com/whatwg/fetch/issues/536

-- 
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/1517

Received on Sunday, 14 June 2020 06:32:29 UTC