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

Side by Side Diff: Source/bindings/scripts/v8_methods.py

Issue 203603005: Explicitly mark first 2 args of addEventListener/removeEventListener as optional (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test result (addEventListener.length now 0, not 2) Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') 64 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState')
65 if is_call_with_script_state: 65 if is_call_with_script_state:
66 includes.add('bindings/v8/ScriptState.h') 66 includes.add('bindings/v8/ScriptState.h')
67 is_check_security_for_node = 'CheckSecurity' in extended_attributes 67 is_check_security_for_node = 'CheckSecurity' in extended_attributes
68 if is_check_security_for_node: 68 if is_check_security_for_node:
69 includes.add('bindings/v8/BindingSecurity.h') 69 includes.add('bindings/v8/BindingSecurity.h')
70 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s 70 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s
71 if is_custom_element_callbacks: 71 if is_custom_element_callbacks:
72 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') 72 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
73 73
74 has_event_listener_argument = any(
75 argument for argument in arguments
76 if argument.idl_type.name == 'EventListener')
74 is_check_security_for_frame = ( 77 is_check_security_for_frame = (
75 'CheckSecurity' in interface.extended_attributes and 78 'CheckSecurity' in interface.extended_attributes and
76 'DoNotCheckSecurity' not in extended_attributes) 79 'DoNotCheckSecurity' not in extended_attributes)
77 is_raises_exception = 'RaisesException' in extended_attributes 80 is_raises_exception = 'RaisesException' in extended_attributes
78 81
79 return { 82 return {
80 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] 83 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging]
81 'arguments': [generate_argument(interface, method, argument, index) 84 'arguments': [generate_argument(interface, method, argument, index)
82 for index, argument in enumerate(arguments)], 85 for index, argument in enumerate(arguments)],
83 'conditional_string': v8_utilities.conditional_string(method), 86 'conditional_string': v8_utilities.conditional_string(method),
84 'cpp_type': idl_type.cpp_type, 87 'cpp_type': idl_type.cpp_type,
85 'cpp_value': this_cpp_value, 88 'cpp_value': this_cpp_value,
86 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] 89 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
87 'do_not_check_signature': not(is_static or 90 'do_not_check_signature': not(is_static or
88 v8_utilities.has_extended_attribute(method, 91 v8_utilities.has_extended_attribute(method,
89 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', 92 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable',
90 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), 93 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])),
91 'function_template': function_template(), 94 'function_template': function_template(),
92 'idl_type': idl_type.base_type, 95 'idl_type': idl_type.base_type,
96 'has_event_listener_argument': has_event_listener_argument,
93 'has_exception_state': 97 'has_exception_state':
98 has_event_listener_argument or
94 is_raises_exception or 99 is_raises_exception or
95 is_check_security_for_frame or 100 is_check_security_for_frame or
96 any(argument for argument in arguments 101 any(argument for argument in arguments
97 if argument.idl_type.name == 'SerializedScriptValue' or 102 if argument.idl_type.name == 'SerializedScriptValue' or
98 argument.idl_type.is_integer_type) or 103 argument.idl_type.is_integer_type),
99 name in ['addEventListener', 'removeEventListener', 'dispatchEvent'] ,
100 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 104 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
101 'is_call_with_script_arguments': is_call_with_script_arguments, 105 'is_call_with_script_arguments': is_call_with_script_arguments,
102 'is_call_with_script_state': is_call_with_script_state, 106 'is_call_with_script_state': is_call_with_script_state,
103 'is_check_security_for_frame': is_check_security_for_frame, 107 'is_check_security_for_frame': is_check_security_for_frame,
104 'is_check_security_for_node': is_check_security_for_node, 108 'is_check_security_for_node': is_check_security_for_node,
105 'is_custom': 'Custom' in extended_attributes, 109 'is_custom': 'Custom' in extended_attributes,
106 'is_custom_element_callbacks': is_custom_element_callbacks, 110 'is_custom_element_callbacks': is_custom_element_callbacks,
107 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, 111 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
108 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s, 112 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s,
109 'is_implemented_by': 'ImplementedBy' in extended_attributes, 113 'is_implemented_by': 'ImplementedBy' in extended_attributes,
(...skipping 29 matching lines...) Expand all
139 extended_attributes = argument.extended_attributes 143 extended_attributes = argument.extended_attributes
140 idl_type = argument.idl_type 144 idl_type = argument.idl_type
141 this_cpp_value = cpp_value(interface, method, index) 145 this_cpp_value = cpp_value(interface, method, index)
142 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type 146 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
143 use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garb age_collected 147 use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garb age_collected
144 return { 148 return {
145 'cpp_type': idl_type.cpp_type_args(will_be_in_heap_object=use_heap_vecto r_type), 149 'cpp_type': idl_type.cpp_type_args(will_be_in_heap_object=use_heap_vecto r_type),
146 'cpp_value': this_cpp_value, 150 'cpp_value': this_cpp_value,
147 'enum_validation_expression': idl_type.enum_validation_expression, 151 'enum_validation_expression': idl_type.enum_validation_expression,
148 'has_default': 'Default' in extended_attributes, 152 'has_default': 'Default' in extended_attributes,
153 'has_event_listener_argument': any(
154 argument_so_far for argument_so_far in method.arguments[:index]
155 if argument_so_far.idl_type.name == 'EventListener'),
149 'idl_type_object': idl_type, 156 'idl_type_object': idl_type,
150 # Dictionary is special-cased, but arrays and sequences shouldn't be 157 # Dictionary is special-cased, but arrays and sequences shouldn't be
151 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, 158 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
152 'index': index, 159 'index': index,
153 'is_clamp': 'Clamp' in extended_attributes, 160 'is_clamp': 'Clamp' in extended_attributes,
154 'is_callback_interface': idl_type.is_callback_interface, 161 'is_callback_interface': idl_type.is_callback_interface,
155 'is_nullable': idl_type.is_nullable, 162 'is_nullable': idl_type.is_nullable,
156 'is_optional': argument.is_optional, 163 'is_optional': argument.is_optional,
157 'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes, 164 'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes,
158 'is_variadic_wrapper_type': is_variadic_wrapper_type, 165 'is_variadic_wrapper_type': is_variadic_wrapper_type,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 264
258 265
259 def union_arguments(idl_type): 266 def union_arguments(idl_type):
260 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 267 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
261 return [arg 268 return [arg
262 for i in range(len(idl_type.member_types)) 269 for i in range(len(idl_type.member_types))
263 for arg in ['result%sEnabled' % i, 'result%s' % i]] 270 for arg in ['result%sEnabled' % i, 'result%s' % i]]
264 271
265 IdlType.union_arguments = property(lambda self: None) 272 IdlType.union_arguments = property(lambda self: None)
266 IdlUnionType.union_arguments = property(union_arguments) 273 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/function-length-expected.txt ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698