Index: Source/bindings/templates/attributes.cpp |
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp |
index bc3da71fedf5c3bfda2365053f4691e8627bb47d..ea0249fbbc9c989d4131e687a6ed2b5b73ae5bf8 100644 |
--- a/Source/bindings/templates/attributes.cpp |
+++ b/Source/bindings/templates/attributes.cpp |
@@ -1,4 +1,4 @@ |
-{% from 'conversions.cpp' import v8_value_to_local_cpp_value %} |
+{% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_local_cpp_value %} |
{##############################################################################} |
@@ -330,12 +330,12 @@ v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
exceptionState.throwIfNeeded(); |
return; |
} |
- {% elif attribute.enum_validation_expression %} |
+ {% elif attribute.enum_values %} |
{# Setter ignores invalid enum values: |
http://www.w3.org/TR/WebIDL/#idl-enums #} |
- String string = cppValue; |
- if (!({{attribute.enum_validation_expression}})) { |
- currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + string + "' is not a valid value of type '{{attribute.idl_type}}'.")); |
+ {{declare_enum_validation_variable(attribute.enum_values) | indent}} |
+ if (!isValidEnum(cppValue, validValues, {{attribute.enum_values|length}})) { |
haraken
2015/03/31 06:11:16
Space around '|'?
|
+ currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value is not a valid value of type '{{attribute.idl_type}}'.")); |
return; |
} |
{% endif %} |