Chromium Code Reviews| Index: Source/bindings/templates/methods.cpp |
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp |
| index 3a63b52cd350694b59b8f23901b866de5b12a4b3..007f85797b81f940ea64697f8ee838264283f172 100644 |
| --- a/Source/bindings/templates/methods.cpp |
| +++ b/Source/bindings/templates/methods.cpp |
| @@ -94,12 +94,21 @@ if (UNLIKELY(info.Length() <= {{argument.index}})) { |
| {% endif %} |
| {% if argument.has_type_checking_interface %} |
| {# Type checking for wrapper interface types (if interface not implemented, |
| - throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| + throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefinedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasInstance(info[{{argument.index}}], info.GetIsolate())) { |
| {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
| (argument.index + 1, argument.idl_type)) | indent}} |
| return; |
| } |
| +{% elif argument.has_type_checking_unrestricted %} |
| +{# Type checking for non-finite floating point values (if NaN, +Infinity or |
| + −Infinity, throw TypeError), per http://heycam.github.io/webidl/#es-float |
| + and http://heycam.github.io/webidl/#es-double #} |
| +if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefinedOrNull(info[{{argument.index}}]) && {% endif %}WTF::double_conversion::Double(info[{{argument.index}}]->NumberValue()).IsSpecial()) { |
|
Nils Barth (inactive)
2014/04/28 09:16:14
This would be much slicker (and faster) as:
info[{
|
| + {{throw_type_error(method, '"%s parameter %s is non-finite."' % |
| + (argument.idl_type, argument.index + 1)) | indent}} |
| + return; |
| +} |
| {% endif %} |
| {% if argument.is_callback_interface %} |
| {# FIXME: remove EventListener special case #} |