Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9bcdeaaf75ed5a2cea218d8ed06fe31a3b822dc0
https://github.com/WebKit/WebKit/commit/9bcdeaaf75ed5a2cea218d8ed06fe31a3b822dc0
Author: Alex Christensen <[email protected]>
Date: 2023-06-20 (Tue, 20 Jun 2023)
Changed paths:
M Source/WebCore/bindings/js/WindowProxy.cpp
M Source/WebCore/bindings/js/WindowProxy.h
M Source/WebCore/page/Frame.cpp
M Source/WebCore/page/Frame.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/page/RemoteFrame.cpp
M Source/WebCore/page/RemoteFrame.h
M Source/WebKit/Shared/WebPageCreationParameters.h
M Source/WebKit/Shared/WebPageCreationParameters.serialization.in
M Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/RemotePageProxy.cpp
M Source/WebKit/UIProcess/RemotePageProxy.h
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/mac/WebViewImpl.mm
M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.h
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/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
Begin implementing cross-site window.open in a new process
https://bugs.webkit.org/show_bug.cgi?id=258231
rdar://110931870
Reviewed by Chris Dumez.
This takes some ideas from https://github.com/WebKit/WebKit/pull/10169
and some of Pascoe's more recent work, rebases on top of significant site
isolation
architecture changes since then, and cleans them up with a slightly expanded
test.
The back/forward navigations in the existing API test
ProcessSwap.SameSiteWindowWithOpenerNavigateToFile
cover some transitions that have not been implemented yet, so I temporarily
disable the test until
those transitions are implemented. This greatly simplified this PR and allowed
me to break the development
into more manageable pieces, each of which can be merged with test coverage
showing progress, and each
of which is covered by a currently off-by-default feature flag.
Two important transitions need to happen when implementing window.open in a new
process. The first is
when the ProvisionalPageProxy is constructed. The main frame already exists in
the opener process
(and it is showing about:blank unless it has had a same-site URL loaded in it)
but when we make a frame
in the new process we need that main frame to have an opener frame as a
RemoteFrame, so we need to have
the opener inject a WebPage with a remote frame tree into the process first.
We do this by creating
a RemotePageProxy owned by the opener in the process we are provisionally
navigating to.
The second transition happens when we begin receiving HTTP body for the
provisional navigation and the
navigation commits. In ProvisionalPageProxy::didCommitLoadForFrame we need to
tell the frames of the
opened page in the opener process to transition to remote frames (which are
still needed to be the targets
of operations like postMessage) and we do this by sending the
WebPage::DidCommitLoadInAnotherProcess message.
We then create a RemotePageProxy for those remote frames to communicate with
and set up message receivers.
Because the process already has a WebPage and frame tree in it, we separate the
new function
RemotePageProxy::injectPageIntoNewProcess from what used to be done in each
RemotePageProxy constructor.
We need to prevent this WebPage from being closed or suspended, which we do in
the changes in WebPageProxy.cpp.
Since each Page can have 0 or 1 openers, we add a new member to
WebPageProxy::Internals named
remotePageProxyInOpenerProcess to retain ownership of the RemotePageProxy
communicating with frames
in that process. Each Page can have an unlimited number of Pages it has
opened, so the symmetric other
side of that member is a set of openedRemotePageProxies.
A few other small changes are needed to hook up remote openers, and make it
possible for a main frame to
transition between local and remote, which requires changing the main frame of
a WebCore::Page.
* Source/WebCore/bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::replaceFrame):
* Source/WebCore/bindings/js/WindowProxy.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::resetWindowProxy):
(WebCore::Frame::takeWindowProxy):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::setMainFrame):
* Source/WebCore/page/Page.h:
* Source/WebCore/page/RemoteFrame.cpp:
(WebCore::RemoteFrame::createSubframeWithContentsInAnotherProcess):
* Source/WebCore/page/RemoteFrame.h:
* Source/WebKit/Shared/FrameInfoData.h:
* Source/WebKit/Shared/FrameInfoData.serialization.in:
* Source/WebKit/Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/UIProcess/API/APIFrameInfo.h:
* Source/WebKit/UIProcess/API/APIFrameTreeNode.h:
* Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm:
(-[WKFrameInfo _processIdentifier]):
* Source/WebKit/UIProcess/API/Cocoa/_WKFrameTreeNode.mm:
(-[_WKFrameTreeNode _processIdentifier]):
* Source/WebKit/UIProcess/FrameLoadState.cpp:
(WebKit::FrameLoadState::didStartProvisionalLoad):
* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::RemotePageProxy):
(WebKit::RemotePageProxy::injectPageIntoNewProcess):
(WebKit::RemotePageProxy::~RemotePageProxy):
* Source/WebKit/UIProcess/RemotePageProxy.h:
(WebKit::RemotePageProxy::pageID const):
(WebKit::RemotePageProxy::domain const):
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::setProcess):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::WebPageProxy::shouldClosePreviousPage):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::getAllFrameTrees):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::addRemotePageProxy):
(WebKit::WebPageProxy::setRemotePageProxyInOpenerProcess):
(WebKit::WebPageProxy::addOpenedRemotePageProxy):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::changeLocation):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::info const):
(WebKit::WebFrame::didCommitLoadInAnotherProcess):
(WebKit::WebFrame::transitionToLocal):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::didCommitLoadInAnotherProcess):
(WebKit::WebPage::transitionFrameToLocal):
(WebKit::WebPage::transitionFrameToLocalAndLoadRequest): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Canonical link: https://commits.webkit.org/265321@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes