[webkit-changes] [WebKit/WebKit] 499319: Clean up site isolation process selection logic

Alex Christensen noreply at github.com
Fri Mar 1 06:38:35 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4993196dda0c8b38391058300b282bc802a4ffd2
      https://github.com/WebKit/WebKit/commit/4993196dda0c8b38391058300b282bc802a4ffd2
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2024-03-01 (Fri, 01 Mar 2024)

  Changed paths:
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/BrowsingContextGroup.h
    A Source/WebKit/UIProcess/FrameProcess.cpp
    A Source/WebKit/UIProcess/FrameProcess.h
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.h
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalPageProxy.h
    M Source/WebKit/UIProcess/RemotePageProxy.cpp
    M Source/WebKit/UIProcess/RemotePageProxy.h
    R Source/WebKit/UIProcess/RemotePageProxyState.h
    M Source/WebKit/UIProcess/SuspendedPageProxy.cpp
    M Source/WebKit/UIProcess/SuspendedPageProxy.h
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxyInternals.h
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Clean up site isolation process selection logic
https://bugs.webkit.org/show_bug.cgi?id=270045
rdar://116202371

Reviewed by Charlie Wolfe.

This pulls the process selection and RemotePageProxy management logic from various places into BrowsingContextGroup.
I introduce a new abstraction, FrameProcess, that represents a frame's use of a particular process.
The WebFrameProxy retains a reference to a FrameProcess instead of a RemotePageProxy.  When a FrameProcess is created
or destroyed, the BrowsingContextGroup updates the containers of RemotePageProxy objects.
This change allows us to keep track of opened pages using structures that are more elegant and robust to handle
all possible combinations of window.open and iframe creation or destruction.

