Closed Bug 2087065 Opened 1 month ago Closed 18 days ago

[wpt-sync] Sync PR 64147 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=324686

Categories

(Core :: DOM: Navigation, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64147 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64147
Details from upstream follow.

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=324686

WebKit export from bug: [<!---->Navigation API]<!----> Main-<!---->frame navigation.<!---->back(<!---->)<!---->/<!---->traverseTo(<!---->)<!----> lands on the wrong joint session history entry when a subframe navigated

<pre>
[Navigation API] Main-frame navigation.back()/traverseTo() lands on the wrong joint session history entry when a subframe navigated

When a subframe does a same-document navigation while the main frame stays
put, the joint (top-level) history item is cloned, so the main frame's
history item appears in more than one back/forward list item. Traversing the
main frame by key (navigation.back(), navigation.forward(), traverseTo())
must land on the nearest such joint entry in the direction of travel.

ScheduledHistoryNavigationByKey::findBackForwardItemByKey short-circuited for
the main frame with if (localFrame.isMainFrame()) return historyItem;,
returning the entry's associated history item directly instead of resolving
the nearest matching back/forward item. As a result a main-frame step-back
landed on the farthest matching joint entry, resetting the subframe to an
earlier state and leaving a stale, undisposed forward entry behind. Subframes
already performed this nearest-item search; this applies the same search to
the main frame, matching the top-level item's itemSequenceNumber.

Chrome and Firefox land on the nearest entry; the new test failed on WebKit
before this change and passes after.

findBackForwardItemByKey() calls BackForwardList::allItems(), which is a
synchronous BackForwardAllItems IPC in WebKit2. isSameDocumentNavigation() also
called it, and is reached from NavigationScheduler::locationChangePending(),
which HTMLDocumentParser::pumpTokenizerLoop() checks before every token, so the
main frame would now make that IPC once per token. isSameDocumentNavigation()
only compares URLs, so make it answer from the entry's associated history item,
as is already done with UseUIProcessForBackForwardItemLoading (<a href="https://commits.webkit.org/324250@main">324250@main</a>).

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=324686">https://bugs.webkit.org/show_bug.cgi?id=324686</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/324589@main">https://commits.webkit.org/324589@main</a>
</pre>

Component: web-platform-tests → DOM: Navigation
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 117 tests and 1 subtests

Status Summary

Firefox

OK : 1[GitHub] 116[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 1[GitHub] 123[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 2

Chrome

OK : 1
PASS: 1

Safari

OK : 1
FAIL: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

Status: NEW → RESOLVED
Closed: 18 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.