Skip to content

Abort ongoing navigations when firing certain navigate events#11409

Merged
zcorpan merged 1 commit into
mainfrom
navigation-fix-ongoing
Jun 27, 2025
Merged

Abort ongoing navigations when firing certain navigate events#11409
zcorpan merged 1 commit into
mainfrom
navigation-fix-ongoing

Conversation

@domenic

@domenic domenic commented Jun 27, 2025

Copy link
Copy Markdown
Member

In particular, when firing same-document (synchronous) push/replace navigate events, i.e., those originating from history.pushState()/replaceState(), or fragment navigations.

This fixes an assertion failure, and better aligns with Chromium's behavior (although, it does so while avoiding a crash bug that Chromium has).

Closes #11184.

@farre please take a look! I especially welcome thoughts on the notes I added, to see if they're helpful.

(See WHATWG Working Mode: Changes for more details.)


/nav-history-apis.html ( diff )

In particular, when firing same-document (synchronous) push/replace navigate events, i.e., those originating from history.pushState()/replaceState(), or fragment navigations.

This fixes an assertion failure, and better aligns with Chromium's behavior (although, it does so while avoiding a crash bug that Chromium has).

Closes #11184.

@farre farre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I saw needed a fix is the

this means it will signaled to the

phrasing. But that really doesn't need re-reviewing. Thanks!

Comment thread source
</ol>

<div class="note">
<p>If there is an ongoing cross-document navigation, this means it will signaled to the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be signaled

Comment thread source

<ol>
<li>
<p>If <var>isSameDocument</var> is true:</p>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that you saw that this was the case. Very happy to not add another boolean trap!

Comment thread source
@farre

farre commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

And I absolutely thought that the notes were good, and needed. As for implementation bugs, we've already landed this (albeit using the extra boolean trap) in bug 1974197 and 1973716. I'll probably clean it up and make it align to spec verbatim, but that's not super important currently.

@zcorpan zcorpan merged commit 335d7f4 into main Jun 27, 2025
2 checks passed
@zcorpan zcorpan deleted the navigation-fix-ongoing branch June 27, 2025 07:46
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 21, 2025
… DispatchNavigateEvent

This updates the logic for aborting an existing navigation when
preparing to fire a new navigate even to match the spec update in
whatwg/html#11409.

It also updates cleanup of the ongoing api method tracker to
occur before firing navigatesuccess/navigateerror, so that we do
not clobber a new api method tracker if a new navigation is started
inside one of those events.

Fixed: 419746417, 431135033, 428022635
Change-Id: Ieccbc56085b5763564f19e0b9f11903aeb6ae82c
aarongable pushed a commit to chromium/chromium that referenced this pull request Aug 21, 2025
… DispatchNavigateEvent

This updates the logic for aborting an existing navigation when
preparing to fire a new navigate even to match the spec update in
whatwg/html#11409.

It also updates cleanup of the ongoing api method tracker to
occur before firing navigatesuccess/navigateerror, so that we do
not clobber a new api method tracker if a new navigation is started
inside one of those events.

Fixed: 419746417, 431135033, 428022635
Change-Id: Ieccbc56085b5763564f19e0b9f11903aeb6ae82c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6622087
Commit-Queue: Nate Chapin <japhet@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1504655}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 21, 2025
… DispatchNavigateEvent

This updates the logic for aborting an existing navigation when
preparing to fire a new navigate even to match the spec update in
whatwg/html#11409.

It also updates cleanup of the ongoing api method tracker to
occur before firing navigatesuccess/navigateerror, so that we do
not clobber a new api method tracker if a new navigation is started
inside one of those events.

Fixed: 419746417, 431135033, 428022635
Change-Id: Ieccbc56085b5763564f19e0b9f11903aeb6ae82c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6622087
Commit-Queue: Nate Chapin <japhet@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1504655}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 21, 2025
… DispatchNavigateEvent

This updates the logic for aborting an existing navigation when
preparing to fire a new navigate even to match the spec update in
whatwg/html#11409.

It also updates cleanup of the ongoing api method tracker to
occur before firing navigatesuccess/navigateerror, so that we do
not clobber a new api method tracker if a new navigation is started
inside one of those events.

Fixed: 419746417, 431135033, 428022635
Change-Id: Ieccbc56085b5763564f19e0b9f11903aeb6ae82c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6622087
Commit-Queue: Nate Chapin <japhet@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1504655}
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Aug 28, 2025
…avigation starts a new one in DispatchNavigateEvent, a=testonly

Automatic update from web-platform-tests
Don't crash if cancelling the previous navigation starts a new one in DispatchNavigateEvent

This updates the logic for aborting an existing navigation when
preparing to fire a new navigate even to match the spec update in
whatwg/html#11409.

It also updates cleanup of the ongoing api method tracker to
occur before firing navigatesuccess/navigateerror, so that we do
not clobber a new api method tracker if a new navigation is started
inside one of those events.

Fixed: 419746417, 431135033, 428022635
Change-Id: Ieccbc56085b5763564f19e0b9f11903aeb6ae82c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6622087
Commit-Queue: Nate Chapin <japhet@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1504655}

--

wpt-commits: 6167b9d3c4edc5711b8971230579f3d12814aeb6
wpt-pr: 54449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Navigation API: Navigation's ongoing navigate event is not null in #inner-navigate-event-firing-algorithm

3 participants