Chromium Code Reviews| Index: Source/bindings/templates/methods.cpp |
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp |
| index cf307e68859e6f8a5be32b7564636cd4045ddcad..1bfb7715bda502dfa8392b1d547eda6bda3532d1 100644 |
| --- a/Source/bindings/templates/methods.cpp |
| +++ b/Source/bindings/templates/methods.cpp |
| @@ -135,7 +135,7 @@ if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi |
| {% if argument.is_callback_interface %} |
| {# FIXME: remove EventListener special case #} |
| {% if argument.idl_type == 'EventListener' %} |
| -{% if method.name == 'removeEventListener' %} |
| +{% if method.name == 'removeEventListener' or method.name == 'removeListener' %} |
| {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); |
| {% else %}{# method.name == 'addEventListener' #} |
| {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); |
| @@ -282,14 +282,15 @@ else |
| {% endif %} |
| {%- endif %}{# None for void #} |
| {# Post-set #} |
| -{% if interface_name == 'EventTarget' and method.name in ('addEventListener', |
| - 'removeEventListener') %} |
| +{% if interface_name in ('EventTarget', 'MediaQueryList') |
| + and method.name in ('addEventListener', 'removeEventListener', 'addListener', 'removeListener') %} |
| {% set hidden_dependency_action = 'addHiddenValueToArray' |
| - if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %} |
| + if method.name in ('addEventListener', 'addListener') else 'removeHiddenValueFromArray' %} |
| +{% set argument_index = '1' if interface_name == 'EventTarget' else '0' %} |
| {# Length check needed to skip action on legacy calls without enough arguments. |
| http://crbug.com/353484 #} |
| if (info.Length() >= 2 && listener && !impl->toNode()) |
|
Jens Widell
2014/08/16 06:56:08
Should we adjust the "2" here to "argument_index+1
cbiesinger
2014/08/29 22:54:13
Done.
|
| - {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventListenerCacheIndex, info.GetIsolate()); |
| + {{hidden_dependency_action}}(info.Holder(), info[{{argument_index}}], {{v8_class}}::eventListenerCacheIndex, info.GetIsolate()); |
| {% endif %} |
| {% endmacro %} |