Closed Bug 2022910 Opened 25 days ago Closed 12 days ago

[puppeteer] Specifying only "altitudeAngle" for synthesized touch event causes a NS_ERROR_ILLEGAL_VALUE error

Categories

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

defect
Points:
1

Tracking

(firefox151 fixed)

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

()

Details

(Whiteboard: [webdriver:m19])

Attachments

(1 file)

Platform support for both of these parameters was added on bug 2013990. When adding support for them to WebDriver I noticed that some Puppeteer tests are failing with the following error when only one of both parameters is set:

https://treeherder.mozilla.org/logviewer?job_id=553282871&repo=try&task=FAzPqr8USaeE0MgQ2LG_jQ.0&lineNumber=30971-30986

[task 2026-03-12T16:25:01.875+00:00] PID 336 | 1773332701875	RemoteAgent	DEBUG	WebDriverBiDiConnection 73b48b0c-1e44-4ff5-8016-c2605e723d92 -> {"id":3336,"method":"input.performActions","params":{"context":"b9176558-29c0-49b2-a481-1da72b8e18fe","actions":[{"type":"pointer","id":"__puppeteer_finger_1","parameters":{"pointerType":"touch"},"actions":[{"type":"pointerMove","x":105,"y":75},{"width":1,"height":1,"pressure":0.5,"altitudeAngle":1.5707963267948966,"type":"pointerDown","button":0}]}]}}
[task 2026-03-12T16:25:01.875+00:00] PID 336 | 1773332701875	RemoteAgent	TRACE	Received command input.performActions for destination ROOT
[task 2026-03-12T16:25:01.875+00:00] PID 336 | 1773332701875	RemoteAgent	TRACE	Dispatching tick 1/2
[task 2026-03-12T16:25:01.875+00:00] PID 336 | 1773332701875	RemoteAgent	DEBUG	Grouping action pointer __puppeteer_finger_1 pointerMove
[task 2026-03-12T16:25:01.875+00:00] PID 336 | 1773332701875	RemoteAgent	TRACE	Dispatch PointerMoveTouchActionGroup with 
[task 2026-03-12T16:25:01.876+00:00] PID 336 | 1773332701875	RemoteAgent	TRACE	Received command input._assertInViewPort for destination WINDOW_GLOBAL
[task 2026-03-12T16:25:01.878+00:00] PID 336 | 1773332701878	RemoteAgent	TRACE	moveOverTime start: 0,0 target: 105,75 duration: 0
[task 2026-03-12T16:25:01.879+00:00] PID 336 | 1773332701879	RemoteAgent	TRACE	Received command input._dispatchEvent for destination WINDOW_GLOBAL
[task 2026-03-12T16:25:01.884+00:00] PID 336 | 1773332701883	RemoteAgent	TRACE	Dispatching tick 2/2
[task 2026-03-12T16:25:01.884+00:00] PID 336 | 1773332701883	RemoteAgent	DEBUG	Grouping action pointer __puppeteer_finger_1 pointerDown
[task 2026-03-12T16:25:01.884+00:00] PID 336 | 1773332701883	RemoteAgent	TRACE	Dispatch PointerDownTouchActionGroup with __puppeteer_finger_1
[task 2026-03-12T16:25:01.884+00:00] PID 336 | 1773332701884	RemoteAgent	TRACE	Received command input._dispatchEvent for destination WINDOW_GLOBAL
[task 2026-03-12T16:25:01.884+00:00] PID 336 | 1773332701884	RemoteAgent	DEBUG	WebDriverBiDiConnection 73b48b0c-1e44-4ff5-8016-c2605e723d92 <- {"type":"error","id":3336,"error":"unknown error","message":"[Exception... \"(null)\"  nsresult: \"0x80070057 (NS_ERROR_ILLEGAL_VALUE)\"  location: \"JS frame :: chrome://remote/content/external/EventUtils.js :: synthesizeTouchAtPoint :: line 1082\"  data: no]","stacktrace":"synthesizeTouchAtPoint@chrome://remote/content/external/EventUtils.js:1082:35\nevent.synthesizeMultiTouch@chrome://remote/cont ... eiveMessage@chrome://remote/content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameChild.sys.mjs:78:37\n"}
[task 2026-03-12T16:25:01.894+00:00] TEST-UNEXPECTED-FAIL | ElementHandle specs ElementHandle.touchStart should work (elementhandle.spec.js) | expected PASS
[task 2026-03-12T16:25:01.894+00:00] TEST-INFO took 307ms
[task 2026-03-12T16:25:01.894+00:00] PID 336 | ["fail",{"title":"should work","fullTitle":"ElementHandle specs ElementHandle.touchStart should work","file":"/builds/worker/checkouts/gecko/remote/test/puppeteer/test/build/elementhandle.spec.js","duration":298,"currentRetry":0,"err":"Protocol error (input.performActions): unknown error [Exception... \"(null)\"  nsresult: \"0x80070057 (NS_ERROR_ILLEGAL_VALUE)\"  location: \"JS frame :: chrome://remote/content/external/EventUtils.js :: synthesizeTouchAtPoint :: line 1082\"  data: no] synthesizeTouchAtPoint@chrome://remote/content/external/EventUtils.js:1082:35\nevent.synthesizeMultiTouch@chrome://remote/content/shared/webdriver/Event.sys.mjs:156:23\n_dispatchEvent@chrome://remote/content/webdriver-bidi/modules/windowglobal/input.sys.mjs:242:22\nhandleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:285:33\nreceiveMessage@chrome://remote/content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameChild.sys.mjs:78:37\n","stack":"ProtocolError: Protocol error (input.performActions): unknown error [Exception... \"(null)\"  nsresult: \"0x80070057 (NS_ERROR_ILLEGAL_VALUE)\"  location: \"JS frame :: chrome://remote/content/external/EventUtils.js :: synthesizeTouchAtPoint :: line 1082\"  data: no] synthesizeTouchAtPoint@chrome://remote/content/external/EventUtils.js:1082:35\nevent.synthesizeMultiTouch@chrome://remote/content/shared/webdriver/Event.sys.mjs:156:23\n_dispatchEvent@chrome://remote/content/webdriver-bidi/modules/windowglobal/input.sys.mjs:242:22\nhandleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:285:33\nreceiveMessage@chrome://remote/content/shared/messagehandler/transports/js-window-actors/MessageHandlerFrameChild.sys.mjs:78:37\n\n    at Callback.<instance_members_initializer> (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/common/CallbackRegistry.ts:129:12)\n    at new Callback (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/common/CallbackRegistry.ts:134:3)\n    at CallbackRegistry.create (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/common/CallbackRegistry.ts:32:22)\n    at BidiConnection.send (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/bidi/Connection.ts:128:28)\n    at Session.send (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/bidi/core/Session.ts:111:34)\n    at Session.<anonymous> (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/util/decorators.ts:63:21)\n    at BrowsingContext.performActions (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/bidi/core/BrowsingContext.ts:516:25)\n    at BrowsingContext.<anonymous> (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/util/decorators.ts:63:21)\n    at BidiTouchHandle.start (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/bidi/Input.ts:647:50)\n    at BidiTouchscreen.touchStart (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/bidi/Input.ts:738:17)\n    at BidiElementHandle.touchStart (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/api/ElementHandle.ts:1060:48)\n    at BidiElementHandle.<anonymous> (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/packages/puppeteer-core/src/api/ElementHandle.ts:149:20)\n    at Context.<anonymous> (file:///builds/worker/checkouts/gecko/remote/test/puppeteer/test/src/elementhandle.spec.ts:433:7)"}]

