Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1635cb45a04ff653c17be6962934e829fe4f0178
      
https://github.com/WebKit/WebKit/commit/1635cb45a04ff653c17be6962934e829fe4f0178
  Author: Sihui Liu <[email protected]>
  Date:   2026-03-13 (Fri, 13 Mar 2026)

  Changed paths:
    M Source/WebKit/UIProcess/FrameProcess.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Reuse uncommitted process for cross-site redirect
https://bugs.webkit.org/show_bug.cgi?id=309755
rdar://116203552

Reviewed by Per Arne Vollan.

In current implementation of Site Isolation, if a navigation involves multiple 
cross-site redirects, multiple processes
will be launched (one for each site), even though only the last process is 
actually loading. This is wasteful (rapidly
creating and terminating process) and not good for performance (process launch 
could take time). This patch updates
`WebProcessPool::processForNavigationInternal` to make it resuse process if 
process has not committed load and is only
in use by the navigating frame -- if the process is also in use by another 
frame, that frame might be loading the
existing process's site, so we cannot change the process's site. To check if 
`WebProcessProxy` is only in use by
navigating frame, we check if `WebProcessProxy` is only in use by one 
`FrameProcess` and the `FrameProcess` is only in
use by one `WebFrameProxy`. With this change, the assertion in 
`WebProcessProxy::didStartUsingProcessForSiteIsolation`
starts to fail as it expects `WebProcessProxy` to have no site specified or is 
loading the same site as the specified
site. In the case of `WebProcessProxy` has not loaded anything yet, it is ok 
for process to switch site, so this patch
updates the assertion to account for that.

Test: SiteIsolation.ReuseUncommittedProcessForInitialNavigation
      SiteIsolation.ReuseUncommittedProcessForSameSiteRedirect
      SiteIsolation.ReuseUncommittedProcessForCrossSiteRedirect
      SiteIsolation.ReuseUncommittedProcessForMultipleRedirects

* Source/WebKit/UIProcess/FrameProcess.cpp:
(WebKit::FrameProcess::FrameProcess):
(WebKit::FrameProcess::~FrameProcess):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::processForNavigationInternal):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didStartUsingProcessForSiteIsolation):
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, 
ReuseUncommittedProcessForInitialNavigation)):
(TestWebKitAPI::TEST(SiteIsolation, 
ReuseUncommittedProcessForSameSiteRedirect)):
(TestWebKitAPI::TEST(SiteIsolation, 
ReuseUncommittedProcessForCrossSiteRedirect)):
(TestWebKitAPI::TEST(SiteIsolation, 
ReuseUncommittedProcessForMultipleRedirects)):

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



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

Reply via email to