Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f3a769adfe54651c121df4c7cbe0da2dd2a0d554
https://github.com/WebKit/WebKit/commit/f3a769adfe54651c121df4c7cbe0da2dd2a0d554
Author: Pascoe <[email protected]>
Date: 2026-06-11 (Thu, 11 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
M
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/VerifyUserGestureFromUIProcess.mm
Log Message:
-----------
Same user gesture can be used for both opening a window and focussing
previous one
rdar://168506684
https://bugs.webkit.org/show_bug.cgi?id=309184
Reviewed by Ryosuke Niwa.
chrome().focus() sends SetFocus(true) to the UIProcess with no user gesture
context. A common client consuming the _WKUserInitiatedAction during popup
creation (in createWebViewWithConfiguration) has no way to prevent a subsequent
focus of an existing window from the same gesture — the focus path bypasses the
consumed check entirely.
To fix this, we plumb UserGestureTokenIdentifier through SetFocus and
FocusRemoteFrame IPC so setFocus() can look up the API::UserInitiatedAction and
skip the focus if already consumed.
Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/VerifyUserGestureFromUIProcess.mm
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setFocus):
(WebKit::WebPageProxy::focusRemoteFrame):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focus):
(WebKit::WebChromeClient::unfocus):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::focus):
(WebKit::WebRemoteFrameClient::unfocus):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, PopunderPreventedByConsumedAction)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/VerifyUserGestureFromUIProcess.mm:
(TestWebKitAPI::TEST(VerifyUserGesture, PopunderPreventedByConsumedAction)):
Originally-landed-as: 305413.427@rapid/safari-7624.2.5.110-branch
(e7c824391cd2). rdar://176067019
Canonical link: https://commits.webkit.org/315017@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications