Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5ee5dbfc5d137a4e0d0acf8e4992d5b8c708bb97
https://github.com/WebKit/WebKit/commit/5ee5dbfc5d137a4e0d0acf8e4992d5b8c708bb97
Author: Alex Christensen <[email protected]>
Date: 2026-06-18 (Thu, 18 Jun 2026)
Changed paths:
M Source/WebCore/dom/UserGestureIndicator.cpp
M Source/WebCore/dom/UserGestureIndicator.h
M Source/WebCore/page/LocalDOMWindow.cpp
M Source/WebCore/page/LocalDOMWindow.h
M Source/WebCore/page/RemoteDOMWindow.cpp
M Source/WebCore/page/RemoteDOMWindow.h
M Source/WebCore/page/RemoteFrameClient.h
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
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 Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
Log Message:
-----------
RemoteDOMWindow::postMessage should forward user gesture like
LocalDOMWindow::postMessage does
https://bugs.webkit.org/show_bug.cgi?id=317283
rdar://171098105
Reviewed by Wenson Hsieh.
The intent of this PR is simple: When JS posts a message during a user gesture,
the user gesture
indicator still says a user gesture is happening when the message is received.
Until site isolation,
this was done by just capturing the token from
UserGestureIndicator::currentUserGesture in
LocalDOMWindow::processPostMessage. With site isolation, however, we need to
serialize information
about the user gesture across IPC to a different process, reconstruct the user
gesture, then have it
active when the message is received.
A small amount of cleanup was helpful in making a UserGestureToken
serializable. First, the fix to
rdar://173355201 was upstreamed 3 times, and it's only needed once. I needed
to make a way to construct
a UserGestureToken with the expiration time from the other process. With
rdar://173355201 we limited
the total time a UserGestureToken can be valid to 1 second, so to prevent
postMessage across site isolated
iframes from being able to be used to bypass that protection, we send the start
time with the other data.
I also removed the default parameters from UserGestureToken::create because it
is only called once
and it is called with all parameters specified.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
* Source/WebCore/dom/UserGestureIndicator.cpp:
(WebCore::UserGestureToken::UserGestureToken):
(WebCore::UserGestureToken::create):
(WebCore::UserGestureIndicator::UserGestureIndicator):
* Source/WebCore/dom/UserGestureIndicator.h:
(WebCore::UserGestureTokenData::hasExpired const):
(WebCore::UserGestureToken::isProcessingUserGesture const):
(WebCore::UserGestureToken::processingUserGesture const):
(WebCore::UserGestureToken::processingUserGestureForMedia const):
(WebCore::UserGestureToken::gestureType const):
(WebCore::UserGestureToken::domPasteAccessPolicy const):
(WebCore::UserGestureToken::didRequestDOMPasteAccess):
(WebCore::UserGestureToken::resetDOMPasteAccess):
(WebCore::UserGestureToken::setScope):
(WebCore::UserGestureToken::resetScope):
(WebCore::UserGestureToken::scope const):
(WebCore::UserGestureToken::hasExpired const):
(WebCore::UserGestureToken::startTime const):
(WebCore::UserGestureToken::authorizationToken const):
(WebCore::UserGestureToken::canRequestDOMPaste const):
(WebCore::UserGestureToken::data const):
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::processPostMessage):
(WebCore::LocalDOMWindow::postMessageFromRemoteFrame):
* Source/WebCore/page/LocalDOMWindow.h:
* Source/WebCore/page/RemoteDOMWindow.cpp:
(WebCore::RemoteDOMWindow::postMessage):
* Source/WebCore/page/RemoteDOMWindow.h:
* Source/WebCore/page/RemoteFrameClient.h:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::postMessageToRemote):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::postMessageToRemote):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::remotePostMessage):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, UserGesture)):
Canonical link: https://commits.webkit.org/315499@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications