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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 idl_type = attribute.idl_type | 62 idl_type = attribute.idl_type |
63 base_idl_type = idl_type.base_type | 63 base_idl_type = idl_type.base_type |
64 extended_attributes = attribute.extended_attributes | 64 extended_attributes = attribute.extended_attributes |
65 | 65 |
66 idl_type.add_includes_for_type(extended_attributes) | 66 idl_type.add_includes_for_type(extended_attributes) |
67 if idl_type.enum_values: | 67 if idl_type.enum_values: |
68 includes.add('core/inspector/ConsoleMessage.h') | 68 includes.add('core/inspector/ConsoleMessage.h') |
69 | 69 |
70 # [CheckSecurity] | 70 # [CheckSecurity] |
71 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes | 71 is_cross_origin = 'CrossOrigin' in extended_attributes |
| 72 # TODO(dcheng): Does this actually need to take CrossOrigin into account? |
72 is_check_security_for_receiver = ( | 73 is_check_security_for_receiver = ( |
73 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and | 74 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and |
74 not is_do_not_check_security) | 75 not is_cross_origin) |
75 is_check_security_for_return_value = ( | 76 is_check_security_for_return_value = ( |
76 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) | 77 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) |
77 if is_check_security_for_receiver or is_check_security_for_return_value: | 78 if is_check_security_for_receiver or is_check_security_for_return_value: |
78 includes.add('bindings/core/v8/BindingSecurity.h') | 79 includes.add('bindings/core/v8/BindingSecurity.h') |
79 # [Constructor] | 80 # [Constructor] |
80 # TODO(yukishiino): Constructors are much like methods although constructors | 81 # TODO(yukishiino): Constructors are much like methods although constructors |
81 # are not methods. Constructors must be data-type properties, and we can | 82 # are not methods. Constructors must be data-type properties, and we can |
82 # support them as a kind of methods. | 83 # support them as a kind of methods. |
83 constructor_type = idl_type.constructor_type_name if is_constructor_attribut
e(attribute) else None | 84 constructor_type = idl_type.constructor_type_name if is_constructor_attribut
e(attribute) else None |
84 # [CEReactions] | 85 # [CEReactions] |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 136 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
136 'has_custom_getter': has_custom_getter(attribute), | 137 'has_custom_getter': has_custom_getter(attribute), |
137 'has_custom_setter': has_custom_setter(attribute), | 138 'has_custom_setter': has_custom_setter(attribute), |
138 'has_setter': has_setter(interface, attribute), | 139 'has_setter': has_setter(interface, attribute), |
139 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 140 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
140 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), | 141 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), |
141 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), | 142 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), |
142 'is_ce_reactions': is_ce_reactions, | 143 'is_ce_reactions': is_ce_reactions, |
143 'is_check_security_for_receiver': is_check_security_for_receiver, | 144 'is_check_security_for_receiver': is_check_security_for_receiver, |
144 'is_check_security_for_return_value': is_check_security_for_return_value
, | 145 'is_check_security_for_return_value': is_check_security_for_return_value
, |
| 146 'is_cross_origin': 'CrossOrigin' in extended_attributes, |
145 'is_custom_element_callbacks': is_custom_element_callbacks, | 147 'is_custom_element_callbacks': is_custom_element_callbacks, |
146 # TODO(yukishiino): Make all DOM attributes accessor-type properties. | 148 # TODO(yukishiino): Make all DOM attributes accessor-type properties. |
147 'is_data_type_property': is_data_type_property(interface, attribute), | 149 'is_data_type_property': is_data_type_property(interface, attribute), |
148 'is_getter_raises_exception': # [RaisesException] | 150 'is_getter_raises_exception': # [RaisesException] |
149 'RaisesException' in extended_attributes and | 151 'RaisesException' in extended_attributes and |
150 extended_attributes['RaisesException'] in (None, 'Getter'), | 152 extended_attributes['RaisesException'] in (None, 'Getter'), |
151 'is_implemented_in_private_script': is_implemented_in_private_script, | 153 'is_implemented_in_private_script': is_implemented_in_private_script, |
152 'is_keep_alive_for_gc': keep_alive_for_gc, | 154 'is_keep_alive_for_gc': keep_alive_for_gc, |
153 'is_lenient_this': 'LenientThis' in extended_attributes, | 155 'is_lenient_this': 'LenientThis' in extended_attributes, |
154 'is_nullable': idl_type.is_nullable, | 156 'is_nullable': idl_type.is_nullable, |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 # [PutForwards], [Replaceable] | 522 # [PutForwards], [Replaceable] |
521 def has_setter(interface, attribute): | 523 def has_setter(interface, attribute): |
522 if (is_data_type_property(interface, attribute) and | 524 if (is_data_type_property(interface, attribute) and |
523 (is_constructor_attribute(attribute) or | 525 (is_constructor_attribute(attribute) or |
524 'Replaceable' in attribute.extended_attributes)): | 526 'Replaceable' in attribute.extended_attributes)): |
525 return False | 527 return False |
526 | 528 |
527 return is_writable(attribute) | 529 return is_writable(attribute) |
528 | 530 |
529 | 531 |
530 # [DoNotCheckSecurity], [Unforgeable] | 532 # [Unforgeable] |
531 def access_control_list(interface, attribute): | 533 def access_control_list(interface, attribute): |
532 extended_attributes = attribute.extended_attributes | 534 extended_attributes = attribute.extended_attributes |
533 access_control = [] | 535 access_control = [] |
534 if 'DoNotCheckSecurity' in extended_attributes: | |
535 do_not_check_security = extended_attributes['DoNotCheckSecurity'] | |
536 if do_not_check_security == 'Setter': | |
537 access_control.append('v8::ALL_CAN_WRITE') | |
538 else: | |
539 access_control.append('v8::ALL_CAN_READ') | |
540 if has_setter(interface, attribute): | |
541 access_control.append('v8::ALL_CAN_WRITE') | |
542 if is_unforgeable(interface, attribute): | 536 if is_unforgeable(interface, attribute): |
543 access_control.append('v8::PROHIBITS_OVERWRITING') | 537 access_control.append('v8::PROHIBITS_OVERWRITING') |
544 return access_control or ['v8::DEFAULT'] | 538 return access_control or ['v8::DEFAULT'] |
545 | 539 |
546 | 540 |
547 # [NotEnumerable], [Unforgeable] | 541 # [NotEnumerable], [Unforgeable] |
548 def property_attributes(interface, attribute): | 542 def property_attributes(interface, attribute): |
549 extended_attributes = attribute.extended_attributes | 543 extended_attributes = attribute.extended_attributes |
550 property_attributes_list = [] | 544 property_attributes_list = [] |
551 if ('NotEnumerable' in extended_attributes or | 545 if ('NotEnumerable' in extended_attributes or |
(...skipping 30 matching lines...) Expand all Loading... |
582 lambda self: strip_suffix(self.base_type, 'Constructor')) | 576 lambda self: strip_suffix(self.base_type, 'Constructor')) |
583 | 577 |
584 | 578 |
585 def is_constructor_attribute(attribute): | 579 def is_constructor_attribute(attribute): |
586 # FIXME: replace this with [ConstructorAttribute] extended attribute | 580 # FIXME: replace this with [ConstructorAttribute] extended attribute |
587 return attribute.idl_type.name.endswith('Constructor') | 581 return attribute.idl_type.name.endswith('Constructor') |
588 | 582 |
589 | 583 |
590 def update_constructor_attribute_context(interface, attribute, context): | 584 def update_constructor_attribute_context(interface, attribute, context): |
591 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 585 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |