Bug 226725

Summary: MouseEvent.constructor misses checking if the param value is non-infinite or not
Product: WebKit Reporter: zyscoder <zyscoder>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: cdumez, graouts, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Linux   

Description zyscoder@gmail.com 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.
Comment 1 zyscoder@gmail.com 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`.
Comment 2 Sam Weinig 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.
Comment 3 Chris Dumez 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.
Comment 4 Radar WebKit Bug Importer 2021-06-14 04:48:20 PDT
<rdar://problem/79282818>
Comment 5 Chris Dumez 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.