Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: Source/bindings/templates/attributes.cpp

Issue 955413002: Log in Binding code for invalid enum type. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} 1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_getter(attribute, world_suffix) %} 5 {% macro attribute_getter(attribute, world_suffix) %}
6 {% filter conditional(attribute.conditional_string) %} 6 {% filter conditional(attribute.conditional_string) %}
7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
8 {%- if attribute.is_expose_js_accessors %} 8 {%- if attribute.is_expose_js_accessors %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- else %} 10 {%- else %}
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 262 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
263 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) { 263 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
264 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); 264 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'.");
265 exceptionState.throwIfNeeded(); 265 exceptionState.throwIfNeeded();
266 return; 266 return;
267 } 267 }
268 {% elif attribute.enum_validation_expression %} 268 {% elif attribute.enum_validation_expression %}
269 {# Setter ignores invalid enum values: 269 {# Setter ignores invalid enum values:
270 http://www.w3.org/TR/WebIDL/#idl-enums #} 270 http://www.w3.org/TR/WebIDL/#idl-enums #}
271 String string = cppValue; 271 String string = cppValue;
272 if (!({{attribute.enum_validation_expression}})) 272 if (!({{attribute.enum_validation_expression}})) {
273 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMes sage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + stri ng + "' is not a valid value of type '{{attribute.idl_type}}'."));
273 return; 274 return;
275 }
274 {% endif %} 276 {% endif %}
275 {# Pre-set context #} 277 {# Pre-set context #}
276 {% if attribute.is_custom_element_callbacks or 278 {% if attribute.is_custom_element_callbacks or
277 (attribute.is_reflect and 279 (attribute.is_reflect and
278 not(attribute.idl_type == 'DOMString' and is_node)) %} 280 not(attribute.idl_type == 'DOMString' and is_node)) %}
279 {# Skip on compact node DOMString getters #} 281 {# Skip on compact node DOMString getters #}
280 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 282 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
281 {% endif %} 283 {% endif %}
282 {% if attribute.is_call_with_execution_context or 284 {% if attribute.is_call_with_execution_context or
283 attribute.is_setter_call_with_execution_context %} 285 attribute.is_setter_call_with_execution_context %}
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 access_control, 450 access_control,
449 property_attribute, 451 property_attribute,
450 only_exposed_to_private_script, 452 only_exposed_to_private_script,
451 ] %} 453 ] %}
452 {% if not attribute.is_expose_js_accessors %} 454 {% if not attribute.is_expose_js_accessors %}
453 {% set attribute_configuration_list = attribute_configuration_list 455 {% set attribute_configuration_list = attribute_configuration_list
454 + [on_prototype] %} 456 + [on_prototype] %}
455 {% endif %} 457 {% endif %}
456 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 458 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
457 {%- endmacro %} 459 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698