Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5493989ddb66a090c5919f396544342e4768226b
https://github.com/WebKit/WebKit/commit/5493989ddb66a090c5919f396544342e4768226b
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2025-10-06 (Mon, 06 Oct 2025)
Changed paths:
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Tools/TestWebKitAPI/Tests/mac/FocusWebView.mm
Log Message:
-----------
[Site Isolation] Main frame's Document.activeElement incorrectly reports
iframe after focus is relinquished from a cross-origin iframe to the user agent
chrome
https://bugs.webkit.org/show_bug.cgi?id=300154
rdar://161863002
Reviewed by Aditya Keerthi.
When focus is relinquished from a cross-origin iframe to the user agent
chrome (e.g., an AppKit text field), document.activeElement in the main
frame incorrectly still references the iframe element. This occurs
because broadcastFocusedFrameToOtherProcesses() only supported
broadcasting a valid FrameIdentifier, not nullptr when focus moves to
chrome.
The fix changes broadcastFocusedFrameToOtherProcesses() to accept
std::optional<FrameIdentifier> instead of a bare FrameIdentifier. When
nullptr is passed (indicating focus has moved to chrome), it broadcasts
std::nullopt to other WebContent processes, allowing them to properly
clear their focused frame state via setFocusedFrame(nullptr).
Test: FocusWebView.CrossOriginIframeRelinquishToChromeTests
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::focusedFrameChanged):
(WebKit::WebPageProxy::broadcastFocusedFrameToOtherProcesses):
(WebKit::WebPageProxy::focusRemoteFrame):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::frameWasFocusedInAnotherProcess):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/mac/FocusWebView.mm:
(TestWebKitAPI::CrossOriginIframeRelinquishToChromeTests::runTest)
Parameterized test that verifies document.activeElement is correctly
cleared when focus moves from a cross-origin iframe to an AppKit text
field (emulating some user agent chrome), with and without site isolation
enabled.
Canonical link: https://commits.webkit.org/301071@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes