-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
d8da684
commit 6b90cc5
Showing
46 changed files
with
361 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.