Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 865a045f39f68e290947ab4a97967e3b381dcab6
https://github.com/WebKit/WebKit/commit/865a045f39f68e290947ab4a97967e3b381dcab6
Author: Rupin Mittal <[email protected]>
Date: 2025-10-25 (Sat, 25 Oct 2025)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/navigate-replace-same-document.html
M Source/WebCore/loader/FrameLoader.cpp
M Source/WebCore/loader/HistoryController.cpp
M Source/WebCore/loader/HistoryController.h
Log Message:
-----------
[Navigation API] navigate-replace-same-document.html is flaky on WPT
https://bugs.webkit.org/show_bug.cgi?id=301416
rdar://163323288
Reviewed by Basuke Suzuki.
At first glance, this test appears to be flaky on WPT even though it passes
all of the time on WKTR. It turns out that both the mismatch in the results
between WKTR and WebDriver and the flakiness on WebDriver are the result of
the test being written in a way that doesn't catch exceptions.
(Discused here: https://bugs.webkit.org/show_bug.cgi?id=301415).
So firstly, we rewrite the test in a manner that will catch the exception.
Upstream PR: https://github.com/web-platform-tests/wpt/pull/55632.
With the test rewritten, we see that it fails consistently. The failing line:
"assert_equals(history.length, start_history_length + 1);"
Instead of replacing the current item in the UI Process b/f list, a new item
is being added.
The culprit is the call to History::updateBackForwardListForFragmentScroll()
in FrameLoader::loadInSameDocument(). The History function creates a new History
Item and sends an IPC message to have it added to the UI Process b/f list.
Since this is a same-document replace navigation, no actual load is occuring.
So we can fix this by simply not making a new History Item and instead just
replacing the data (url, stateObject, etc) of the current History Item. We
do this the exact same way that HistoryController::replaceState() does when
"history.replaceState()" is called.
*
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-methods/navigate-replace-same-document.html:
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadInSameDocument):
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::updateBackForwardListForReplaceState):
(WebCore::HistoryController::replaceState):
* Source/WebCore/loader/HistoryController.h:
Canonical link: https://commits.webkit.org/302130@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications