OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 # [CheckSecurity] | 53 # [CheckSecurity] |
54 is_check_security_for_node = 'CheckSecurity' in extended_attributes | 54 is_check_security_for_node = 'CheckSecurity' in extended_attributes |
55 if is_check_security_for_node: | 55 if is_check_security_for_node: |
56 includes.add('bindings/core/v8/BindingSecurity.h') | 56 includes.add('bindings/core/v8/BindingSecurity.h') |
57 # [CustomElementCallbacks], [Reflect] | 57 # [CustomElementCallbacks], [Reflect] |
58 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s | 58 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s |
59 is_reflect = 'Reflect' in extended_attributes | 59 is_reflect = 'Reflect' in extended_attributes |
60 if is_custom_element_callbacks or is_reflect: | 60 if is_custom_element_callbacks or is_reflect: |
61 includes.add('core/dom/custom/CustomElementProcessingStack.h') | 61 includes.add('core/dom/custom/CustomElementProcessingStack.h') |
62 # [PerWorldBindings] | |
63 if 'PerWorldBindings' in extended_attributes: | |
64 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) | |
65 # [ImplementedInPrivateScript] | 62 # [ImplementedInPrivateScript] |
66 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_
attributes | 63 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_
attributes |
67 if is_implemented_in_private_script: | 64 if is_implemented_in_private_script: |
68 includes.add('bindings/core/v8/PrivateScriptRunner.h') | 65 includes.add('bindings/core/v8/PrivateScriptRunner.h') |
69 includes.add('core/frame/LocalFrame.h') | 66 includes.add('core/frame/LocalFrame.h') |
70 includes.add('platform/ScriptForbiddenScope.h') | 67 includes.add('platform/ScriptForbiddenScope.h') |
71 | |
72 # [OnlyExposedToPrivateScript] | 68 # [OnlyExposedToPrivateScript] |
73 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended
_attributes | 69 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended
_attributes |
| 70 # [PerWorldBindings] |
| 71 if 'PerWorldBindings' in extended_attributes: |
| 72 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) |
74 | 73 |
75 if (base_idl_type == 'EventHandler' and | 74 if (base_idl_type == 'EventHandler' and |
76 interface.name in ['Window', 'WorkerGlobalScope'] and | 75 interface.name in ['Window', 'WorkerGlobalScope'] and |
77 attribute.name == 'onerror'): | 76 attribute.name == 'onerror'): |
78 includes.add('bindings/core/v8/V8ErrorHandler.h') | 77 includes.add('bindings/core/v8/V8ErrorHandler.h') |
79 | 78 |
80 context = { | 79 context = { |
81 'access_control_list': access_control_list(interface, attribute), | 80 'access_control_list': access_control_list(interface, attribute), |
82 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] | 81 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] |
83 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] | 82 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 else: | 419 else: |
421 namespace = 'HTMLNames' | 420 namespace = 'HTMLNames' |
422 includes.add('core/%s.h' % namespace) | 421 includes.add('core/%s.h' % namespace) |
423 return '%s::%sAttr' % (namespace, content_attribute_name) | 422 return '%s::%sAttr' % (namespace, content_attribute_name) |
424 | 423 |
425 | 424 |
426 ################################################################################ | 425 ################################################################################ |
427 # Attribute configuration | 426 # Attribute configuration |
428 ################################################################################ | 427 ################################################################################ |
429 | 428 |
430 # [Replaceable] | 429 # [PutForwards], [Replaceable] |
431 def setter_callback_name(interface, attribute): | 430 def setter_callback_name(interface, attribute): |
432 cpp_class_name = cpp_name(interface) | 431 cpp_class_name = cpp_name(interface) |
433 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 432 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
434 | 433 |
435 extended_attributes = attribute.extended_attributes | 434 extended_attributes = attribute.extended_attributes |
436 if (('Replaceable' in extended_attributes and | 435 if (is_constructor_attribute(attribute)): |
437 'PutForwards' not in extended_attributes) or | |
438 is_constructor_attribute(attribute)): | |
439 return '%sV8Internal::%sForceSetAttributeOnThisCallback' % ( | 436 return '%sV8Internal::%sForceSetAttributeOnThisCallback' % ( |
440 cpp_class_name_or_partial, cpp_class_name) | 437 cpp_class_name_or_partial, cpp_class_name) |
441 if attribute.is_read_only and 'PutForwards' not in extended_attributes: | 438 if (attribute.is_read_only and |
| 439 'PutForwards' not in extended_attributes and |
| 440 'Replaceable' not in extended_attributes): |
442 return '0' | 441 return '0' |
443 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name_or_partia
l, attribute.name) | 442 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name_or_partia
l, attribute.name) |
444 | 443 |
445 | 444 |
446 # [DoNotCheckSecurity], [Unforgeable] | 445 # [DoNotCheckSecurity], [Unforgeable] |
447 def access_control_list(interface, attribute): | 446 def access_control_list(interface, attribute): |
448 extended_attributes = attribute.extended_attributes | 447 extended_attributes = attribute.extended_attributes |
449 access_control = [] | 448 access_control = [] |
450 if 'DoNotCheckSecurity' in extended_attributes: | 449 if 'DoNotCheckSecurity' in extended_attributes: |
451 do_not_check_security = extended_attributes['DoNotCheckSecurity'] | 450 do_not_check_security = extended_attributes['DoNotCheckSecurity'] |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 lambda self: strip_suffix(self.base_type, 'Constructor')) | 497 lambda self: strip_suffix(self.base_type, 'Constructor')) |
499 | 498 |
500 | 499 |
501 def is_constructor_attribute(attribute): | 500 def is_constructor_attribute(attribute): |
502 # FIXME: replace this with [ConstructorAttribute] extended attribute | 501 # FIXME: replace this with [ConstructorAttribute] extended attribute |
503 return attribute.idl_type.name.endswith('Constructor') | 502 return attribute.idl_type.name.endswith('Constructor') |
504 | 503 |
505 | 504 |
506 def constructor_getter_context(interface, attribute, context): | 505 def constructor_getter_context(interface, attribute, context): |
507 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 506 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |