Chromium Code Reviews| Index: Source/bindings/templates/dictionary_v8.cpp |
| diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp |
| index 82c6e9accf1d60a42ae7ed24b8c2baf9d2235c02..ca12139b8718deaf49a6dad3e39515d051c26cfe 100644 |
| --- a/Source/bindings/templates/dictionary_v8.cpp |
| +++ b/Source/bindings/templates/dictionary_v8.cpp |
| @@ -13,7 +13,7 @@ |
| namespace blink { |
| -{{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value) |
| +{{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, ExceptionState& exceptionState) |
|
Jens Widell
2014/09/10 06:20:15
This sort of conflicts with where I was going with
bashi
2014/09/10 07:21:04
Thank you for the heads up. That's a fantastic pla
Jens Widell
2014/09/10 08:31:11
Yes, absolutely.
|
| { |
| {{cpp_class}}* impl = {{cpp_class}}::create(); |
| // FIXME: Do not use Dictionary and DictionaryHelper |
| @@ -21,8 +21,17 @@ namespace blink { |
| Dictionary dictionary(v8Value, isolate); |
| {% for member in members %} |
| {{member.cpp_type}} {{member.name}}; |
| - if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name}}", {{member.name}})) |
| + if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name}}", {{member.name}})) { |
| + {% if member.enum_validation_expression %} |
| + String string = {{member.name}}; |
| + if ({{member.enum_validation_expression}}) |
|
Jens Widell
2014/09/10 06:20:15
Rephrase this as
if (!{{member.enum_validation_
bashi
2014/09/10 07:21:04
Great suggestion! Done.
|
| + impl->{{member.setter_name}}({{member.name}}); |
| + else |
| + exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
| + {% else %} |
| impl->{{member.setter_name}}({{member.name}}); |
| + {% endif %} |
| + } |
| {% endfor %} |
| return impl; |
| } |