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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2598353002: The second argument of add/removeEventListener should be an object, null, or undefined
Patch Set: Fix tests Created 3 years, 11 months 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 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) { 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) {
6 {% filter format_remove_duplicates([ 6 {% filter format_remove_duplicates([
7 'ExceptionState exceptionState', 7 'ExceptionState exceptionState',
8 'ScriptState* scriptState = ']) %} 8 'ScriptState* scriptState = ']) %}
9 {% set define_exception_state -%} 9 {% set define_exception_state -%}
10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}"); 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}");
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 {% else %} 144 {% else %}
145 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent(2)}} 145 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent(2)}}
146 {% endif %} 146 {% endif %}
147 return; 147 return;
148 } 148 }
149 {% endif %} 149 {% endif %}
150 {% if argument.is_callback_interface %} 150 {% if argument.is_callback_interface %}
151 {# FIXME: remove EventListener special case #} 151 {# FIXME: remove EventListener special case #}
152 {% if argument.idl_type == 'EventListener' %} 152 {% if argument.idl_type == 'EventListener' %}
153 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %} 153 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %}
154 {{argument.name}} = V8EventListenerHelper::getEventListener(ScriptState::current (info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); 154 {{argument.name}} = V8EventListenerHelper::getEventListener(ScriptState::current (info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly, exceptio nState);
155 {% else %}{# method.name == 'addEventListener' #} 155 {% else %}{# method.name == 'addEventListener' #}
156 {{argument.name}} = V8EventListenerHelper::getEventListener(ScriptState::current (info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); 156 {{argument.name}} = V8EventListenerHelper::getEventListener(ScriptState::current (info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate, exce ptionState);
157 {% endif %}{# method.name #} 157 {% endif %}{# method.name #}
158 {% else %}{# argument.idl_type == 'EventListener' #} 158 {% else %}{# argument.idl_type == 'EventListener' #}
159 {# Callback functions must be functions: 159 {# Callback functions must be functions:
160 http://www.w3.org/TR/WebIDL/#es-callback-function #} 160 http://www.w3.org/TR/WebIDL/#es-callback-function #}
161 {% if argument.is_optional %} 161 {% if argument.is_optional %}
162 if (!isUndefinedOrNull(info[{{argument.index}}])) { 162 if (!isUndefinedOrNull(info[{{argument.index}}])) {
163 if (!info[{{argument.index}}]->IsFunction()) { 163 if (!info[{{argument.index}}]->IsFunction()) {
164 {{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not a function.")}} 164 {{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not a function.")}}
165 return; 165 return;
166 } 166 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if method.overloads else 637 if method.overloads else
638 method.runtime_enabled_feature_name) %} 638 method.runtime_enabled_feature_name) %}
639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
641 {% endfilter %}{# runtime_enabled() #} 641 {% endfilter %}{# runtime_enabled() #}
642 {% endfilter %}{# exposed() #} 642 {% endfilter %}{# exposed() #}
643 {% endfilter %}{# secure_context() #} 643 {% endfilter %}{# secure_context() #}
644 {% endfor %} 644 {% endfor %}
645 {% endif %} 645 {% endif %}
646 {%- endmacro %} 646 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698