PointerEvent.constructor misses checking the type of PointerEventInit.width param
Categories
(Core :: DOM: Events, defect)
Tracking
()
People
(Reporter: zyscoder, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Steps to reproduce:
(1) Open a tab and navigate to any URL;
(2) Run the following code in the Console of Devtools:
new PointerEvent('',{width:NaN});
(3) This code would be evaluated successfully without throwing any exceptions.
Actual results:
This code would be evaluated successfully without throwing any exceptions.
Expected results:
As https://w3c.github.io/pointerevents/#pointerevent-interface says, the width is of double type. Thus this code should throw an exception since we set the width param as NaN.
In my test, both Chrome and Webkit throw exceptions:
For Chrome: Uncaught TypeError: Failed to construct 'PointerEvent': The provided double value is non-finite.
For Webkit: TypeError: The provided value is non-finite
Comment 1•3 years ago
|
||
Thanks for filling this! I can also reproduce this on MacOS 10.15 on the latest Firefox versions. Moving it over to a component so developers can check it out.
Updated•2 years ago
|
Comment 2•2 years ago
|
||
I think it is because width
is a long
webidl type, which convert a NaN
to 0
in https://webidl.spec.whatwg.org/#abstract-opdef-converttoint, in Gecko. But it should be a double
, which throws a TypeError
for NaN
in https://webidl.spec.whatwg.org/#es-double, per spec.
Updated•2 years ago
|
Description
•