[w3c/ServiceWorker] what should Client.url return for a reserved Worker Client? (#1034)

So, the new reserved client support tries to let someone access a Client object for the thing that will be created by the current FetchEvent.  So in theory you can do:

```
addEventListener('fetch', evt => {
  evt.waitUntil(clients.get(evt.reservedClientId).then(client => {
    console.log(`Reserved client ${evt.reservedClientId} has creation URL ${client.url}`);
  });
});
```

This works for a window Client because the creation URL is set on the environment based on the *request* in step 4 here:

https://html.spec.whatwg.org/#process-a-navigate-fetch

For workers, however, the Client creation URL is set based on the worker global scope URL in step 7 here:

https://html.spec.whatwg.org/#script-settings-for-workers

And the worker global scope URL is set based on the *response* URL after the script has been fetched.  See step 10.3 here:

https://html.spec.whatwg.org/#worker-processing-model

Does this mean the reserved Client URL should be empty string for a Worker Client?  Or should it be set to the request URL and then updated to the final response URL to account for redirects?

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

Received on Friday, 16 December 2016 22:36:10 UTC