RESOLVED LATER 101783
WebIDL: number type conversions should throw TypeError for Infinity and NaN
https://bugs.webkit.org/show_bug.cgi?id=101783
Summary WebIDL: number type conversions should throw TypeError for Infinity and NaN
Erik Arvidsson
Reported 2012-11-09 12:51:35 PST
When a JS value is supposed to be converted to one of the following IDL types byte octet short unsigned short long unsigned long long long unsigned long long float double we should throw a TypeError if the value is NaN or Infinity. The only ones that accept NaN are the "restricted float" and "restricted double" (which we are not using anywhere)
Attachments
WIP (3.44 KB, patch)
2012-11-09 13:37 PST, Erik Arvidsson
no flags
Joshua Bell
Comment 1 2012-11-09 13:12:55 PST
I linked this to https://bugs.webkit.org/show_bug.cgi?id=96798 which has at least part of this logic implemented, but is blocked on a V8 bug that is, in turn, blocked on a Chromium bug (which is getting worked on now). It's been a while since I looked at the patch so I'm not sure if I tackled all the 32/64/signed/unsigned permutations or just the subset I needed at the time. Feel free to steal some/all of the patch.
Joshua Bell
Comment 2 2012-11-09 13:15:06 PST
(In reply to comment #1) > I linked this to https://bugs.webkit.org/show_bug.cgi?id=96798 ... which is focused on [EnforceRange] specifically, not on NaNs/Infinities, but the conversion for all cases could use an overhaul.
Erik Arvidsson
Comment 3 2012-11-09 13:37:28 PST
Adam Barth
Comment 4 2012-11-09 13:48:42 PST
How does this affect performance?
Erik Arvidsson
Comment 5 2012-11-09 13:57:05 PST
(In reply to comment #4) > How does this affect performance? Adding more tests and branching is going to be unavoidable. Once this gets closer to complete I will have to do some perf tests. I expect some slow down, hopefully it will be small enough.
Ahmad Saleem
Comment 6 2022-09-03 04:33:39 PDT
rniwa@webkit.org - Is this needed because attached WIP seems to have v8 (JS engine of Chrome) specific bits I think? Is this needed in JSC? Thanks!
Ryosuke Niwa
Comment 7 2022-09-03 11:34:21 PDT
This is Later at this point.
Note You need to log in before you can comment on or make changes to this bug.