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

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

Issue 26785002: IDL compiler: [GetterRaisesException], [RaisesException] for getter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro attribute_getter(attribute) %} 2 {% macro attribute_getter(attribute) %}
3 {% filter conditional(attribute.conditional_string) %} 3 {% filter conditional(attribute.conditional_string) %}
4 static void {{attribute.name}}AttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 4 static void {{attribute.name}}AttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if attribute.cached_attribute_validation_method %} 6 {% if attribute.cached_attribute_validation_method %}
7 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("{{attribute.nam e}}"); 7 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("{{attribute.nam e}}");
8 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 8 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
9 if (!imp->{{attribute.cached_attribute_validation_method}}()) { 9 if (!imp->{{attribute.cached_attribute_validation_method}}()) {
10 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName ); 10 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName );
(...skipping 11 matching lines...) Expand all
22 {# Special cases #} 22 {# Special cases #}
23 {% if attribute.is_check_security_for_node %} 23 {% if attribute.is_check_security_for_node %}
24 {# FIXME: consider using a local variable to not call getter twice #} 24 {# FIXME: consider using a local variable to not call getter twice #}
25 ExceptionState es(info.GetIsolate()); 25 ExceptionState es(info.GetIsolate());
26 if (!BindingSecurity::shouldAllowAccessToNode({{attribute.cpp_value}}, es)) { 26 if (!BindingSecurity::shouldAllowAccessToNode({{attribute.cpp_value}}, es)) {
27 v8SetReturnValueNull(info); 27 v8SetReturnValueNull(info);
28 es.throwIfNeeded(); 28 es.throwIfNeeded();
29 return; 29 return;
30 } 30 }
31 {% endif %} 31 {% endif %}
32 {% if attribute.is_getter_raises_exception %}
33 ExceptionState es(info.GetIsolate());
34 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi nal}};
35 if (UNLIKELY(es.throwIfNeeded()))
36 return;
37 {% endif %}
32 {% if attribute.is_nullable %} 38 {% if attribute.is_nullable %}
33 bool isNull = false; 39 bool isNull = false;
34 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi nal}}; 40 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi nal}};
35 if (isNull) { 41 if (isNull) {
36 v8SetReturnValueNull(info); 42 v8SetReturnValueNull(info);
37 return; 43 return;
38 } 44 }
39 {% elif attribute.idl_type == 'EventHandler' or 45 {% elif attribute.idl_type == 'EventHandler' or
40 attribute.cached_attribute_validation_method %} 46 attribute.cached_attribute_validation_method %}
41 {# FIXME: consider merging all these assign to local variable statements #} 47 {# FIXME: consider merging all these assign to local variable statements #}
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 {% endif %} 84 {% endif %}
79 {% if attribute.is_custom_getter %} 85 {% if attribute.is_custom_getter %}
80 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info); 86 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info);
81 {% else %} 87 {% else %}
82 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter(name, info); 88 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter(name, info);
83 {% endif %} 89 {% endif %}
84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 90 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
85 } 91 }
86 {% endfilter %} 92 {% endfilter %}
87 {% endmacro %} 93 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698