Closed Bug 2084107 Opened 1 month ago Closed 1 month ago

script.evaluate and script.callFunction with userActivation false clear existing user activation

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect
Points:
2

Tracking

(firefox161 fixed)

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

(Whiteboard: [webdriver:m22][wptsync upstream][webdriver:relnote])

Attachments

(2 external files)

The spec only runs the "activation notification" steps when userActivation is true. When it is false, nothing should happen, and existing transient activation should stay as it is:
https://w3c.github.io/webdriver-bidi/#command-script-callFunction
https://w3c.github.io/webdriver-bidi/#command-script-evaluate

In Firefox, the userActivationEnabled setter of WindowRealm in remote/shared/Realm.sys.mjs remembers the last value for the realm. When the value changes from true to false, it calls document.clearUserGestureActivation(). So a call with userActivation: false clears the activation of the document if the previous call in the same realm used userActivation: true. This also clears activation that came from a real user gesture, or from input actions, between the two calls.

Steps to reproduce:

  1. Send script.evaluate with expression: "1", userActivation: true and a context target.
  2. Send script.evaluate with expression: "navigator.userActivation.isActive", userActivation: false and the same target.

Expected: true, because the activation from step 1 is still active.
Actual: false.

The fix is probably to only call notifyUserGestureActivation() when userActivation is true, and never clear the activation.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/37ca8e540789 https://hg.mozilla.org/integration/autoland/rev/f605f61b5705 [bidi] Do not clear user activation when userActivation is false r=webdriver-reviewers,whimboo https://github.com/mozilla-firefox/firefox/commit/988533cc3a99 https://hg.mozilla.org/integration/autoland/rev/98f920f2b32b [wdspec] Add tests for userActivation not clearing existing activation r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
Severity: -- → S3
Points: --- → 2
Priority: -- → P3
Whiteboard: [webdriver:m22]

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/64275 for changes under testing/web-platform/tests

Whiteboard: [webdriver:m22] → [webdriver:m22], [wptsync upstream]

Upstream PR merged by moz-wptsync-bot

Whiteboard: [webdriver:m22], [wptsync upstream] → [webdriver:m22][wptsync upstream][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: