RESOLVED WONTFIX226725
MouseEvent.constructor misses checking if the param value is non-infinite or not
https://bugs.webkit.org/show_bug.cgi?id=226725
Summary MouseEvent.constructor misses checking if the param value is non-infinite or not
zyscoder@gmail.com
Reported 2021-06-07 04:47:08 PDT
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.
Attachments
zyscoder@gmail.com
Comment 1 2021-06-07 19:35:02 PDT
As 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`.
Sam Weinig
Comment 2 2021-06-08 11:57:05 PDT
Looks like the latest version of UIEvents still has this as a long: https://w3c.github.io/uievents/#idl-mouseeventinit.
Chris Dumez
Comment 3 2021-06-08 20:09:33 PDT
(In reply to Sam Weinig from comment #2) > Looks like the latest version of UIEvents still has this as a long: > > https://w3c.github.io/uievents/#idl-mouseeventinit. Indeed, we are matching the specification and Firefox. Maybe this a bug should be filed against Chrome? They are the only ones not aligned here.
Radar WebKit Bug Importer
Comment 4 2021-06-14 04:48:20 PDT
Chris Dumez
Comment 5 2021-06-16 10:59:38 PDT
We are aligned with Firefox and the specification here. I don't think we should make this change for now.
Note You need to log in before you can comment on or make changes to this bug.