It can easily be reproduced by calling this platform API directly via EventUtils.js. Given that both parameters have default values as defined in the pointerevents specification, we should use such default value instead of bailing out.

Edgar, would that make sense?

Flags: needinfo?(echen)

I guess it is from https://searchfox.org/firefox-main/rev/a86d8293217bbdc69abd541c9c7f8a4c6e227a8c/remote/test/puppeteer/packages/puppeteer-core/src/bidi/Input.ts#735.

Hmm, I think it is weird that only altitudeAngle is specified, it should always come with azimuthAngle in pair from system.
I look other place that specified altitudeAngle , most of them also specify azimuthAngle, e.g. https://searchfox.org/firefox-main/search?q=altitudeAngle%3A+&path=remote%2Ftest%2Fpuppeteer&case=false&regexp=false.
Would it make sense that always specify them together which also matches with system behavior? Or maybe just leave them all undefined let platform to handle the default value if the test isn’t meant to verify the synthesized values?

Flags: needinfo?(echen) → needinfo?(hskupin)

Edgar, I think that should work for Puppeteer but I would have to ask the maintainers first - maybe there is some reasoning for that.

As such a question to you for now. I do not see in the pointer-events specification that there is a requirement that both properties need to be specified. Given that there is a default value for both of them, should we fallback to that one instead of having an assertion?

