Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
| 11 {% if method.number_of_required_arguments and not method.overload_index %} | 11 {% if method.number_of_required_arguments and not method.overload_index %} |
| 12 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { | 12 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { |
| 13 {{throw_minimum_arity_type_error(method, method.number_of_required_argum ents)}}; | 13 {{throw_minimum_arity_type_error(method, method.number_of_required_argum ents)}}; |
| 14 return; | 14 return; |
| 15 } | 15 } |
| 16 {% endif %} | 16 {% endif %} |
| 17 {% if not method.is_static %} | 17 {% if not method.is_static %} |
| 18 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); | 18 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); |
| 19 {% endif %} | 19 {% endif %} |
| 20 {% if method.is_custom_element_callbacks %} | 20 {% if method.is_custom_element_callbacks %} |
| 21 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 21 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 22 {% endif %} | 22 {% endif %} |
| 23 {# Security checks #} | 23 {# Security checks #} |
| 24 {# FIXME: change to method.is_check_security_for_window #} | 24 {% if is_check_security_for_window %} |
|
haraken
2014/06/12 02:15:45
It doesn't make sense to introduce [CheckSecurity=
Nils Barth (inactive)
2014/06/12 02:51:52
It's slightly trickier:
EventTarget also has a !wi
| |
| 25 {% if interface_name == 'EventTarget' %} | |
| 26 if (DOMWindow* window = impl->toDOMWindow()) { | 25 if (DOMWindow* window = impl->toDOMWindow()) { |
| 27 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window ->frame(), exceptionState)) { | 26 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window ->frame(), exceptionState)) { |
| 28 {{throw_from_exception_state(method)}}; | 27 {{throw_from_exception_state(method)}}; |
| 29 return; | 28 return; |
| 30 } | 29 } |
| 31 if (!window->document()) | 30 if (!window->document()) |
| 32 return; | 31 return; |
| 33 } | 32 } |
| 34 {% elif method.is_check_security_for_frame %} | 33 {% elif method.is_check_security_for_frame %} |
| 35 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { | 34 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 {% endif %} | 552 {% endif %} |
| 554 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); | 553 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); |
| 555 {% if is_constructor_raises_exception %} | 554 {% if is_constructor_raises_exception %} |
| 556 if (exceptionState.throwIfNeeded()) | 555 if (exceptionState.throwIfNeeded()) |
| 557 return; | 556 return; |
| 558 {% endif %} | 557 {% endif %} |
| 559 | 558 |
| 560 {{generate_constructor_wrapper(constructor) | indent}} | 559 {{generate_constructor_wrapper(constructor) | indent}} |
| 561 } | 560 } |
| 562 {% endmacro %} | 561 {% endmacro %} |
| OLD | NEW |