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..149dd6589b9d1a4f11cdcb9fd809662056c37c80 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) |
{ |
{{cpp_class}}* impl = {{cpp_class}}::create(); |
// FIXME: Do not use Dictionary and DictionaryHelper |
@@ -21,8 +21,16 @@ 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}})) { |
+ exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
+ return NULL; |
+ } |
+ {% endif %} |
impl->{{member.setter_name}}({{member.name}}); |
+ } |
{% endfor %} |
return impl; |
} |