Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7f8277fb2bb0cb76b0b575ecf7e599878e63c438
https://github.com/WebKit/WebKit/commit/7f8277fb2bb0cb76b0b575ecf7e599878e63c438
Author: Ben Nham <[email protected]>
Date: 2026-08-17 (Mon, 17 Aug 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/resources/user-gesture-innermost-frame.html
A
LayoutTests/http/tests/site-isolation/resources/user-gesture-middle-frame.html
A
LayoutTests/http/tests/site-isolation/user-gesture-in-cross-origin-iframe-reaches-ancestor-in-another-process-expected.txt
A
LayoutTests/http/tests/site-isolation/user-gesture-in-cross-origin-iframe-reaches-ancestor-in-another-process.html
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/UserGestureIndicator.cpp
M Source/WebCore/loader/FrameLoaderClient.h
M Source/WebCore/page/FocusController.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
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/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
[Site Isolation] User interaction and last user gesture timestamp flags
aren't updated on remote frames
https://bugs.webkit.org/show_bug.cgi?id=321900
rdar://185076535
Reviewed by Wenson Hsieh.
When a user gesture occurs, UserGestureIndicator currently only updates the
user interaction and
last user gesture timestamp flags on local ancestors. This can lead to issues
like iframes being
unexpectedly throttled.
Fix this by telling the UIProcess about the user gesture if there is any remote
frame ancestor.
UIProcess then broadcasts the user gesture state to the ancestor remote frames.
A one-way broadcast IPC is sufficient here as we only ever set the
hasHadUserInteraction and and
lastHandledUserGestureTimestamp flags on ancestor documents; we don't reset
them.
This contains a drive-by fix to
`FocusController::findFocusableElementStartingWithLocalFrame` to
avoid setting the user gesture flags on a query. iOS makes those queries to
e.g. figure out whether
to show the next/prev buttons in the accessory bar on focus. Fixing this is
necessary for the layout
test to actually test the change on iOS. Previously, with site isolation
enabled, a focusable
element query would send the FindFocusableElementDescendingIntoRemoteFrame IPC
with
ShouldFocusElement::No, and we set the user gesture indicator for it
unconditionally. So a
programmatic focus() without direct user interaction could set the user gesture
indicator.
*
LayoutTests/http/tests/site-isolation/resources/user-gesture-innermost-frame.html:
Added.
*
LayoutTests/http/tests/site-isolation/resources/user-gesture-middle-frame.html:
Added.
*
LayoutTests/http/tests/site-isolation/user-gesture-in-cross-origin-iframe-reaches-ancestor-in-another-process-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/user-gesture-in-cross-origin-iframe-reaches-ancestor-in-another-process.html:
Added.
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):
* Source/WebCore/loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::didHandleFirstUserGesture):
* Source/WebCore/page/FocusController.cpp:
(WebCore::FocusController::findFocusableElementStartingWithLocalFrame):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didNotifyUserActivation):
(WebKit::WebPageProxy::didHandleFirstUserGesture):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::didHandleFirstUserGesture):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::didHandleFirstUserGesture):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateLastHandledUserGestureTimestamp):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Canonical link: https://commits.webkit.org/319332@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications