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

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

Issue 426583003: Revert of Enable the WebIDL [Exposed] annotation on an interface's members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 context.update({ 233 context.update({
234 'attributes': attributes, 234 'attributes': attributes,
235 'has_accessors': any(attribute['is_expose_js_accessors'] and attribute[' should_be_exposed_to_script'] for attribute in attributes), 235 'has_accessors': any(attribute['is_expose_js_accessors'] and attribute[' should_be_exposed_to_script'] for attribute in attributes),
236 'has_attribute_configuration': any( 236 'has_attribute_configuration': any(
237 not (attribute['is_expose_js_accessors'] or 237 not (attribute['is_expose_js_accessors'] or
238 attribute['is_static'] or 238 attribute['is_static'] or
239 attribute['runtime_enabled_function'] or 239 attribute['runtime_enabled_function'] or
240 attribute['per_context_enabled_function']) 240 attribute['per_context_enabled_function'])
241 and attribute['should_be_exposed_to_script'] 241 and attribute['should_be_exposed_to_script']
242 for attribute in attributes), 242 for attribute in attributes),
243 'has_conditional_attributes': any(attribute['per_context_enabled_functio n'] or attribute['exposed_test'] for attribute in attributes),
244 'has_constructor_attributes': any(attribute['constructor_type'] for attr ibute in attributes), 243 'has_constructor_attributes': any(attribute['constructor_type'] for attr ibute in attributes),
244 'has_per_context_enabled_attributes': any(attribute['per_context_enabled _function'] for attribute in attributes),
245 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes), 245 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes),
246 }) 246 })
247 247
248 # Methods 248 # Methods
249 methods = [v8_methods.method_context(interface, method) 249 methods = [v8_methods.method_context(interface, method)
250 for method in interface.operations 250 for method in interface.operations
251 if method.name] # Skip anonymous special operations (methods) 251 if method.name] # Skip anonymous special operations (methods)
252 compute_method_overloads_context(methods) 252 compute_method_overloads_context(methods)
253 253
254 # Stringifier 254 # Stringifier
255 if interface.stringifier: 255 if interface.stringifier:
256 stringifier = interface.stringifier 256 stringifier = interface.stringifier
257 method = IdlOperation() 257 method = IdlOperation()
258 method.name = 'toString' 258 method.name = 'toString'
259 method.idl_type = IdlType('DOMString') 259 method.idl_type = IdlType('DOMString')
260 method.extended_attributes.update(stringifier.extended_attributes) 260 method.extended_attributes.update(stringifier.extended_attributes)
261 if stringifier.attribute: 261 if stringifier.attribute:
262 method.extended_attributes['ImplementedAs'] = stringifier.attribute. name 262 method.extended_attributes['ImplementedAs'] = stringifier.attribute. name
263 elif stringifier.operation: 263 elif stringifier.operation:
264 method.extended_attributes['ImplementedAs'] = stringifier.operation. name 264 method.extended_attributes['ImplementedAs'] = stringifier.operation. name
265 methods.append(v8_methods.method_context(interface, method)) 265 methods.append(v8_methods.method_context(interface, method))
266 266
267 conditionally_enabled_methods = [] 267 per_context_enabled_methods = []
268 custom_registration_methods = [] 268 custom_registration_methods = []
269 method_configuration_methods = [] 269 method_configuration_methods = []
270 270
271 for method in methods: 271 for method in methods:
272 # Skip all but one method in each set of overloaded methods. 272 # Skip all but one method in each set of overloaded methods.
273 if 'overload_index' in method and 'overloads' not in method: 273 if 'overload_index' in method and 'overloads' not in method:
274 continue 274 continue
275 275
276 if 'overloads' in method: 276 if 'overloads' in method:
277 overloads = method['overloads'] 277 overloads = method['overloads']
278 per_context_enabled_function = overloads['per_context_enabled_functi on_all'] 278 per_context_enabled_function = overloads['per_context_enabled_functi on_all']
279 conditionally_exposed_function = overloads['exposed_test_all']
280 runtime_enabled_function = overloads['runtime_enabled_function_all'] 279 runtime_enabled_function = overloads['runtime_enabled_function_all']
281 has_custom_registration = overloads['has_custom_registration_all'] 280 has_custom_registration = overloads['has_custom_registration_all']
282 else: 281 else:
283 per_context_enabled_function = method['per_context_enabled_function' ] 282 per_context_enabled_function = method['per_context_enabled_function' ]
284 conditionally_exposed_function = method['exposed_test']
285 runtime_enabled_function = method['runtime_enabled_function'] 283 runtime_enabled_function = method['runtime_enabled_function']
286 has_custom_registration = method['has_custom_registration'] 284 has_custom_registration = method['has_custom_registration']
287 285
288 if per_context_enabled_function or conditionally_exposed_function: 286 if per_context_enabled_function:
289 conditionally_enabled_methods.append(method) 287 per_context_enabled_methods.append(method)
290 continue 288 continue
291 if runtime_enabled_function or has_custom_registration: 289 if runtime_enabled_function or has_custom_registration:
292 custom_registration_methods.append(method) 290 custom_registration_methods.append(method)
293 continue 291 continue
294 if method['should_be_exposed_to_script']: 292 if method['should_be_exposed_to_script']:
295 method_configuration_methods.append(method) 293 method_configuration_methods.append(method)
296 294
297 for method in methods: 295 for method in methods:
298 # The value of the Function object’s “length” property is a Number 296 # The value of the Function object’s “length” property is a Number
299 # determined as follows: 297 # determined as follows:
300 # 1. Let S be the effective overload set for regular operations (if the 298 # 1. Let S be the effective overload set for regular operations (if the
301 # operation is a regular operation) or for static operations (if the 299 # operation is a regular operation) or for static operations (if the
302 # operation is a static operation) with identifier id on interface I and 300 # operation is a static operation) with identifier id on interface I and
303 # with argument count 0. 301 # with argument count 0.
304 # 2. Return the length of the shortest argument list of the entries in S . 302 # 2. Return the length of the shortest argument list of the entries in S .
305 # FIXME: This calculation doesn't take into account whether runtime 303 # FIXME: This calculation doesn't take into account whether runtime
306 # enabled overloads are actually enabled, so length may be incorrect. 304 # enabled overloads are actually enabled, so length may be incorrect.
307 # E.g., [RuntimeEnabled=Foo] void f(); void f(long x); 305 # E.g., [RuntimeEnabled=Foo] void f(); void f(long x);
308 # should have length 1 if Foo is not enabled, but length 0 if it is. 306 # should have length 1 if Foo is not enabled, but length 0 if it is.
309 method['length'] = (method['overloads']['minarg'] if 'overloads' in meth od else 307 method['length'] = (method['overloads']['minarg'] if 'overloads' in meth od else
310 method['number_of_required_arguments']) 308 method['number_of_required_arguments'])
311 309
312 context.update({ 310 context.update({
313 'conditionally_enabled_methods': conditionally_enabled_methods,
314 'custom_registration_methods': custom_registration_methods, 311 'custom_registration_methods': custom_registration_methods,
315 'has_origin_safe_method_setter': any( 312 'has_origin_safe_method_setter': any(
316 method['is_check_security_for_frame'] and not method['is_read_only'] 313 method['is_check_security_for_frame'] and not method['is_read_only']
317 for method in methods), 314 for method in methods),
318 'method_configuration_methods': method_configuration_methods, 315 'method_configuration_methods': method_configuration_methods,
316 'per_context_enabled_methods': per_context_enabled_methods,
319 'methods': methods, 317 'methods': methods,
320 }) 318 })
321 319
322 context.update({ 320 context.update({
323 'indexed_property_getter': indexed_property_getter(interface), 321 'indexed_property_getter': indexed_property_getter(interface),
324 'indexed_property_setter': indexed_property_setter(interface), 322 'indexed_property_setter': indexed_property_setter(interface),
325 'indexed_property_deleter': indexed_property_deleter(interface), 323 'indexed_property_deleter': indexed_property_deleter(interface),
326 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, 324 'is_override_builtins': 'OverrideBuiltins' in extended_attributes,
327 'named_property_getter': named_property_getter(interface), 325 'named_property_getter': named_property_getter(interface),
328 'named_property_setter': named_property_setter(interface), 326 'named_property_setter': named_property_setter(interface),
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 overload_extended_attributes = [ 430 overload_extended_attributes = [
433 method['custom_registration_extended_attributes'] 431 method['custom_registration_extended_attributes']
434 for method in overloads] 432 for method in overloads]
435 for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIB UTES: 433 for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIB UTES:
436 if common_key(overload_extended_attributes, extended_attribute) is N one: 434 if common_key(overload_extended_attributes, extended_attribute) is N one:
437 raise ValueError('Overloads of %s have conflicting extended attr ibute %s' 435 raise ValueError('Overloads of %s have conflicting extended attr ibute %s'
438 % (name, extended_attribute)) 436 % (name, extended_attribute))
439 437
440 return { 438 return {
441 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca teAs] 439 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca teAs]
442 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed ]
443 'has_custom_registration_all': common_value(overloads, 'has_custom_regis tration'),
444 'length_tests_methods': length_tests_methods(effective_overloads_by_leng th), 440 'length_tests_methods': length_tests_methods(effective_overloads_by_leng th),
441 'minarg': lengths[0],
445 # 1. Let maxarg be the length of the longest type list of the 442 # 1. Let maxarg be the length of the longest type list of the
446 # entries in S. 443 # entries in S.
447 'maxarg': lengths[-1], 444 'maxarg': lengths[-1],
448 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] 445 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs]
449 'minarg': lengths[0], 446 'has_custom_registration_all': common_value(overloads, 'has_custom_regis tration'),
450 'per_context_enabled_function_all': common_value(overloads, 'per_context _enabled_function'), # [PerContextEnabled] 447 'per_context_enabled_function_all': common_value(overloads, 'per_context _enabled_function'), # [PerContextEnabled]
451 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled _function'), # [RuntimeEnabled] 448 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled _function'), # [RuntimeEnabled]
452 'valid_arities': lengths 449 'valid_arities': lengths
453 # Only need to report valid arities if there is a gap in the 450 # Only need to report valid arities if there is a gap in the
454 # sequence of possible lengths, otherwise invalid length means 451 # sequence of possible lengths, otherwise invalid length means
455 # "not enough arguments". 452 # "not enough arguments".
456 if lengths[-1] - lengths[0] != len(lengths) - 1 else None, 453 if lengths[-1] - lengths[0] != len(lengths) - 1 else None,
457 } 454 }
458 455
459 456
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 deleter = next( 1102 deleter = next(
1106 method 1103 method
1107 for method in interface.operations 1104 for method in interface.operations
1108 if ('deleter' in method.specials and 1105 if ('deleter' in method.specials and
1109 len(method.arguments) == 1 and 1106 len(method.arguments) == 1 and
1110 str(method.arguments[0].idl_type) == 'DOMString')) 1107 str(method.arguments[0].idl_type) == 'DOMString'))
1111 except StopIteration: 1108 except StopIteration:
1112 return None 1109 return None
1113 1110
1114 return property_deleter(deleter) 1111 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698