Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fd96a2aa97362e9358ab3f10ff2adb80db21909c
https://github.com/WebKit/WebKit/commit/fd96a2aa97362e9358ab3f10ff2adb80db21909c
Author: Sihui Liu <[email protected]>
Date: 2026-10-07 (Wed, 07 Oct 2026)
Changed paths:
M Source/WebCore/loader/DocumentLoader.cpp
M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h
M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Navigation.mm
Log Message:
-----------
Back/forward cache restore reports didFailNavigation after a pagehide beacon
https://bugs.webkit.org/show_bug.cgi?id=326594
rdar://189350210
Reviewed by Per Arne Vollan.
When investigating rdar://189061233, I found an issue that when clicking a link
on a Google search result page and
navigating back, Safari's progress bar never completes. This is because the
restored page reports didFailNavigation
instead of didFinishNavigation.
When a page enters the back/forward cache, DocumentLoader::stopLoading() sets a
cancelled error on the document if any
subresource load is still pending. Here the pending load is a beacon sent from
a pagehide handler. The error is stored
in m_mainDocumentError and stays on the document, so after the page is restored
from the cache,
FrameLoader::checkLoadCompleteForThisFrame() reads it and reports the failure
to the client.
keepalive loads are designed to outlive their document, so they should not fail
the document's load. Only set the main
document error when there is a plug-in stream loader or a non-keepalive
subresource loader. When no loaders remain,
still manufacture the cancelled message as before. When only keepalive loaders
remain, set no error.
Tests: WKNavigation.BackForwardCacheRestoreAfterPagehideBeaconFinishesNavigation
WKNavigation.BackForwardCacheRestoreAfterProcessSwapAndPagehideBeaconFinishesNavigation
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoading):
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm:
(-[TestNavigationDelegate webView:didFailNavigation:withError:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Navigation.mm:
(testBackForwardCacheRestoreAfterPagehideBeacon):
(TEST(WKNavigation,
BackForwardCacheRestoreAfterPagehideBeaconFinishesNavigation)):
(TEST(WKNavigation,
BackForwardCacheRestoreAfterProcessSwapAndPagehideBeaconFinishesNavigation)):
Canonical link: https://commits.webkit.org/322983@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications