| 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 | ||
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`. Looks like the latest version of UIEvents still has this as a long: https://w3c.github.io/uievents/#idl-mouseeventinit. (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. We are aligned with Firefox and the specification here. I don't think we should make this change for now. |
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.