-
Notifications
You must be signed in to change notification settings - Fork 381
Editorial: Use controller for navigation redirect #1469
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
Conversation
domenic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @annevk do you mind if we merge this, since it unblocks some HTML work?
/cc @jeremyroman as well whose review would be appreciated if he has time.
|
Sorry for not commenting earlier, but this seems sensible to me. |
|
@annevk ping? |
annevk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work in terms of callbacks and such? The prior approach was that the algorithm would return a response. I'm not entirely sure that was workable, but I'm not sure what the new approach is.
The new approach is reviewable here: whatwg/html#8097 |
Specifically, we don't need new callbacks because we don't replace |
@annevk anything else missing here? Other changes in the HTML spec depend on this. |
|
But how would HTML be notified that it needs to call "next"? Would it call that from "process response"? If so we need to document that "process response" can be invoked multiple times in this mode, no? I did look at https://whatpr.org/html/8097/browsing-the-web.html but it doesn't actually fill in "process response" (although it does talk about it in a later step). |
Yes, that's the idea, I can add a comment about this when describing
process a navigate fetch, 15.5.2: process the next redirect and then waits for process a response. What's missing? |
|
"process response" is an argument of the fetch algorithm, not something you can wait for. |
This was there in the HTML spec before and I didn't care to refactor it here... but I can if it makes a difference - perhaps |
|
The existing setup is indeed broken. I'm wondering what our long(er) term perspective is here. I'm also worried that if we keep using the same fetch, fetch controller, and fetch params, we'll end up with weird timing and state situations on them. Typically when you've seen "process response" you wouldn't expect to start uploading again, for instance. |
The long term perspective is that this is a single navigation fetch, that gets its redirects followed manually rather than automatically. So it makes sense that it shares the same fetch params and state. This is equivalent to how the chromium implementation works - there's a "follow" function that's specific to navigations rather than a whole new fetch. |
|
When you do a And the concern is that if we ever added state such as "final response" (which we have for timings!) it would potentially get a very different meaning here and might end up being invalidated upon "follow". |
Is the concern something that exists in the spec now? I don't see any reference to 308 in fetch/HTML. |
|
308 is a redirect status and 301/302/303 change the request method to I don't think reusing the callback is the problem per se. We should document it's a bit weird for "navigate" though. I think the main problem might be all the state that we keep and don't reset (and some of it we need to keep and not reset, such as the URL list). Perhaps a follow-up issue to look at that more closely would be best for now. |
|
I audited the state which is not reset. That is the fetch params:
I overall agree with the idea that, since we don't reset this state during non-"manual" redirects, this change is an improvement since it makes "manual" redirects more like non-"manual" ones. I might tweak this PR to change "next redirect steps" to "next manual redirect steps", and "process the next redirect" to "process the next redirect manually" or even "process the next HTTP redirect manually". @annevk, what do you think? Can we merge this, if I rebase it and maybe perform those renames? |
a4aef13 to
31427c0
Compare
Remove the existing "navigate-redirect fetch" algorithm. Instead, the caller uses the controller to perform the next manual redirect. This simplifies the flow in the HTML Standard flow, as now there is a single "fetch params" struct for the course of the entire navigation. Up until now some data from fetch params would be lost, like timing info and task desination, because navigation fetches create a brand new "fetch params" struct. Now that data is retained, and the only thing that HTML needs to do is call "process the next redirect" on the fetch controller. Co-authored-by: Domenic Denicola <d@domenic.me>
31427c0 to
1f5fa86
Compare
annevk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces our use "HTTP-redirect fetch", which was pretty broken. Follows whatwg/fetch#1469. Co-authored-by: Domenic Denicola <d@domenic.me>
Remove the existing navigation redirect, and allow the caller
to use the controller to continue to the next redirect.
This simplifies the navigation HTML<->FETCH flow, as now there is
a single
fetch paramsstruct for the course of the entire navigation.Up until now some data from fetch params would be lost, like timing info
and task desination, because navigation fetches create a brand new
fetch paramsstruct. Now that data is retained, and the only thing thatHTML needs to do is call
process the next redirecton the fetch controller.(See WHATWG Working Mode: Changes for more details.)
Preview | Diff