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

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: Rebased onto df9a982fbe97 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.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if method.name in ['addEventListener', 'removeEventListener'] %} 6 {% if method.name in ['addEventListener', 'removeEventListener'] %}
7 {{add_remove_event_listener_method(method.name) | indent}} 7 {{add_remove_event_listener_method(method.name) | indent}}
8 {% else %} 8 {% else %}
9 {% if method.number_of_required_arguments %} 9 {% if method.number_of_required_arguments %}
10 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { 10 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) {
11 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{ interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ ired_arguments}}, info.Length())), info.GetIsolate()); 11 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{ interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ ired_arguments}}, info.Length())), info.GetIsolate());
12 return; 12 return;
13 } 13 }
14 {% endif %} 14 {% endif %}
15 {% if not method.is_static %} 15 {% if not method.is_static %}
16 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 16 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
17 {% endif %} 17 {% endif %}
18 {% if method.is_custom_element_callbacks %} 18 {% if method.is_custom_element_callbacks %}
19 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 19 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
20 {% endif %} 20 {% endif %}
21 {% if method.is_raises_exception %} 21 {% if method.is_raises_exception %}
22 ExceptionState exceptionState(info.GetIsolate()); 22 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
23 {% endif %} 23 {% endif %}
24 {% if method.is_check_security_for_node %} 24 {% if method.is_check_security_for_node %}
25 if (!BindingSecurity::shouldAllowAccessToNode(imp->{{method.name}}(exception State), exceptionState)) { 25 if (!BindingSecurity::shouldAllowAccessToNode(imp->{{method.name}}(exception State), exceptionState)) {
26 v8SetReturnValueNull(info); 26 v8SetReturnValueNull(info);
27 exceptionState.throwIfNeeded(); 27 exceptionState.throwIfNeeded();
28 return; 28 return;
29 } 29 }
30 {% endif %} 30 {% endif %}
31 {% for argument in method.arguments %} 31 {% for argument in method.arguments %}
32 {% if argument.is_optional and not argument.has_default and 32 {% if argument.is_optional and not argument.has_default and
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 {% endif %} 202 {% endif %}
203 {% if method.is_custom %} 203 {% if method.is_custom %}
204 {{v8_class_name}}::{{method.name}}MethodCustom(info); 204 {{v8_class_name}}::{{method.name}}MethodCustom(info);
205 {% else %} 205 {% else %}
206 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info); 206 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info);
207 {% endif %} 207 {% endif %}
208 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 208 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
209 } 209 }
210 {% endfilter %} 210 {% endfilter %}
211 {% endmacro %} 211 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/tests/results/V8SupportTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698