Index: Source/bindings/templates/dictionary_v8.cpp |
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp |
index c6b6d1343a7b3922a93e49f78d18884ee6347a01..d8322b6b266a00e4678f3529ea2b4cf5fe89f8a4 100644 |
--- a/Source/bindings/templates/dictionary_v8.cpp |
+++ b/Source/bindings/templates/dictionary_v8.cpp |
@@ -1,3 +1,4 @@ |
+{% from 'conversions.cpp' import declare_enum_validation_variable %} |
// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -62,10 +63,10 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ |
return; |
} |
{% endif %} |
- {% 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."); |
+ {% if member.enum_values %} |
+ {{declare_enum_validation_variable(member.enum_values) | indent(8)}} |
+ if (!isValidEnum({{member.name}}, validValues, WTF_ARRAY_LENGTH(validValues))) { |
+ exceptionState.throwTypeError("member {{member.name}} ('" + toCoreString(isolate, {{member.name}}Value) + "') is not a valid enum value."); |
return; |
} |
{% elif member.is_object %} |