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

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

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}Method{{world_suffix}}(const v8::FunctionCallbackInfo <v8::Value>& info) 4 static void {{method.name}}Method{{world_suffix}}(const v8::FunctionCallbackInfo <v8::Value>& info)
5 { 5 {
6 {% if method.number_of_required_arguments %} 6 {% if method.number_of_required_arguments %}
7 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { 7 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) {
8 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{ interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ ired_arguments}}, info.Length())), info.GetIsolate()); 8 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{ interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ ired_arguments}}, info.Length())), info.GetIsolate());
9 return; 9 return;
10 } 10 }
11 {% endif %} 11 {% endif %}
12 {% if not method.is_static %} 12 {% if not method.is_static %}
13 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 13 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
14 {% endif %} 14 {% endif %}
15 {% if method.is_custom_element_callbacks %} 15 {% if method.is_custom_element_callbacks %}
16 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 16 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
17 {% endif %} 17 {% endif %}
18 {% if method.is_raises_exception %} 18 {% if method.is_raises_exception %}
19 ExceptionState es(info.GetIsolate()); 19 ExceptionState es(info.Holder(), info.GetIsolate());
20 {% endif %} 20 {% endif %}
21 {% if method.is_check_security_for_node %} 21 {% if method.is_check_security_for_node %}
22 if (!BindingSecurity::shouldAllowAccessToNode(imp->{{method.name}}(es), es)) { 22 if (!BindingSecurity::shouldAllowAccessToNode(imp->{{method.name}}(es), es)) {
23 v8SetReturnValueNull(info); 23 v8SetReturnValueNull(info);
24 es.throwIfNeeded(); 24 es.throwIfNeeded();
25 return; 25 return;
26 } 26 }
27 {% endif %} 27 {% endif %}
28 {% for argument in method.arguments %} 28 {% for argument in method.arguments %}
29 {% if argument.is_optional and not argument.has_default and 29 {% if argument.is_optional and not argument.has_default and
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 {% endif %} 149 {% endif %}
150 {% if method.is_custom %} 150 {% if method.is_custom %}
151 {{v8_class_name}}::{{method.name}}MethodCustom(info); 151 {{v8_class_name}}::{{method.name}}MethodCustom(info);
152 {% else %} 152 {% else %}
153 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info); 153 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info);
154 {% endif %} 154 {% endif %}
155 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 155 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
156 } 156 }
157 {% endfilter %} 157 {% endfilter %}
158 {% endmacro %} 158 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698