IDL: Add toRestricted{Float,Double}() helpers to V8Binding.h

These implement conversion from V8 value to a float/double C++ that throws
a TypeError if the numeric value is NaN or infinite. This is how the IDL
types 'float' and 'double' should behave according to WebIDL, but in Blink
they currently only do if an interface/method/attribute has the extended
attribute [TypeChecking=Unrestricted].

This CL changes two observable things:

1) The error message changes from being specific to the method argument
   being converted ("double parameter N is non-finite"), to being generic
   ("The provided double value is non-finite").

2) 'float'/'double' members in union types go from being always
   unrestricted to always being restricted, which is correct per
   specification.

Since [TypeChecking=Unrestricted] wasn't supported either for dictionary
members or union type members, it was previously impossible to get the
correct behavior for these type conversions. An unrestricted conversion
for a union member can be achieved by declaring the member as 'unrestricted
float' or 'unrestricted double', also per specification. A restricted
conversion for a dictionary member can now be achieved by adding
[TypeChecking=Unrestricted] on the dictionary as a whole or on the member.

BUG=354298,450252

Review URL: https://codereview.chromium.org/860353002

git-svn-id: svn://svn.chromium.org/blink/trunk@188797 bbb929c8-8fbe-4397-9dbb-9b2b20218538
26 files changed
tree: a0311b6b7ddf158e1cd91fa7a067bbb793456100
  1. third_party/