[webkit-changes] [WebKit/WebKit] 77752e: Implement provisional load failure handling with s...

Alex Christensen noreply at github.com
Thu Aug 24 22:07:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 77752e9899f11d2a2300d64a00baf2ff89ac9eb9
      https://github.com/WebKit/WebKit/commit/77752e9899f11d2a2300d64a00baf2ff89ac9eb9
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-08-24 (Thu, 24 Aug 2023)

  Changed paths:
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/FrameLoader.h
    M Source/WebCore/page/Frame.h
    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/UIProcess/ProvisionalFrameProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.h
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalPageProxy.h
    M Source/WebKit/UIProcess/RemotePageProxy.cpp
    M Source/WebKit/UIProcess/RemotePageProxy.h
    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/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Implement provisional load failure handling with site isolation
https://bugs.webkit.org/show_bug.cgi?id=260643
rdar://114360180

Reviewed by Chris Dumez.

When a provisional load fails, we need to send WebPage::DidFinishLoadInAnotherProcess
to the parent's process to tell the parent that one of its children is no longer loading,
so it shouldn't delay its load event any more.  I took RemoteFrame::didFinishLoadInAnotherProcess
and made it a pure virtual function on Frame.  If the Frame is a RemoteFrame, then behavior is
unchanged.  If the Frame is a LocalFrame and it receives a didFinishLoadInAnotherProcess call,
that means the load failed before it was committed.  I update the state indicating that the
parent's load event should be delayed, then tell the parent to check if its load is complete.

To have the frame tree clean up correctly, I needed to move ownership of the RemotePageProxy
from the WebFrameProxy to the ProvisionalFrameProxy until the frame navigation is committed,
at which point ownership is transferred to the WebFrameProxy and the ProvisionalFrameProxy
is destroyed.  This moves the RemotePageProxy::create call downstream a bit to
WebFrameProxy::prepareForProvisionalNavigationInProcess which makes more sense anyways.

The WebPageProxy::didFailProvisionalLoadForFrame was redundantly sending the FrameIdentifier
as its own parameter and as part of the FrameInfoData.  I removed the first one in favor of the second.

The DidCreateNewProcess enum was unused.  I removed it.

Reusing a process when hasCommittedAnyProvisionalLoads returns false proved problematic.
It is likely possible, but it's an optimization at this point.  I disabled it to make the
process to domain mapping constant with site isolation.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::provisionalLoadFailedInAnotherProcess):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::didFinishLoadInAnotherProcess):
* Source/WebCore/page/LocalFrame.h:
* Source/WebCore/page/RemoteFrame.cpp:
(WebCore::RemoteFrame::didFinishLoadInAnotherProcess):
* Source/WebCore/page/RemoteFrame.h:
* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
(WebKit::ProvisionalFrameProxy::takeRemotePageProxy):
* Source/WebKit/UIProcess/ProvisionalFrameProxy.h:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::cancel):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::didReceiveMessage):
(WebKit::RemotePageProxy::didFailProvisionalLoadForFrame):
* Source/WebKit/UIProcess/RemotePageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::takeProvisionalFrame):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::prepareForProvisionalNavigationInProcess):
(WebKit::WebFrameProxy::commitProvisionalFrame):
(WebKit::WebFrameProxy::setRemotePageProxy): Deleted.
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::processForNavigationInternal):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidFailProvisionalLoad):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didFinishLoadInAnotherProcess):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list