Two small changes are observable in site isolation API tests, but they are both progressions because of processes
and frames being managed more correctly in some cases.

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::allowsFirstPartyForCookies):
* Source/WebKit/Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::allowsFirstPartyForCookies):
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/AuxiliaryProcessProxy.h:
* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::ensureProcessForDomain):
(WebKit::BrowsingContextGroup::processForDomain):
(WebKit::BrowsingContextGroup::addFrameProcess):
(WebKit::BrowsingContextGroup::removeFrameProcess):
(WebKit::BrowsingContextGroup::addPage):
(WebKit::BrowsingContextGroup::removePage):
(WebKit::BrowsingContextGroup::forEachRemotePage):
(WebKit::BrowsingContextGroup::remotePageInProcess):
(WebKit::BrowsingContextGroup::takeRemotePageInProcessForProvisionalPage):
(WebKit::BrowsingContextGroup::transitionPageToRemotePage):
(WebKit::BrowsingContextGroup::addProcessForDomain): Deleted.
* Source/WebKit/UIProcess/BrowsingContextGroup.h:
* Source/WebKit/UIProcess/FrameProcess.cpp: Renamed from Source/WebKit/UIProcess/RemotePageProxyState.h.
(WebKit::FrameProcess::FrameProcess):
(WebKit::FrameProcess::~FrameProcess):
* Source/WebKit/UIProcess/FrameProcess.h: Copied from Source/WebKit/UIProcess/BrowsingContextGroup.h.
(WebKit::FrameProcess::domain const):
(WebKit::FrameProcess::process const):
(WebKit::FrameProcess::process):
(WebKit::FrameProcess::create):
* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
(WebKit::ProvisionalFrameProxy::takeFrameProcess):
(WebKit::ProvisionalFrameProxy::process const):
(WebKit::ProvisionalFrameProxy::takeRemotePageProxy): Deleted.
* Source/WebKit/UIProcess/ProvisionalFrameProxy.h:
(WebKit::ProvisionalFrameProxy::process const): Deleted.
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::process):
(WebKit::ProvisionalPageProxy::setNavigation):
(WebKit::ProvisionalPageProxy::cancel):
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::loadData):
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didPerformClientRedirect):
(WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
(WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
(WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
(WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
(WebKit::ProvisionalPageProxy::didPerformServerRedirect):
(WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::ProvisionalPageProxy::startURLSchemeTask):
(WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
(WebKit::ProvisionalPageProxy::logDiagnosticMessageFromWebProcess):
(WebKit::ProvisionalPageProxy::logDiagnosticMessageWithEnhancedPrivacyFromWebProcess):
(WebKit::ProvisionalPageProxy::logDiagnosticMessageWithValueDictionaryFromWebProcess):
(WebKit::ProvisionalPageProxy::backForwardAddItem):
(WebKit::ProvisionalPageProxy::didDestroyNavigation):
(WebKit::ProvisionalPageProxy::contentFilterDidBlockLoadForFrame):
(WebKit::ProvisionalPageProxy::messageSenderConnection const):
(WebKit::ProvisionalPageProxy::sendMessage):
(WebKit::ProvisionalPageProxy::sendMessageWithAsyncReply):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::browsingContextGroup):
(WebKit::ProvisionalPageProxy::takeRemotePageProxyState): Deleted.
(WebKit::ProvisionalPageProxy::process): Deleted.
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::RemotePageProxy):
(WebKit::RemotePageProxy::injectPageIntoNewProcess):
(WebKit::RemotePageProxy::~RemotePageProxy):
* Source/WebKit/UIProcess/RemotePageProxy.h:
(WebKit::RemotePageProxy::create): Deleted.
* Source/WebKit/UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
(WebKit::SuspendedPageProxy::sendToAllProcesses):
* Source/WebKit/UIProcess/SuspendedPageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::WebFrameProxy):
(WebKit::WebFrameProxy::process const):
(WebKit::WebFrameProxy::processID const):
(WebKit::WebFrameProxy::didCreateSubframe):
(WebKit::WebFrameProxy::prepareForProvisionalNavigationInProcess):
(WebKit::WebFrameProxy::commitProvisionalFrame):
(WebKit::WebFrameProxy::setProcess):
(WebKit::WebFrameProxy::webPageIDInCurrentProcess):
(WebKit::WebFrameProxy::rootFrame):
(WebKit::WebFrameProxy::remotePageProxy const): Deleted.
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::create):
(WebKit::WebFrameProxy::process const): Deleted.
(WebKit::WebFrameProxy::setProcess): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::swapToProvisionalPage):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::receivedNavigationActionPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::getAllFrameTrees):
(WebKit::WebPageProxy::forceRepaint):
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::updateRemoteFrameSize):
(WebKit::WebPageProxy::forEachWebContentProcess):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::callAfterNextPresentationUpdate):
(WebKit::WebPageProxy::processForRegistrableDomain):
(WebKit::WebPageProxy::webPageIDInProcessForDomain const):
(WebKit::WebPageProxy::sendToWebPage):
(WebKit::WebPageProxy::addRemotePageProxy): Deleted.
(WebKit::WebPageProxy::removeRemotePageProxy): Deleted.
(WebKit::WebPageProxy::remotePageProxyForRegistrableDomain const): Deleted.
(WebKit::WebPageProxy::setRemotePageProxyInOpenerProcess): Deleted.
(WebKit::WebPageProxy::takeRemotePageProxyInOpenerProcessIfDomainEquals): Deleted.
(WebKit::WebPageProxy::removeOpenedRemotePageProxy): Deleted.
(WebKit::WebPageProxy::takeOpenedRemotePageProxyIfDomainEquals): Deleted.
(WebKit::WebPageProxy::addOpenedRemotePageProxy): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::addVisitedLinkStoreUser):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::WebFrame):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::m_unifiedTextReplacementController):
(WebKit::WebPage::~WebPage):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::indentation):
(TestWebKitAPI::printTree):
(TestWebKitAPI::checkFrameTreesInProcesses):
(TestWebKitAPI::findFramePID):
(TestWebKitAPI::TEST):

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



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


More information about the webkit-changes mailing list