[webkit-changes] [WebKit/WebKit] ee0045: Begin implementing frame name handling for site is...

Alex Christensen noreply at github.com
Tue Nov 14 15:43:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee004596ca4fe4d507bb4bb9051725d8c8592655
      https://github.com/WebKit/WebKit/commit/ee004596ca4fe4d507bb4bb9051725d8c8592655
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-11-14 (Tue, 14 Nov 2023)

  Changed paths:
    M LayoutTests/http/tests/site-isolation/frame-access-after-window-open-expected.txt
    M LayoutTests/http/tests/site-isolation/frame-access-after-window-open.html
    A LayoutTests/http/tests/site-isolation/resources/post-message-to-opener-2.html
    A LayoutTests/http/tests/site-isolation/window-open-with-name-expected.txt
    A LayoutTests/http/tests/site-isolation/window-open-with-name.html
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/FrameTree.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h
    M Source/WebCore/page/RemoteFrame.cpp
    M Source/WebCore/page/RemoteFrame.h
    M Source/WebKit/Shared/FrameTreeCreationParameters.h
    M Source/WebKit/Shared/FrameTreeCreationParameters.serialization.in
    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/WebPageProxy.messages.in
    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

  Log Message:
  -----------
  Begin implementing frame name handling for site isolation
https://bugs.webkit.org/show_bug.cgi?id=264781
rdar://117092110

Reviewed by Pascoe.

In order for the second parameter of window.open to be able to be used, the string name
must be found on the correct frame.  Most of this can be implemented simply by passing a
string around, but in order for WebFrameProxy::frameTreeCreationParameters to be able to
be used with multiple frames after instantiation, we need to store the name in the UI
process on the WebFrameProxy object.

In the web content process, a few fixes were needed.  First, when switch from RemoteFrame
to LocalFrame or the other way, the frame name should persist so we need to copy it from
the old to the new Frame subclass object.  In order for the correct frame to be found and
used when RemoteFrames are in the tree, I needed to make a few places in FrameTree and
FrameLoader work with both types of Frames.

I also had to move some RemotePageProxy cleanup from the WebPageProxy destructor to
WebPageProxy::close to get WebKitTestRunner to successfully clean up between running tests.

This seemed like a good stopping point to make a PR because something that didn't work
before works now.  I filed another bug for future work to make two more cases work:
if the named frame is a RemoteFrame and if the named frame is the main frame.

* LayoutTests/http/tests/site-isolation/frame-access-after-window-open-expected.txt:
* LayoutTests/http/tests/site-isolation/frame-access-after-window-open.html:
* LayoutTests/http/tests/site-isolation/resources/post-message-to-opener-2.html: Added.
* LayoutTests/http/tests/site-isolation/window-open-with-name-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/window-open-with-name.html: Added.
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::findFrameForNavigation):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/FrameTree.cpp:
(WebCore::FrameTree::~FrameTree):
(WebCore::isFrameFamiliarWith):
(WebCore::FrameTree::find const):
(WebCore::FrameTree::firstRenderedChild const):
(WebCore::FrameTree::nextRenderedSibling const):
(WebCore::FrameTree::traverseNext const):
(WebCore::FrameTree::traverseNextInPostOrder const):
(printFrames):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::disconnectView):
(WebCore::LocalFrame::opener const):
(WebCore::LocalFrame::opener):
* Source/WebCore/page/LocalFrame.h:
* Source/WebCore/page/RemoteFrame.cpp:
(WebCore::RemoteFrame::disconnectView):
* Source/WebCore/page/RemoteFrame.h:
* Source/WebKit/Shared/FrameTreeCreationParameters.h:
* Source/WebKit/Shared/FrameTreeCreationParameters.serialization.in:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didCreateSubframe):
(WebKit::WebFrameProxy::frameTreeCreationParameters const):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCreateSubframe):
(WebKit::WebPageProxy::createRemoteSubframesInOtherProcesses):
(WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSubframe):
(WebKit::WebFrame::createRemoteSubframe):
(WebKit::WebFrame::didCommitLoadInAnotherProcess):
(WebKit::WebFrame::transitionToLocal):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::constructFrameTree):
(WebKit::WebPage::createRemoteSubframe):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

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




More information about the webkit-changes mailing list