| 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 #} |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 argument instead; see argument.is_variadic_wrapper_type code-path below. #} | 127 argument instead; see argument.is_variadic_wrapper_type code-path below. #} |
| 128 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi
nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI
nstance(info[{{argument.index}}], info.GetIsolate())) { | 128 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi
nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI
nstance(info[{{argument.index}}], info.GetIsolate())) { |
| 129 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 129 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
| 130 (argument.index + 1, argument.idl_type)) | indent
}} | 130 (argument.index + 1, argument.idl_type)) | indent
}} |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 {% endif %}{# argument.has_type_checking_interface #} | 133 {% endif %}{# argument.has_type_checking_interface #} |
| 134 {% if argument.is_callback_interface %} | 134 {% if argument.is_callback_interface %} |
| 135 {# FIXME: remove EventListener special case #} | 135 {# FIXME: remove EventListener special case #} |
| 136 {% if argument.idl_type == 'EventListener' %} | 136 {% if argument.idl_type == 'EventListener' %} |
| 137 {% if method.name == 'removeEventListener' %} | 137 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %} |
| 138 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); | 138 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); |
| 139 {% else %}{# method.name == 'addEventListener' #} | 139 {% else %}{# method.name == 'addEventListener' #} |
| 140 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); | 140 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i
nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); |
| 141 {% endif %}{# method.name #} | 141 {% endif %}{# method.name #} |
| 142 {% else %}{# argument.idl_type == 'EventListener' #} | 142 {% else %}{# argument.idl_type == 'EventListener' #} |
| 143 {# Callback functions must be functions: | 143 {# Callback functions must be functions: |
| 144 http://www.w3.org/TR/WebIDL/#es-callback-function #} | 144 http://www.w3.org/TR/WebIDL/#es-callback-function #} |
| 145 {% if argument.is_optional %} | 145 {% if argument.is_optional %} |
| 146 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { | 146 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { |
| 147 if (!info[{{argument.index}}]->IsFunction()) { | 147 if (!info[{{argument.index}}]->IsFunction()) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 {% if method.is_explicit_nullable %} | 274 {% if method.is_explicit_nullable %} |
| 275 if (result.isNull()) | 275 if (result.isNull()) |
| 276 v8SetReturnValueNull(info); | 276 v8SetReturnValueNull(info); |
| 277 else | 277 else |
| 278 {{v8_set_return_value}}; | 278 {{v8_set_return_value}}; |
| 279 {% else %} | 279 {% else %} |
| 280 {{v8_set_return_value}}; | 280 {{v8_set_return_value}}; |
| 281 {% endif %} | 281 {% endif %} |
| 282 {%- endif %}{# None for void #} | 282 {%- endif %}{# None for void #} |
| 283 {# Post-set #} | 283 {# Post-set #} |
| 284 {% if interface_name == 'EventTarget' and method.name in ('addEventListener', | 284 {% if interface_name in ('EventTarget', 'MediaQueryList') |
| 285 'removeEventListener')
%} | 285 and method.name in ('addEventListener', 'removeEventListener', 'addListener'
, 'removeListener') %} |
| 286 {% set hidden_dependency_action = 'addHiddenValueToArray' | 286 {% set hidden_dependency_action = 'addHiddenValueToArray' |
| 287 if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %} | 287 if method.name in ('addEventListener', 'addListener') else 'removeHiddenV
alueFromArray' %} |
| 288 {% set argument_index = '1' if interface_name == 'EventTarget' else '0' %} |
| 288 {# Length check needed to skip action on legacy calls without enough arguments. | 289 {# Length check needed to skip action on legacy calls without enough arguments. |
| 289 http://crbug.com/353484 #} | 290 http://crbug.com/353484 #} |
| 290 if (info.Length() >= 2 && listener && !impl->toNode()) | 291 if (info.Length() >= {{argument_index}} + 1 && listener && !impl->toNode()) |
| 291 {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventList
enerCacheIndex, info.GetIsolate()); | 292 {{hidden_dependency_action}}(info.Holder(), info[{{argument_index}}], {{v8_c
lass}}::eventListenerCacheIndex, info.GetIsolate()); |
| 292 {% endif %} | 293 {% endif %} |
| 293 {% endmacro %} | 294 {% endmacro %} |
| 294 | 295 |
| 295 | 296 |
| 296 {######################################} | 297 {######################################} |
| 297 {% macro union_type_method_call_and_set_return_value(method) %} | 298 {% macro union_type_method_call_and_set_return_value(method) %} |
| 298 {% for argument in method.union_arguments %} | 299 {% for argument in method.union_arguments %} |
| 299 {{argument.cpp_type}} {{argument.cpp_value}}{{argument.cpp_type_initializer}}; | 300 {{argument.cpp_type}} {{argument.cpp_value}}{{argument.cpp_type_initializer}}; |
| 300 {% endfor %} | 301 {% endfor %} |
| 301 {{method.cpp_value}}; | 302 {{method.cpp_value}}; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 if method.is_per_world_bindings else '0' %} | 647 if method.is_per_world_bindings else '0' %} |
| 647 {% set property_attribute = | 648 {% set property_attribute = |
| 648 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 649 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
| 649 if method.property_attributes else 'v8::None' %} | 650 if method.property_attributes else 'v8::None' %} |
| 650 {% 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' %} |
| 651 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 652 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
| 652 "{{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}}, |
| 653 }; | 654 }; |
| 654 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); |
| 655 {%- endmacro %} | 656 {%- endmacro %} |
| OLD | NEW |