[webkit-changes] [WebKit/WebKit] 825e39: Site-isolated frames from window.open should be ab...

Alex Christensen noreply at github.com
Fri Oct 20 23:31:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 825e39cd2f70923fef0bed022b9aaf5b72b2e0a4
      https://github.com/WebKit/WebKit/commit/825e39cd2f70923fef0bed022b9aaf5b72b2e0a4
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-10-20 (Fri, 20 Oct 2023)

  Changed paths:
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/RemotePageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxyInternals.h
    M Source/WebKit/UIProcess/WebPageProxyMessageReceiverRegistration.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Site-isolated frames from window.open should be able to navigate to the opener's domain
https://bugs.webkit.org/show_bug.cgi?id=263451
rdar://111064337

Reviewed by Pascoe.

In order to get this to work, we need to do different things in two important loading callbacks.
1. When the navigation starts, if we are navigating to the opener's domain, instead of creating
   a RemotePageProxy in a new process to start the navigation in, we adopt the process "owned"
   by an existing RemotePageProxy, transferring its UI process message receiving from the
   RemotePageProxy to the ProvisionalPageProxy.
2. When we commit the load, instead of adding a RemotePageProxy for the opener to use for things
   like posting messages to, we destroy a RemotePageProxy "owning" a process that is now unused.

Other changes are just to make the flow work.  WebProcessPool::processForNavigation needed a slight
change to return the right process even when navigating the main frame.  WebFrame::transitionToLocal
needed a slight change to set the Page's new MainFrame before initializing the frame so the frame
loader's state would be as expected and not fire assertions.  WebPage::hasRootFrames can return false
when site isolation is enabled, so I updated the assertion there.  It was also worth adding an assertion
in WebPageProxyMessageReceiverRegistration::transferMessageReceivingFrom to make the users of that
function make sense.

* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/RemotePageProxy.h:
(WebKit::RemotePageProxy::messageReceiverRegistration):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::takeRemotePageProxyInOpenerProcessIfDomainEquals):
(WebKit::WebPageProxy::removeOpenedRemotePageProxy):
(WebKit::WebPageProxy::addOpenedRemotePageProxy):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/WebPageProxyMessageReceiverRegistration.cpp:
(WebKit::WebPageProxyMessageReceiverRegistration::transferMessageReceivingFrom):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::transitionToLocal):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::hasRootFrames):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list