Flags: needinfo?(hskupin) → needinfo?(echen)

The default value is used when

For hardware and platforms that do not report tilt or angle, the value MUST be 0"

per https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle. My interpretation of the spec is that the default value is used when all angle and tilt values are missing. And also https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle says

Depending on the specific hardware and platform, user agents will likely only receive one set of values for the transducer orientation relative to the screen plane — either tiltX / tiltY or altitudeAngle / azimuthAngle.

that also indicate the value should be shown in pair, which also make sense, otherwise we are in the situation that the angle is partially support, which I don't think it is a realistic case.

Flags: needinfo?(echen)

(In reply to Edgar Chen [:edgar] from comment #4)

Depending on the specific hardware and platform, user agents will likely only receive one set of values for the transducer orientation relative to the screen plane — either tiltX / tiltY or altitudeAngle / azimuthAngle.

that also indicate the value should be shown in pair, which also make sense, otherwise we are in the situation that the angle is partially support, which I don't think it is a realistic case.

Ok, that makes sense. Thank you for the details. Let me propose the change to Puppeteer which seems to work pretty fine at least with Firefox:
https://treeherder.mozilla.org/jobs?repo=try&revision=cb63cddee7a1606dea6a89cd25ec0c3822b28ec1

Moving back the bug to Remote Protocol which is closer to Puppeteer. I've created an upstream PR at https://github.com/puppeteer/puppeteer/pull/14781 and it works well for Chrome as well. So lets see if it is getting accepted. If yes, I'll provide a patch for our copy of Puppeteer as well.

Component: DOM: Events → WebDriver BiDi
Product: Core → Remote Protocol
Summary: Specifying only altitudeAngle or azimuthAngle for synthesized touch event causes a NS_ERROR_ILLEGAL_VALUE error → [puppeteer[ Specifying only "altitudeAngle" for synthesized touch event causes a NS_ERROR_ILLEGAL_VALUE error
Summary: [puppeteer[ Specifying only "altitudeAngle" for synthesized touch event causes a NS_ERROR_ILLEGAL_VALUE error → [puppeteer] Specifying only "altitudeAngle" for synthesized touch event causes a NS_ERROR_ILLEGAL_VALUE error

The upstream PR got accepted and is merged now. I'll provide a patch for our vendored copy to move forward with bug 2022644.

The upstream PR got accepted and is merged now. I'll provide a patch for our vendored copy to move forward with bug 2022644.

Points: --- → 1
Priority: -- → P3
Whiteboard: [webdriver:m19]

Patch is up on Phabricator but there is a bug so it's not getting attached to the bug: https://phabricator.services.mozilla.com/D289193

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b6fac9f0c9c2 https://hg.mozilla.org/integration/autoland/rev/ec7717ebd9a0 [puppeteer] Without "azimuthAngle" the "altitudeAngle" should no be specified. r=jdescottes

Backed out for causing puppeteer failures

Flags: needinfo?(hskupin)

The patch is fine but we need a fix for generating the puppeteer artifact that the job is fetching. Work for this is done on bug 2025846.

Depends on: 2025846
Flags: needinfo?(hskupin)
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/44298ab8f981 https://hg.mozilla.org/integration/autoland/rev/4d887f824478 [puppeteer] Without "azimuthAngle" the "altitudeAngle" should no be specified. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: