OLD | NEW |
1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_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 %} |
11 const v8::PropertyCallbackInfo<v8::Value>& info | 11 const v8::PropertyCallbackInfo<v8::Value>& info |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 {# Type checking, possibly throw a TypeError, per: | 323 {# Type checking, possibly throw a TypeError, per: |
324 http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 324 http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
325 {% if attribute.has_type_checking_interface %} | 325 {% if attribute.has_type_checking_interface %} |
326 {# Type checking for interface types (if interface not implemented, throw | 326 {# Type checking for interface types (if interface not implemented, throw |
327 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 327 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
328 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){%
endif %}) { | 328 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){%
endif %}) { |
329 exceptionState.throwTypeError("The provided value is not of type '{{attr
ibute.idl_type}}'."); | 329 exceptionState.throwTypeError("The provided value is not of type '{{attr
ibute.idl_type}}'."); |
330 exceptionState.throwIfNeeded(); | 330 exceptionState.throwIfNeeded(); |
331 return; | 331 return; |
332 } | 332 } |
333 {% elif attribute.enum_validation_expression %} | 333 {% elif attribute.enum_values %} |
334 {# Setter ignores invalid enum values: | 334 {# Setter ignores invalid enum values: |
335 http://www.w3.org/TR/WebIDL/#idl-enums #} | 335 http://www.w3.org/TR/WebIDL/#idl-enums #} |
336 String string = cppValue; | 336 {{declare_enum_validation_variable(attribute.enum_values) | indent}} |
337 if (!({{attribute.enum_validation_expression}})) { | 337 if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues))) { |
338 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMes
sage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + stri
ng + "' is not a valid value of type '{{attribute.idl_type}}'.")); | 338 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMes
sage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + toCo
reString(info.GetIsolate(), v8Value) + "' is not a valid value of type '{{attrib
ute.idl_type}}'.")); |
339 return; | 339 return; |
340 } | 340 } |
341 {% endif %} | 341 {% endif %} |
342 {# Pre-set context #} | 342 {# Pre-set context #} |
343 {% if attribute.is_custom_element_callbacks or | 343 {% if attribute.is_custom_element_callbacks or |
344 (attribute.is_reflect and | 344 (attribute.is_reflect and |
345 not(attribute.idl_type == 'DOMString' and is_node)) %} | 345 not(attribute.idl_type == 'DOMString' and is_node)) %} |
346 {# Skip on compact node DOMString getters #} | 346 {# Skip on compact node DOMString getters #} |
347 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 347 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
348 {% endif %} | 348 {% endif %} |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 access_control, | 515 access_control, |
516 property_attribute, | 516 property_attribute, |
517 only_exposed_to_private_script, | 517 only_exposed_to_private_script, |
518 ] %} | 518 ] %} |
519 {% if not attribute.is_expose_js_accessors %} | 519 {% if not attribute.is_expose_js_accessors %} |
520 {% set attribute_configuration_list = attribute_configuration_list | 520 {% set attribute_configuration_list = attribute_configuration_list |
521 + [on_prototype] %} | 521 + [on_prototype] %} |
522 {% endif %} | 522 {% endif %} |
523 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 523 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
524 {%- endmacro %} | 524 {%- endmacro %} |
OLD | NEW |