Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83c00bd07f2e2929f2b71cd4c0d894b96222ce46
      
https://github.com/WebKit/WebKit/commit/83c00bd07f2e2929f2b71cd4c0d894b96222ce46
  Author: Sihui Liu <[email protected]>
  Date:   2026-02-10 (Tue, 10 Feb 2026)

  Changed paths:
    M Source/WebCore/loader/EmptyClients.cpp
    M Source/WebCore/loader/EmptyFrameLoaderClient.h
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebCore/loader/HistoryController.h
    M Source/WebCore/loader/LocalFrameLoaderClient.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardListTests.mm

  Log Message:
  -----------
  Avoid sync back/forward navigation policy check for different document 
navigation
https://bugs.webkit.org/show_bug.cgi?id=307308
rdar://169939509

Reviewed by Basuke Suzuki.

293982@main makes HistoryController::goToItemShared() perform sync policy check 
when there is a process swap for the
navigation and the swap is caused by COOP header. This is a workaround to 
ensure navigation can happen synchronously,
because WebPage::goToBackForwardItem() only sets 
existingNetworkResourceLoadIdentifierToResume on WebLoaderStrategy in
the scope of the function. If the policy check is async and reply is received 
outside of WebPage::goToBackForwardItem(),
the load will be treated as a new load in network process (instead of reusing 
the existing loader). This means network
process will start a new request, handle the COOP header in the response, and 
ask UI process to swap the process again
when process has already been swapped. This can cause the navigation to never 
complete; see new test.

However, if the navigation is continued in another process after process swap, 
there is actually no need to perform
policy check, as it should already be performed in the initiating process. We 
currently skip policy check for normal
request load, see FrameLoader::loadWithDocumentLoader() and 
shouldTreatCurrentLoadAsContinuingLoad(). So, this patch
just skips policy check for continuing load to match the behavior. This avoids 
unnecessary sync message.

New test: WKBackForwardList.RestoreSessionForSiteWithCOOP

* Source/WebCore/loader/EmptyClients.cpp:
(WebCore::EmptyFrameLoaderClient::shouldGoToHistoryItem const):
* Source/WebCore/loader/EmptyFrameLoaderClient.h:
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):
(WebCore::HistoryController::goToItemShared):
* Source/WebCore/loader/HistoryController.h:
* Source/WebCore/loader/LocalFrameLoaderClient.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::goToItem):
* Source/WebCore/page/Page.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::shouldGoToHistoryItem const):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::goToBackForwardItem):
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::shouldGoToHistoryItem const):
* Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardListTests.mm:
(TEST(WKBackForwardList, RestoreSessionForSiteWithCOOP)):

Canonical link: https://commits.webkit.org/307187@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to