[webkit-changes] [WebKit/WebKit] b63538: Instantiate a RemoteFrame upon cross-origin iframe...

Alex Christensen noreply at github.com
Tue Dec 13 23:14:35 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b6353876dac02d9eca484847c6990996244f103a
      https://github.com/WebKit/WebKit/commit/b6353876dac02d9eca484847c6990996244f103a
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2022-12-13 (Tue, 13 Dec 2022)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/html/HTMLFrameElementBase.cpp
    M Source/WebCore/html/HTMLFrameOwnerElement.cpp
    M Source/WebCore/html/HTMLFrameOwnerElement.h
    M Source/WebCore/html/PDFDocument.cpp
    M Source/WebCore/inspector/InspectorFrontendHost.cpp
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/SubframeLoader.cpp
    M Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
    M Source/WebCore/page/AbstractFrame.cpp
    M Source/WebCore/page/AbstractFrame.h
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/FocusController.cpp
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/FrameTree.h
    M Source/WebCore/page/ModalContainerObserver.cpp
    M Source/WebCore/page/PageSerializer.cpp
    M Source/WebCore/page/RemoteDOMWindow.cpp
    M Source/WebCore/page/RemoteDOMWindow.h
    M Source/WebCore/page/RemoteFrame.cpp
    M Source/WebCore/page/RemoteFrame.h
    A Source/WebCore/page/RemoteFrameClient.h
    M Source/WebKit/Sources.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp
    M Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
    A Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
    A Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKitLegacy/win/DOMHTMLClasses.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Instantiate a RemoteFrame upon cross-origin iframe navigation when site isolation is enabled
https://bugs.webkit.org/show_bug.cgi?id=249261

Reviewed by Tim Horton and Chris Dumez.

This introduces RemoteFrameClient which is kind of like the RemoteFrame equivalent of FrameLoaderClient
for when a RemoteFrame needs to tell the layer above it to do things.  Right now it doesn't have any actions,
but it will.  It's also needed for the non-local implementation of WebFrame::fromCoreFrame.

HTMLFrameOwnerElement needs to be able to own a RemoteFrame, so it now owns an AbstractFrame.
Like elsewhere where we do dynamicDowncast<LocalFrame>, there is work yet to do, but that will be done later.

A RemoteFrame needs to own a RemoteDOMWindow like a Frame owns a Document which owns a DOMWindow.
To make this ownership work, I changed the RefPtr<RemoteFrame> to a WeakPtr<RemoteFrame> in RemoteDOMWindow
to prevent reference cycles.

In WebFrame::didCommitLoadInAnotherProcess, I disconnect the Frame and replace it with a RemoteFrame that
is hooked up well enough to pass the existing tests.  More tests need to be written and work needs to be done
there still.

In order to have most of the data available for the tests that use WKWebView._frames to verify things about
site isolation and processes, I had to make frameTreeNodeData take an AbstractFrame so it can return some
meaningful data.  Like almost everything in this PR, there's still room to fix things there, too!

I wrote an API test that doesn't really add coverage to this new work that wasn't already there, but it
sets up for the work I was trying to do when I found I needed to do this first.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::didAttachRenderers):
(WebCore::HTMLFrameElementBase::setFocus):
* Source/WebCore/html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::setContentFrame):
(WebCore::HTMLFrameOwnerElement::disconnectContentFrame):
(WebCore::HTMLFrameOwnerElement::contentDocument const):
* Source/WebCore/html/HTMLFrameOwnerElement.h:
(WebCore::HTMLFrameOwnerElement::contentFrame const):
* Source/WebCore/inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::evaluateScriptInExtensionTab):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
* Source/WebCore/loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::loadOrRedirectSubframe):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* Source/WebCore/page/AbstractFrame.cpp:
(WebCore::parentFrame):
(WebCore::AbstractFrame::AbstractFrame):
(WebCore::AbstractFrame::ownerElement const):
(WebCore::AbstractFrame::disconnectOwnerElement):
* Source/WebCore/page/AbstractFrame.h:
* Source/WebCore/page/EventHandler.cpp:
(WebCore::contentFrameForNode):
* Source/WebCore/page/FocusController.cpp:
(WebCore::FocusNavigationScope::scopeOwnedByIFrame):
(WebCore::FocusController::findFocusableElementDescendingIntoSubframes):
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::advanceFocusDirectionallyInContainer):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::invalidateContentEventRegionsIfNeeded):
(WebCore::Frame::ownerRenderer const):
(WebCore::Frame::contentFrameFromWindowOrFrameElement):
(WebCore::Frame::ownerElement const): Deleted.
(WebCore::Frame::disconnectOwnerElement): Deleted.
(WebCore::Frame::didFinishLoadInAnotherProcess): Deleted.
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/FrameTree.h:
* Source/WebCore/page/ModalContainerObserver.cpp:
(WebCore::ModalContainerObserver::updateModalContainerIfNeeded):
* Source/WebCore/page/PageSerializer.cpp:
(WebCore::PageSerializer::SerializerMarkupAccumulator::appendCustomAttributes):
* Source/WebCore/page/RemoteDOMWindow.cpp:
(WebCore::RemoteDOMWindow::RemoteDOMWindow):
(WebCore::RemoteDOMWindow::~RemoteDOMWindow): Deleted.
* Source/WebCore/page/RemoteDOMWindow.h:
* Source/WebCore/page/RemoteFrame.cpp:
(WebCore::RemoteFrame::RemoteFrame):
(WebCore::m_client):
(WebCore::RemoteFrame::virtualWindow const):
(WebCore::RemoteFrame::window const):
(WebCore::RemoteFrame::didFinishLoadInAnotherProcess):
(WebCore::RemoteFrame::setWindow): Deleted.
* Source/WebCore/page/RemoteFrame.h:
* Source/WebCore/page/RemoteFrameClient.h: Copied from Source/WebCore/page/RemoteFrame.cpp.
(WebCore::RemoteFrameClient::~RemoteFrameClient):
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
(WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp: Copied from Source/WebCore/page/RemoteFrame.cpp.
(WebKit::WebRemoteFrameClient::WebRemoteFrameClient):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h: Copied from Source/WebCore/page/RemoteFrame.cpp.
(WebKit::WebRemoteFrameClient::webFrame const):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::fromCoreFrame):
(WebKit::WebFrame::didCommitLoadInAnotherProcess):
(WebKit::WebFrame::didFinishLoadInAnotherProcess):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::frameTreeNodeData):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::enableSiteIsolation):
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list