Closed Bug 1910352 Opened 2 months ago Closed 2 months ago

input.Key{Down,Up}Action value should not accept multiple characters

Categories

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

Firefox 128
defect

Tracking

(firefox131 fixed)

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: martin, Assigned: jgraham)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m12][webdriver:external][wptsync upstream][webdriver:relnote])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Steps to reproduce:

I'm currently implementing the BiDi spec for our project and noticed a quirk wrt. input.perofrmActions() [1] with KeyDown/Up. The spec does not define what "value" can/should contain at all, so I filed [2] and got explained that it uses the same values as classical webdriver [3].

In the end that all works well with both Firefox and Chromium, but during my experiments I noticed that trying to send multiple characters in a single action like this:

actions=[
        {"type": "key", "id": "key-0", "actions": [
        {"type": "keyDown", "value": "a"},
        {"type": "keyUp", "value": "a"}
]}])

slightly misbehaves with Firefox.

[1] https://w3c.github.io/webdriver-bidi/#command-input-performActions
[2] https://github.com/w3c/webdriver-bidi/issues/757
[3] https://w3c.github.io/webdriver/#dfn-process-a-key-action

Actual results:

That action succeeds in Firefox, typing a literal "hello" into the website.

The webdriver spec [3] says:

If key is not a String containing a single unicode code point or grapheme cluster? return error with error code invalid argument.

So Firefox seems to ignore that part. This is not actually breaking anything that should work, just a quirk in the error handling.

Expected results:

In Chromium it fails as per the spec: bidi.WebdriverError: error: Invalid key value: hello

Component: Untriaged → WebDriver BiDi
Product: Firefox → Remote Protocol

I'm mildly surprised that the rest of the code works, but the frontend should probably handle this; see the TODO in https://searchfox.org/mozilla-central/source/remote/shared/webdriver/Actions.sys.mjs#769-772

I didn't try may code points, but I did try \uE007 aka "Enter", and that works fine with Firefox 128.

Return InvalidArgumentError if the action value for key actions is
not exactly one grapheme cluster long.

Supporting full grapheme clusters rather than just single codepoints
is marked as TODO in the spec, so add tentative tests for that.

Assignee: nobody → james
Status: NEW → ASSIGNED
Blocks: 1792089
Severity: -- → S3
Priority: -- → P2
Whiteboard: [webdriver:m12][webdriver:external]
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/b39c4bd4277c Ensure keyUp/keyDown value it one grapheme cluster, r=webdriver-reviewers,jdescottes
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/47508 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m12][webdriver:external] → [webdriver:m12][webdriver:external], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch
Upstream PR merged by moz-wptsync-bot
Whiteboard: [webdriver:m12][webdriver:external], [wptsync upstream] → [webdriver:m12][webdriver:external][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: