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

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

Issue 860353002: IDL: Add toRestricted{Float,Double}() helpers to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add FIXME comment Created 5 years, 11 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 {##############################################################################} 1 {##############################################################################}
2 {% macro attribute_getter(attribute, world_suffix) %} 2 {% macro attribute_getter(attribute, world_suffix) %}
3 {% filter conditional(attribute.conditional_string) %} 3 {% filter conditional(attribute.conditional_string) %}
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
5 {%- if attribute.is_expose_js_accessors %} 5 {%- if attribute.is_expose_js_accessors %}
6 const v8::FunctionCallbackInfo<v8::Value>& info 6 const v8::FunctionCallbackInfo<v8::Value>& info
7 {%- else %} 7 {%- else %}
8 const v8::PropertyCallbackInfo<v8::Value>& info 8 const v8::PropertyCallbackInfo<v8::Value>& info
9 {%- endif %}) 9 {%- endif %})
10 { 10 {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return; 234 return;
235 {% endif %} 235 {% endif %}
236 {# Convert JS value to C++ value #} 236 {# Convert JS value to C++ value #}
237 {% if attribute.idl_type != 'EventHandler' %} 237 {% if attribute.idl_type != 'EventHandler' %}
238 {{attribute.v8_value_to_local_cpp_value}}; 238 {{attribute.v8_value_to_local_cpp_value}};
239 {% elif not is_node %}{# EventHandler hack #} 239 {% elif not is_node %}{# EventHandler hack #}
240 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); 240 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex);
241 {% endif %} 241 {% endif %}
242 {# Type checking, possibly throw a TypeError, per: 242 {# Type checking, possibly throw a TypeError, per:
243 http://www.w3.org/TR/WebIDL/#es-type-mapping #} 243 http://www.w3.org/TR/WebIDL/#es-type-mapping #}
244 {% if attribute.has_type_checking_unrestricted %} 244 {% if attribute.has_type_checking_interface %}
245 {# Non-finite floating point values (NaN, +Infinity or −Infinity), per:
246 http://heycam.github.io/webidl/#es-float
247 http://heycam.github.io/webidl/#es-double #}
248 if (!std::isfinite(cppValue)) {
249 exceptionState.throwTypeError("The provided {{attribute.idl_type}} value is non-finite.");
250 exceptionState.throwIfNeeded();
251 return;
252 }
253 {% elif attribute.has_type_checking_interface %}
254 {# Type checking for interface types (if interface not implemented, throw 245 {# Type checking for interface types (if interface not implemented, throw
255 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 246 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
256 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) { 247 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
257 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); 248 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'.");
258 exceptionState.throwIfNeeded(); 249 exceptionState.throwIfNeeded();
259 return; 250 return;
260 } 251 }
261 {% elif attribute.enum_validation_expression %} 252 {% elif attribute.enum_validation_expression %}
262 {# Setter ignores invalid enum values: 253 {# Setter ignores invalid enum values:
263 http://www.w3.org/TR/WebIDL/#idl-enums #} 254 http://www.w3.org/TR/WebIDL/#idl-enums #}
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 access_control, 423 access_control,
433 property_attribute, 424 property_attribute,
434 only_exposed_to_private_script, 425 only_exposed_to_private_script,
435 ] %} 426 ] %}
436 {% if not attribute.is_expose_js_accessors %} 427 {% if not attribute.is_expose_js_accessors %}
437 {% set attribute_configuration_list = attribute_configuration_list 428 {% set attribute_configuration_list = attribute_configuration_list
438 + [on_prototype] %} 429 + [on_prototype] %}
439 {% endif %} 430 {% endif %}
440 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 431 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
441 {%- endmacro %} 432 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698