Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2e9bc3ae2ab812cb39de01af0534565aa706915d
https://github.com/WebKit/WebKit/commit/2e9bc3ae2ab812cb39de01af0534565aa706915d
Author: Sihui Liu <[email protected]>
Date: 2025-12-09 (Tue, 09 Dec 2025)
Changed paths:
M Source/WebCore/loader/EmptyClients.cpp
M Source/WebCore/loader/EmptyFrameLoaderClient.h
M Source/WebCore/loader/FrameLoaderClient.h
M Source/WebCore/page/Frame.cpp
M Source/WebCore/page/Frame.h
M Source/WebCore/page/LocalDOMWindow.cpp
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/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/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
[Site Isolation] Disowned opener is not persisted after cross-site navigation
rdar://165741304
https://bugs.webkit.org/show_bug.cgi?id=303452
Reviewed by Alex Christensen.
Opened window can disown its opener by setting window.opener to null in
JavaScript, and in this case `window.opener`
should stay null across navigation. Currently the state is not persisted under
site isolation as the web process that
sets opener to null does not inform UI processes about the update. So when
cross-site navigation happens and the frame
is loaded in a different process, UI process will tell the new process that the
frame has opener. To fix it, make web
process notify UI process when a frame disowns opener on JavaScript request.
This patch also introduces `WebFrameProxy::m_disownedOpener` to track opener
that has been disowned, because this change
causes process no longer to be swapped when opener window still has a handle to
opened window, when site isolation is
disabled. This cause is the current implementation just relies on
`WebFrameProxy::opener()` to track the opener
relationship (see `WebProcessPool::processForNavigationInternal()`). To keep
this case still works, this patch uses
`WebFrameProxy::disownedOpener()` in the condition.
Test: SiteIsolation.NavigateOpenedWindowCrossSiteAfterDisowningOpener
* Source/WebCore/loader/EmptyClients.cpp:
(WebCore::EmptyFrameLoaderClient::updateOpener):
* Source/WebCore/loader/EmptyFrameLoaderClient.h:
* Source/WebCore/loader/FrameLoaderClient.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::updateOpener):
(WebCore::Frame::disownOpener):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::disownOpener):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::updateOpener):
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::opener const):
(WebKit::WebFrameProxy::disownedOpener const):
(WebKit::WebFrameProxy::opener): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateOpener):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::updateOpener):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::updateOpener):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::updateOpener):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateOpener):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::updateOpener):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation,
NavigateOpenedWindowCrossSiteAfterDisowningOpener)):
Canonical link: https://commits.webkit.org/304171@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications