Bug 227146 - [WebIDL] Assigning a value outside the float range to a 'float' attribute should throw a TypeError
Summary: [WebIDL] Assigning a value outside the float range to a 'float' attribute sho...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://heycam.github.io/webidl/#es-f...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-17 14:44 PDT by Chris Dumez
Modified: 2021-06-21 15:07 PDT (History)
12 users (show)

See Also:


Attachments
Patch (12.00 KB, patch)
2021-06-17 14:47 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-06-17 14:44:27 PDT
Assigning a value outside the float range to a 'float' attribute should throw a TypeError, as per:
https://heycam.github.io/webidl/#es-float

Blink follows the specification but WebKit just casts the double to a float.
Comment 1 Chris Dumez 2021-06-17 14:47:52 PDT
Created attachment 431723 [details]
Patch
Comment 2 Sam Weinig 2021-06-17 20:37:24 PDT
We might want to fix the canvas IDLs still using float that should be double before doing this to avoid accidental fallout.
Comment 3 Cameron McCormack (:heycam) 2021-06-17 21:18:32 PDT
It looks like almost all uses of floats in our canvas IDLs are `unrestricted float`, which will at least saturate out of range Number values to +/-Infinity.
Comment 4 Chris Dumez 2021-06-17 22:25:56 PDT
(In reply to Cameron McCormack (:heycam) from comment #3)
> It looks like almost all uses of floats in our canvas IDLs are `unrestricted
> float`, which will at least saturate out of range Number values to
> +/-Infinity.

Right, the behavior change in this patch for unrestricted float is not large and a strict progression. I would be more concerned about APIs where we use (restricted) float instead of double.
Comment 5 Sam Weinig 2021-06-18 12:54:11 PDT
Fair (just trying to bully people into fixing that because I keep forgetting to).
Comment 6 EWS 2021-06-18 19:16:26 PDT
Committed r279047 (238967@main): <https://commits.webkit.org/238967@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431723 [details].
Comment 7 Radar WebKit Bug Importer 2021-06-18 19:17:30 PDT
<rdar://problem/79516533>