Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 41894db0ac68ab9f13087416e2579726077cee8f
      
https://github.com/WebKit/WebKit/commit/41894db0ac68ab9f13087416e2579726077cee8f
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-04-21 (Tue, 21 Apr 2026)

  Changed paths:
    M Source/WebCore/history/BackForwardCache.cpp
    M Source/WebCore/history/BackForwardCache.h
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/BrowsingContextGroup.h
    M Source/WebKit/UIProcess/SuspendedPageProxy.cpp
    M Source/WebKit/UIProcess/SuspendedPageProxy.h
    M Source/WebKit/UIProcess/WebBackForwardCache.cpp
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h
    M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [BFCache] Add multi-process suspension for BFCache with Site Isolation
https://bugs.webkit.org/show_bug.cgi?id=311224
rdar://173743585

Reviewed by Sihui Liu.

When site isolation is active and multi-process BFCache is enabled, suspend
subframe processes alongside the main frame when a page enters the
back/forward cache. Each subframe process receives a SetSubframesSuspended
IPC — along with the main frame's BackForwardFrameItemIdentifier — that
caches its page in the WebCore BackForwardCache. A CallbackAggregator tracks
completion across all processes; if any fails, the BFCache entry is removed
and teardown cleans up the subframe processes.

The UIProcess passes fromItem->mainFrameItem().identifier() to each iframe
process. This identifier is unique per navigation entry, stable across iframe
cross-site navigations, and the same for all iframe processes — no
per-process frame tree traversal needed. Each iframe process stores its
CachedPage under this key in its own per-process BackForwardCache singleton.

Also refactor BackForwardCache::addIfCacheable to share logic between the
existing HistoryItem-based overload and the new identifier-based overload
used by iframe processes.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::BackForwardCache::addIfCacheable):
* Source/WebCore/history/BackForwardCache.h:
* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::removePage):
(WebKit::BrowsingContextGroup::closeRemotePagesForPage):
(WebKit::BrowsingContextGroup::hasMultiplePages const):
* Source/WebKit/UIProcess/BrowsingContextGroup.h:
* Source/WebKit/UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::findReusableSuspendedPageProcess):
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
(WebKit::SuspendedPageProxy::startSuspension):
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
(WebKit::SuspendedPageProxy::teardown):
(WebKit::SuspendedPageProxy::waitUntilReadyToUnsuspend):
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
(WebKit::SuspendedPageProxy::suspensionTimedOut):
(WebKit::SuspendedPageProxy::suspendSubframeProcesses):
(WebKit::SuspendedPageProxy::hasSubframeInProcess const):
(WebKit::SuspendedPageProxy::maybeCompleteSuspension):
* Source/WebKit/UIProcess/SuspendedPageProxy.h:
* Source/WebKit/UIProcess/WebBackForwardCache.cpp:
(WebKit::WebBackForwardCache::removeEntriesForProcess):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::commitProvisionalPage):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setSubframesSuspended):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm:
(-[TestNavigationDelegate waitForDidFinishNavigationAndLoadInSubframe]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, MultiProcessBFCacheIframeProcessSurvival)):
(TestWebKitAPI::(SiteIsolation, MultiProcessBFCacheOpenerSkipsBFCache)):

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



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

Reply via email to