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) | indent(8)}} | 13 {{throw_minimum_arity_type_error(method, method.number_of_required_argum
ents) | indent(8)}} |
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 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
22 {% endif %} | 22 {% endif %} |
23 {# Security checks #} | 23 {# Security checks #} |
24 {% if method.is_check_security_for_window %} | 24 {% if method.is_check_security_for_window %} |
25 if (LocalDOMWindow* window = impl->toDOMWindow()) { | 25 if (LocalDOMWindow* window = impl->toDOMWindow()) { |
26 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { | 26 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { |
27 {{throw_from_exception_state(method)}}; | 27 {{throw_from_exception_state(method)}}; |
28 return; | 28 return; |
29 } | 29 } |
30 if (!window->document()) | 30 if (!window->document()) |
31 return; | 31 return; |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 if method.is_per_world_bindings else '0' %} | 647 if method.is_per_world_bindings else '0' %} |
648 {% set property_attribute = | 648 {% set property_attribute = |
649 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 649 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
650 if method.property_attributes else 'v8::None' %} | 650 if method.property_attributes else 'v8::None' %} |
651 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} | 651 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} |
652 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 652 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
653 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, | 653 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, |
654 }; | 654 }; |
655 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 655 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
656 {%- endmacro %} | 656 {%- endmacro %} |
OLD | NEW |