[webkit-changes] [WebKit/WebKit] 65e5a9: Prepare to allow parent frames to navigate site is...

Alex Christensen noreply at github.com
Thu May 11 20:22:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 65e5a936b4813455e875e5e7a53e77678ce6182b
      https://github.com/WebKit/WebKit/commit/65e5a936b4813455e875e5e7a53e77678ce6182b
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    M Source/WebCore/inspector/InspectorInstrumentation.cpp
    M Source/WebCore/inspector/InspectorInstrumentation.h
    M Source/WebCore/inspector/agents/InspectorPageAgent.cpp
    M Source/WebCore/inspector/agents/InspectorPageAgent.h
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/FrameLoader.h
    M Source/WebCore/loader/NavigationDisabler.h
    M Source/WebCore/loader/NavigationScheduler.cpp
    M Source/WebCore/loader/NavigationScheduler.h
    M Source/WebCore/loader/SubframeLoader.cpp
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Prepare to allow parent frames to navigate site isolated iframes
https://bugs.webkit.org/show_bug.cgi?id=256678
rdar://109235337

Reviewed by Brady Eidson.

This PR does a few things, all of which will not change behavior with site isolation off.

First, it moves NavigationScheduler from LocalFrame to Frame.  This is needed because
if a parent frame sets iframe.src=newURL then the parent's process needs to schedule the
navigation of the iframe.  This is the first of several large steps to get the navigation
to happen.  The next steps are to make a FrameLoader able to be owned by either a LocalFrame
or a RemoteFrame and able to be moved between the two as the navigation causes processes
to change.  I got the NavigationScheduler to the point where it doesn't assert in the API
test ParentNavigatingCrossOriginIframeToSameOrigin when site isolation is enabled, though
the navigation doesn't proceed yet because there is no FrameLoader on the RemoteFrame.

In order to make that compile, I needed to make some InspectorInstrumentation parameters
be Frame instead of LocalFrame.

I also made the source process in WebPageProxy::decidePolicyForNavigationAction be the
WebFrameProxy's current process instead of the process from which the decidePolicyForNavigationAction
message came.  In all tests that are running for site isolation so far, they are the same.

I add some assertions in the WebFrame constructor and invalidator that helped me figure out what
was going wrong when debugging this.  We had some code that was making 2 WebFrames with the same
FrameIdentifier.  This will help future developers catch problems earlier.

I also change the alert in the API test ParentNavigatingCrossOriginIframeToSameOrigin to be
called in the onload handler.  This will allow my frame tree validation code to have deterministic
state once I implement the frame teardown in the previoiusly-used process.  If it weren't in the
onload handler, then there was a race condition in the test because the alert could come before
the didCommitLoadForFrame was processed.

I also move the boolean values initialized in the FrameLoader constructor to use initializers in the header.

* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::frameScheduledNavigationImpl):
(WebCore::InspectorInstrumentation::frameClearedScheduledNavigationImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::frameScheduledNavigation):
(WebCore::InspectorInstrumentation::frameClearedScheduledNavigation):
(WebCore::InspectorInstrumentation::instrumentingAgents):
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::frameDetached):
(WebCore::InspectorPageAgent::frameForId):
(WebCore::InspectorPageAgent::frameId):
(WebCore::InspectorPageAgent::assertFrame):
(WebCore::InspectorPageAgent::frameScheduledNavigation):
(WebCore::InspectorPageAgent::frameClearedScheduledNavigation):
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
* Source/WebCore/loader/NavigationDisabler.h:
(WebCore::NavigationDisabler::isNavigationAllowed):
* Source/WebCore/loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::NavigationScheduler):
(WebCore::NavigationScheduler::scheduleRedirect):
(WebCore::NavigationScheduler::mustLockBackForwardList):
(WebCore::NavigationScheduler::scheduleLocationChange):
(WebCore::NavigationScheduler::scheduleFormSubmission):
(WebCore::NavigationScheduler::scheduleRefresh):
(WebCore::NavigationScheduler::timerFired):
(WebCore::NavigationScheduler::schedule):
(WebCore::NavigationScheduler::startTimer):
(WebCore::NavigationScheduler::cancel):
* Source/WebCore/loader/NavigationScheduler.h:
* Source/WebCore/loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::loadOrRedirectSubframe):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::~Frame):
* Source/WebCore/page/Frame.h:
(WebCore::Frame::navigationScheduler const):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::LocalFrame):
(WebCore::LocalFrame::~LocalFrame):
* Source/WebCore/page/LocalFrame.h:
(WebCore::LocalFrame::navigationScheduler const): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::WebFrame):
(WebKit::WebFrame::invalidate):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list