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

Unified Diff: Source/bindings/templates/methods.cpp

Issue 166593002: IDL compiler: sync Python to r166999 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reupload Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index def2f99083fc59a5877144db64ea2e29c93dcbab..c6eb5cf1ff99235b255b85baec627569df57fe8a 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -6,8 +6,12 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{% if method.has_exception_state %}
ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
{% endif %}
+ {% if method.name in ['addEventListener', 'removeEventListener',
+ 'dispatchEvent'] %}
+ {{add_event_listener_remove_event_listener_dispatch_event() | indent}}
+ {% endif %}
{% if method.name in ['addEventListener', 'removeEventListener'] %}
- {{add_remove_event_listener_method(method.name) | indent}}
+ {{add_event_listener_remove_event_listener_method(method.name) | indent}}
{% else %}
{% if method.number_of_required_arguments %}
if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) {
@@ -51,13 +55,9 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{######################################}
-{% macro add_remove_event_listener_method(method_name) %}
-{# Set template values for addEventListener vs. removeEventListener #}
-{% set listener_lookup_type, listener, hidden_dependency_action =
- ('ListenerFindOrCreate', 'listener', 'addHiddenValueToArray')
- if method_name == 'addEventListener' else
- ('ListenerFindOnly', 'listener.get()', 'removeHiddenValueFromArray')
-%}
+{% macro add_event_listener_remove_event_listener_dispatch_event() %}
+{# FIXME: Clean up: use the normal |imp| above,
+ use the existing shouldAllowAccessToFrame check if possible. #}
EventTarget* impl = {{v8_class}}::toNative(info.Holder());
if (DOMWindow* window = impl->toDOMWindow()) {
if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
@@ -67,6 +67,17 @@ if (DOMWindow* window = impl->toDOMWindow()) {
if (!window->document())
return;
}
+{% endmacro %}
+
+
+{######################################}
+{% macro add_event_listener_remove_event_listener_method(method_name) %}
+{# Set template values for addEventListener vs. removeEventListener #}
+{% set listener_lookup_type, listener, hidden_dependency_action =
+ ('ListenerFindOrCreate', 'listener', 'addHiddenValueToArray')
+ if method_name == 'addEventListener' else
+ ('ListenerFindOnly', 'listener.get()', 'removeHiddenValueFromArray')
+%}
RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[1], false, {{listener_lookup_type}});
if (listener) {
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, eventName, info[0]);
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698