MouseEvent.constructor misses checking if the param value is non-infinite or not
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Tracking
()
People
(Reporter: zyscoder, Unassigned)
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 MouseEvent('',{screenX: NaN});
(3) This code would be evaluated successfully without any exceptions thrown.
Actual results:
This code would be evaluated successfully without any exceptions thrown.
Expected results:
In Chome, this code would throw an exception:Uncaught TypeError: Failed to construct 'MouseEvent': The provided double value is non-finite..
It seems reasonable to throw such an exception since the type of the screenX param is double.
Comment 1•4 years ago
|
||
screenX is a long in https://w3c.github.io/uievents/#dictdef-mouseeventinit and https://searchfox.org/mozilla-central/source/dom/webidl/MouseEvent.webidl#67. I suspect we follow the WebIDL spec correctly and Chrome is doing something wrong.
Updated•4 years ago
|
Here(https://docs.w3cub.com/dom/mouseevent/screenx) says screenX is A double floating point value. Early versions of the spec defined this as an integer referring to the number of pixels.. I'm not sure which one is correct.
Description
•