[webkit-changes] [WebKit/WebKit] df336e: [user-activation] Fix html/user-activation/activat...

Abrar Rahman Protyasha noreply at github.com
Fri Sep 22 10:36:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: df336e8effd7fddd4eb92084af4aab17bfb84ba9
      https://github.com/WebKit/WebKit/commit/df336e8effd7fddd4eb92084af4aab17bfb84ba9
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2023-09-22 (Fri, 22 Sep 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-pointerevent.html
    M Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp

  Log Message:
  -----------
  [user-activation] Fix html/user-activation/activation-trigger-pointerevent.html WPT
https://bugs.webkit.org/show_bug.cgi?id=259028
rdar://111970701

Reviewed by Tim Nguyen.

This patch resolves two distinct issues resulting in our passing of the
html/user-activation/activation-trigger-pointerevent WPT when run
through the WebDriver tooling.

1. The WPT in question uses the Fullscreen API as a proxy to both query
for and consume transient user activation. It does so because it wants
to make certain claims about which pointer events result in user
activation. The problem is that we instantiate a user gesture indicator
(hence granting transient user activation) on _any_ script evaluation in
`WebAutomationSession`, i.e. any JS code forces a user gesture when
evaluated as part of a WPT running through our WebDriver implementation.
This behavior was introduced in 198987 at main citing the Fullscreen API
_not working_ without this change.

2. As is, the WPT in question is nondeterministic because (a) it does not
wait on the promise returned by Actions.send() and (b) it sets up event
listeners after having fired off an action sequence, meaning it's
entirely likely that the event listener misses (some) events from the
action sequence.

We fix the former issue by dropping the forced user gesture on script
evaluation in WebAutomationSession. This is OK because we shouldn’t
implicitly grant user activation like this. Instead, we should follow WPT
best practices and invoke test_driver.bless() with our callbacks to
perform work requiring user activation. Some other tests even simply
create a button to click on before proceeding with their use of the
Fullscreen API, but at any rate are explicit about user activation.

We fix the latter issue by setting up the necessary event listeners
before firing an action sequence and correctly awaiting on the promise
returned by the Action interface.

* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-pointerevent.html:
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):

Canonical link: https://commits.webkit.org/268320@main




More information about the webkit-changes mailing list