Index: Source/bindings/templates/attributes.cpp |
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp |
index bc3da71fedf5c3bfda2365053f4691e8627bb47d..0d6bac9a3aa4bbe048def64f608350a30824d11e 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, WTF_ARRAY_LENGTH(validValues))) { |
+ currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + toCoreString(info.GetIsolate(), v8Value) + "' is not a valid value of type '{{attribute.idl_type}}'.")); |
return; |
} |
{% endif %} |