-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Navigation API: Always use a method tracker when navigating #11952
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
|
It's worth to notice that all implementations handles this in some way or another, in various degrees of brokenness. This solution uses existing spec concepts only and makes sure that the expected variants (i.e the navigation has committed and communicated this through the now always present method tracker) holds. |
|
It looks goot to me in general, asked @natechapin to take a look as well. |
|
I promised a list of affected tests that would fail if this wasn't already somthing that browsers did. This is that list: All of these tests fail if I remove the sync state and await committed promise steps from Gecko. |
|
Isn't this a different way to add a microtask, similar to what we've discussed in #11845, except instead of adding a microtask at the end of the handler list we add a microtask after |
This solves the issue where we were starting asynchronous history traversals in #commit-a-navigate-event, this was in particular problematic for #resume-applying-the-traverse-history-step. It also simplifies handling the case when a navigation was intercepted but no intercept handlers were provided. Fixes whatwg#11814
|
The difference is subtle, but it doesn't change timing regardless of if you're using |
Updates FakeNavigation based on updates in whatwg/html#11952
|
OK, looking at this again I'm a bit confused about why this changes anything. The list of handlers for Also it feels a bit odd to create an API method tracker when there is no API. But perhaps answering the first question would help me understand the reasoning. |
|
There are two problems: When we have a tracker, but no handlersImagine that we have the following: In the current state of the spec this will have an empty handler list and trigger the path that goes through the "traverse" casel in #commit-a-navigate-event . That switch branch will append resuming the This is where trouble begins, regardless of if Let me stress the issue again for clarity: By adding the When we have handlers, but not a trackerThe reasoning is roughly the same, but now we won't have a method tracker at all, but we'll end up in The major reason for creating an internal method tracker is that doing so re-uses existing functionality. The alternative would be to introduce a separate committed promise that we'd create when there is no tracker, and that we'd check and resolve at exactly the same places that we check and resolve the method trackers committed promise. Sure there is some overhead in the internal since it has a couple of fields that are essentially unused, but it simplifies the algorithm a lot. If it helps, we could do a follow up of this where we just rename #navigation-api-method-tracker and instead call it just Summary
|
|
Thanks for the explanation. So in short, waiting on the "committed" promise in particular synchronises the parallel steps for the traverse case. SGTM! |
This solves the issue where we were starting asynchronous history traversals in #commit-a-navigate-event, this was in particular problematic for #resume-applying-the-traverse-history-step.
It also simplifies handling the case when a navigation was intercepted but no intercept handlers were provided.
Fixes #11814
/nav-history-apis.html ( diff )