-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what should Client.url return for a reserved Worker Client? #1034
Comments
Barring other feedback I think I will make reserved Worker Client.url return the request URL. |
I would slightly prefer empty string to discourage usage of the field at that point. |
Yea, we could make Client.url return empty string whenever the Client.reserved is true. That would make things easier during redirects as well. |
I'd slightly prefer this indeed. I think the request URL is a good initial value for the environment's creation URL. And we can easily initialize the value by providing url to set up a worker environment settings object that I missed. |
Looking at the steps, I think we don't even need to change set up a worker environment settings object at all. We can simply set the request's url to url in the perform the fetch algorithm before invoking fetch. |
@jungkees did you miss my concern with that approach or do you not think it's problematic for some reason? |
I thought using I actually got confused while thinking over your question. For the clients that are not in reserved state, is |
Yes, the URL of a "normal" client is the URL of its global object. Which would be the "final" URL. And yeah, having it change around does not seem ideal. Better to start with a known weird value, such as the empty string. |
That makes sense. I'll fix it as suggested. When creating a |
Also, Create Window Client has bugs. It doesn't initialize the base interface part of the fields properly. Need to fix them. |
Keep in mind you can get at these |
Yeah, |
From an implementation point of view I prefer the empty string as proposed. I have some async work in gecko I want to perform to validate the URL against the origin. I can more easily do that at execution ready time vs immediately on creation. It also ensures we are using the final redirected URL instead of wasting work on request data that might get discarded. |
I understood your point. That works for me. On the one hand though, I'm still not entirely clear here maybe because we haven't settled on what a Client (and an environment) should represent during redirects: #1031. It'll be nice if we can confirm the proposed behavior for this issue when #1031 is resolved. |
I think we should also do something similar for other attributes on Client. For example:
I'm not sure what Basically only Also, |
Well, apparently "unloaded" is not a thing any more according to the draft visibility spec: https://w3c.github.io/page-visibility/#visibility-states-and-the-visibilitystate-enum So I will use "hidden". Side note, why does the SW draft spec link to the TR visibility spec instead of its draft? |
F2F: reserved client should have an empty url, and we should come up with default values for each. Potential window navigations should be reserved window clients. |
We aren't going to expose reserved clients, so this is no longer an issue. |
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:
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?
The text was updated successfully, but these errors were encountered: