[webkit-changes] [WebKit/WebKit] a9f7a6: Implement cross-origin redirects when loading site...
Alex Christensen
noreply at github.com
Thu Aug 10 10:53:03 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a9f7a67a74b27f5af55ea016250f837b008da857
https://github.com/WebKit/WebKit/commit/a9f7a67a74b27f5af55ea016250f837b008da857
Author: Alex Christensen <achristensen at apple.com>
Date: 2023-08-10 (Thu, 10 Aug 2023)
Changed paths:
M Source/WebCore/loader/FrameLoader.cpp
M Source/WebKit/UIProcess/API/APINavigation.cpp
M Source/WebKit/UIProcess/API/APINavigation.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/WebProcessPool.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
Implement cross-origin redirects when loading site-isolated iframes
https://bugs.webkit.org/show_bug.cgi?id=259817
rdar://113377510
Reviewed by Chris Dumez.
In order to get this to work, I needed to do several things:
1. Implement some message handlers in RemotePageProxy to call WebPageProxy methods with the correct process.
2. Make 2 modifications to WebFrameProxy::prepareForProvisionalNavigationInProcess:
2.a. If we are redirected back to the WebFrameProxy's process, stop using a ProvisionalFrameProxy or RemotePageProxy.
We are just doing a same-process navigation when this happens.
2.b. If we have a provisional frame but we are doing a cross-origin redirect, make a new provisional frame in the new process.
3. After preparing for a provisional navigation, skip the didCommitLoadForFrame call from the new process
because we've already received it from the first page. This is what YesAfterProvisionalLoadStarted does.
4. If we are redirecting, frameProcessBeforeNavigation needs to be the provisional frame's process for continueWithProcessForNavigation.
5. If site isolation is enabled, we can't reuse a process that hasn't seen a provisional navigation committed because we
need a provisional load starting to a new domain to come from a new domain's process. This may be optimized away when
we implement redirect chain following without starting processes for each domain along the chain, but the change
in WebProcessPool::processForNavigationInternal is needed until then.
Covered by testing a variety of same-domain and cross-domain redirects in addition to existing tests.
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::load):
* Source/WebKit/UIProcess/API/APINavigation.cpp:
(API::Navigation::currentRequestIsCrossOriginRedirect const):
* Source/WebKit/UIProcess/API/APINavigation.h:
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::didReceiveMessage):
(WebKit::RemotePageProxy::decidePolicyForNavigationActionAsync):
(WebKit::RemotePageProxy::decidePolicyForNavigationActionSync):
(WebKit::RemotePageProxy::didChangeProvisionalURLForFrame):
(WebKit::RemotePageProxy::didReceiveSyncMessage):
* Source/WebKit/UIProcess/RemotePageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::prepareForProvisionalNavigationInProcess):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):
Canonical link: https://commits.webkit.org/266768@main
More information about the webkit-changes
mailing list