Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: db6a018c3ee4fd12cf56a3a1520889faace38993
      
https://github.com/WebKit/WebKit/commit/db6a018c3ee4fd12cf56a3a1520889faace38993
  Author: Sihui Liu <[email protected]>
  Date:   2025-12-02 (Tue, 02 Dec 2025)

  Changed paths:
    M LayoutTests/platform/mac-site-isolation/TestExpectations
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/BrowsingContextGroup.h
    M Source/WebKit/UIProcess/FrameProcess.cpp
    M Source/WebKit/UIProcess/FrameProcess.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
    A 
Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolationLoadWebArchive.webarchive
    A 
Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolationLoadWebArchiveNestedFrame.webarchive

  Log Message:
  -----------
  [Site Isolation] Add basic support for loading webarchive
https://bugs.webkit.org/show_bug.cgi?id=302978
rdar://165236186

Reviewed by Ryosuke Niwa.

To make webarchive loading work with site isolation, make all frames (including 
cross-site ones) in a webarchive file
loaded within the same web process. When webarhive file is loaded in a web 
process, the process will be getting all
content of the file from network process, which includes subframe webarchive 
and resources. If UI process decides to
start loading of cross-site frame in another process, the new process won't 
have the resources and the load could fail.
To implement this, WebProcessPool::processForNavigation now returns source 
process for non-main-frame navigation when
page (main frame) is loading webarchive.

In current implementation, UI process would recreate FrameProcess when it 
notices frame's site does not match frame's
process's site in WebPageProxy::didCommitLoadForFrame. The problem is, for 
webarchive load, frame's site might not match
frame's process site as we don't swap process for iframe navigation. In this 
case when FrameProcess is recreated,
BrowsingContextGroup would try creating RemotePageProxy for the FrameProcess, 
so that there will be both RemotePageProxy
and WebPageProxy for the same page and same web process, which would lead to 
weird eror. To fix that, the patch add a
flag in FrameProcess to indicate the process is used for loading webarchive, 
and there is not need to recreate
FrameProcess for site mismatch in this case.

The patch also fixes an issue where UI process would try to swap in ephemeral 
webarchive data store for non-main-frame
navigation, see WebPageProxy::updateDataStoreForWebArchiveLoad.

API tests: SiteIsolation.LoadWebArchive
           SiteIsolation.LoadWebArchiveNestedFrame

* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::sharedProcessForSite):
(WebKit::BrowsingContextGroup::ensureProcessForSite):
* Source/WebKit/UIProcess/BrowsingContextGroup.h:
* Source/WebKit/UIProcess/FrameProcess.cpp:
(WebKit::FrameProcess::FrameProcess):
* Source/WebKit/UIProcess/FrameProcess.h:
(WebKit::FrameProcess::isArchiveProcess const):
(WebKit::FrameProcess::create):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateDataStoreForWebArchiveLoad):
(WebKit::WebPageProxy::receivedNavigationActionPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, LoadWebArchive)):
(TestWebKitAPI::(SiteIsolation, LoadWebArchiveNestedFrame)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolationLoadWebArchive.webarchive: 
Added.
* 
Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolationLoadWebArchiveNestedFrame.webarchive:
 Added.

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



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

Reply via email to