Navigation API: nullify ongoing navigate event on successful cross-document navigation#12024
Navigation API: nullify ongoing navigate event on successful cross-document navigation#12024noamr wants to merge 2 commits intowhatwg:mainfrom
Conversation
|
This is a small change and would be fairly easy to implement, and it's intention is correct. I'm not sure that it's correct as it is in spec though. We queue a task on the navigation and traversal task source, which is the same queue that we a bit later in the same algorithm queue other things on. Are we sure that clearing the ongoing navigate event before those steps are OK? Or should this be moved to after those? Or should the clearing itself be moved to step 12? In effect what we're saying is that the only thing that's allowed to abort a traverse navigate event is anything that's synchronously reachable from I haven't traced this fully, and I have very limited time before the holiday. Its intent does indeed sound reasonable, but if you want me to look deeper it will have to wait to January. I'll ask around to see if anyone else wants to take a stab at it from the Gecko side. |
The thing is that "set the ongoing navigation" also queues the "aborting" on the same task source, so we have to do this before that's done. The next things queued on that task source is firing If we spec things this way, we have to test that e.g. calling
I am not sure, but that test is a pretty clear indication that current browsers don't call
An alternative to the proposed spec is to avoid aborting specifically when deactivating the document or beginning the Let's continue this in 2026! |
|
@farre : early 2026 ping to look at this :) |
|
@noamr: sorry for the time this has taken, but this:
makes so much sense. We should definitely make this be the way things are. |
Thanks! Can I mark gecko as interested? I will proceed with WPTs etc |
|
cc @annevk for WebKit too |
|
@noamr: I've been looking into if this is something we should do for non-intercepted synchronous (same document) navigations. That would mean that if you don't intercept a non-asynchronous navigation that succeeds, navigatesuccess would always fire, which isn't the case today. |
This prevents the cross-document navigation from being "aborted" if a new same-origin nav is initiated after BFCache restore. See spec conversation: whatwg/html#12024 Behind a flag until spec PR is merged etc. Bug: 491363838 Change-Id: I17f76804226e422e72dc8dcaeb2bf29871c0cedd
This prevents the cross-document navigation from being "aborted" if a new same-origin nav is initiated after BFCache restore. See spec conversation: whatwg/html#12024 Behind a flag until spec PR is merged etc. Bug: 491363838 Change-Id: I17f76804226e422e72dc8dcaeb2bf29871c0cedd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7653517 Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1597283}
This prevents the cross-document navigation from being "aborted" if a new same-origin nav is initiated after BFCache restore. See spec conversation: whatwg/html#12024 Behind a flag until spec PR is merged etc. Bug: 491363838 Change-Id: I17f76804226e422e72dc8dcaeb2bf29871c0cedd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7653517 Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1597283}
…cument navigation Currently per spec, setting the ongoing navigation to "traversal" would abort the `navigate` event and fire `navigateerror` (and abort the event's signal). However, tests like [this one](https://github.com/web-platform-tests/wpt/blob/156bb7cbb8483f6ffd4b275a1ed0b628fd0582cc/navigation-api/ordering-and-transition/transition-cross-document.html#L25) say otherwise, and this is not implemented. In current implementations, the `ongoing navigate event` stays dangling, which creates unexpected results when the page is restored from BFCache - the abort signal and `navigateerror` events fired as a result of the next same-document navigation after being restored from BFCache. This change makes it so that a succesful "traversal" (cross-document navigation) nullifies the ongoing event, without "aborting" it, making it so that the navigation neither signals success or failure. Closes whatwg#11860
399603d to
936ce85
Compare
This prevents the cross-document navigation from being "aborted" if a new same-origin nav is initiated after BFCache restore. See spec conversation: whatwg/html#12024 Behind a flag until spec PR is merged etc. Bug: 491363838 Change-Id: I17f76804226e422e72dc8dcaeb2bf29871c0cedd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7653517 Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1597283} Co-authored-by: Noam Rosenthal <nrosenthal@chromium.org>
…o dangling-navigate-event-after-bfcache-restore.html To be merged together with whatwg/html#12024
…cument navigation, a=testonly Automatic update from web-platform-tests Clear ongoing navigate event on cross document navigation (#58410) This prevents the cross-document navigation from being "aborted" if a new same-origin nav is initiated after BFCache restore. See spec conversation: whatwg/html#12024 Behind a flag until spec PR is merged etc. Bug: 491363838 Change-Id: I17f76804226e422e72dc8dcaeb2bf29871c0cedd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7653517 Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1597283} Co-authored-by: Noam Rosenthal <nrosenthal@chromium.org> -- wpt-commits: 0132f767da8dc1e1979b8def92a715919dcbc56c wpt-pr: 58410
Currently per spec, setting the ongoing navigation to "traversal" would abort the
navigateevent and firenavigateerror(and abort the event's signal).However, tests like this one say otherwise, and this is not implemented anywhere.
In current implementations, the
ongoing navigate eventstays dangling, which creates unexpected results when the page is restored from BFCache - the abort signal andnavigateerrorevents fired as a result of the next same-document navigation after being restored from BFCache.This change makes it so that a succesful "traversal" (cross-document navigation) nullifies the ongoing event and API method tracker, without "aborting" it, making it so that the navigation neither signals success or failure.
Closes #11860
(See WHATWG Working Mode: Changes for more details.)
/browsing-the-web.html ( diff )