Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6b90cc53702b153ef3d8652580543a296c0eb7c5
      
https://github.com/WebKit/WebKit/commit/6b90cc53702b153ef3d8652580543a296c0eb7c5
  Author: Alex Christensen <achristen...@apple.com>
  Date:   2024-05-06 (Mon, 06 May 2024)

  Changed paths:
    M Source/WebCore/history/BackForwardController.cpp
    M Source/WebCore/loader/EmptyClients.cpp
    M Source/WebCore/loader/NavigationScheduler.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrame.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/page/PageConfiguration.cpp
    M Source/WebCore/page/PageConfiguration.h
    M Source/WebCore/page/RemoteFrame.cpp
    M Source/WebCore/page/RemoteFrame.h
    M Source/WebKit/CMakeLists.txt
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    R Source/WebKit/Shared/LocalFrameCreationParameters.h
    R Source/WebKit/Shared/LocalFrameCreationParameters.serialization.in
    A Source/WebKit/Shared/ProvisionalFrameCreationParameters.h
    A Source/WebKit/Shared/ProvisionalFrameCreationParameters.serialization.in
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/BrowsingContextGroup.h
    M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
    M 
Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h
    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
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAndDecodeImage.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebRequest.mm
    M Tools/TestWebKitAPI/cocoa/HTTPServer.h
    M Tools/TestWebKitAPI/cocoa/HTTPServer.mm

  Log Message:
  -----------
  [Site Isolation] Introduce provisional frames to handle load failures and JS 
during navigation
https://bugs.webkit.org/show_bug.cgi?id=273741
rdar://127553870

Reviewed by Brady Eidson.

Until now, to navigate a RemoteFrame we first transitioned it to a LocalFrame 
then started a load in it.
This worked fine, but it has two fundamental issues.  First, if JS interacts 
with the Frame between when
the provisional load starts and the server reply is received and the load 
commits, the JS will be interacting
with a LocalFrame instead of the old RemoteFrame.  Second, if the provisional 
load fails, we need the original
RemoteFrame to be in the frame tree afterwards.  With main frame provisional 
load failures we were just
transitioning them back to a new RemoteFrame and that passed existing tests, 
but with iframes or any
more involved testing we ran into an issue.

To solve this, I give each WebFrame the ability to have a provisional 
LocalFrame and I use that for loading
instead, then when the load commits I replace the RemoteFrame in the tree with 
a LocalFrame.  This model allows
us to fix the two issues.

A WebFrame can now have multiple WebCore::Frames, one possibly provisional.  To 
make this work, I need
WebLocalFrameLoaderClient to not get its LocalFrame from the WebFrame, but have 
its own reference to its LocalFrame.
To use a non-nullable type (WeakRef<WebCore::LocalFrame>) I made it so that the 
FrameLoaderClient construction
happens during the constructor of the LocalFrame rather than making the 
FrameLoaderClient then passing it in
to the LocalFrame constructor.  I did this using ClientCreator.

This makes the frame construction and destruction less symmetric as well as the 
transitions from remote to local
and local to remote less symmetric, but it is necessary because the provisional 
state needs to be handled robustly.

I also did a few simple cleanups of code I was touching anyways, such as moving 
the WebFrame invalidator to
the shared WebFrameLoaderClient from the local and remote clients to reduce 
duplicate code, removing the
BrowsingContextGroup::remotePageInProcess function that takes a 
RegistrableDomain because we already have the
WebProcessProxy and don't need to look it up with what is hopefully always the 
right URL, and using
toWebLocalFrameLoaderClient instead of assuming the client is not an 
EmptyFrameLoaderClient.

I added some test infrastructure to have HTTPServer never send a response, 
which will be needed for many
upcoming tests in this area.

* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/ProvisionalFrameCreationParameters.h: Renamed from 
Source/WebKit/Shared/LocalFrameCreationParameters.h.
* Source/WebKit/Shared/ProvisionalFrameCreationParameters.serialization.in: 
Renamed from Source/WebKit/Shared/LocalFrameCreationParameters.serialization.in.
* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::takeRemotePageInProcessForProvisionalPage):
* Source/WebKit/UIProcess/BrowsingContextGroup.h:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::initializeWebPage):
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::prepareForProvisionalNavigationInProcess):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::webPageIDInProcess const):
(WebKit::WebPageProxy::webPageIDInProcessForDomain const): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidCommitLoad):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::coreLocalFrame const):
(WebKit::WebFrame::createProvisionalFrame):
(WebKit::WebFrame::commitProvisionalFrame):
(WebKit::WebFrame::removeFromTree):
(WebKit::WebFrame::transitionToLocal): Deleted.
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::provisionalFrame):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createProvisionalFrame):
(WebKit::WebPage::commitProvisionalFrame):
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::transitionFrameToLocal): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, 
NavigateIframeToProvisionalNavigationFailure)): Deleted.
(TestWebKitAPI::TEST(SiteIsolation, 
PresentationUpdateAfterCrossSiteNavigation)): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to