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

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

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 {##############################################################################} 117 {##############################################################################}
118 {% macro attribute_setter(attribute, world_suffix) %} 118 {% macro attribute_setter(attribute, world_suffix) %}
119 {% filter conditional(attribute.conditional_string) %} 119 {% filter conditional(attribute.conditional_string) %}
120 static void {{attribute.name}}AttributeSetter{{world_suffix}}( 120 static void {{attribute.name}}AttributeSetter{{world_suffix}}(
121 {%- if attribute.is_expose_js_accessors %} 121 {%- if attribute.is_expose_js_accessors %}
122 v8::Local<v8::Value> jsValue, const v8::FunctionCallbackInfo<v8::Value>& info 122 v8::Local<v8::Value> jsValue, const v8::FunctionCallbackInfo<v8::Value>& info
123 {%- else %} 123 {%- else %}
124 v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info 124 v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
125 {%- endif %}) 125 {%- endif %})
126 { 126 {
127 {% if attribute.is_setter_raises_exception or 127 {% if attribute.has_setter_exception_state %}
128 attribute.has_strict_type_checking %}
129 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 128 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
130 {% endif %} 129 {% endif %}
131 {% if attribute.has_strict_type_checking %} 130 {% if attribute.has_strict_type_checking %}
132 {# Type checking for interface types (if interface not implemented, throw 131 {# Type checking for interface types (if interface not implemented, throw
133 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 132 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
134 if (!isUndefinedOrNull(jsValue) && !V8{{attribute.idl_type}}::hasInstance(js Value, info.GetIsolate(), worldType(info.GetIsolate()))) { 133 if (!isUndefinedOrNull(jsValue) && !V8{{attribute.idl_type}}::hasInstance(js Value, info.GetIsolate(), worldType(info.GetIsolate()))) {
135 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); 134 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'.");
136 exceptionState.throwIfNeeded(); 135 exceptionState.throwIfNeeded();
137 return; 136 return;
138 } 137 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 {% endif %} 204 {% endif %}
206 {% if attribute.has_custom_setter %} 205 {% if attribute.has_custom_setter %}
207 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); 206 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info);
208 {% else %} 207 {% else %}
209 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info); 208 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info);
210 {% endif %} 209 {% endif %}
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 210 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
212 } 211 }
213 {% endfilter %} 212 {% endfilter %}
214 {% endmacro %} 213 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/tests/results/V8TestEventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698