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): It doesn't seem to make sense for this to be mutually |
| 73 # exclusive from CrossOrigin. |
72 is_check_security_for_receiver = ( | 74 is_check_security_for_receiver = ( |
73 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and | 75 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and |
74 not is_do_not_check_security) | 76 not is_cross_origin) |
75 is_check_security_for_return_value = ( | 77 is_check_security_for_return_value = ( |
76 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) | 78 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) |
77 if is_check_security_for_receiver or is_check_security_for_return_value: | 79 if is_check_security_for_receiver or is_check_security_for_return_value: |
78 includes.add('bindings/core/v8/BindingSecurity.h') | 80 includes.add('bindings/core/v8/BindingSecurity.h') |
| 81 # [CrossOrigin] |
| 82 if has_extended_attribute_value(attribute, 'CrossOrigin', 'Setter'): |
| 83 includes.add('bindings/core/v8/V8CrossOriginSetterInfo.h') |
79 # [Constructor] | 84 # [Constructor] |
80 # TODO(yukishiino): Constructors are much like methods although constructors | 85 # TODO(yukishiino): Constructors are much like methods although constructors |
81 # are not methods. Constructors must be data-type properties, and we can | 86 # are not methods. Constructors must be data-type properties, and we can |
82 # support them as a kind of methods. | 87 # support them as a kind of methods. |
83 constructor_type = idl_type.constructor_type_name if is_constructor_attribut
e(attribute) else None | 88 constructor_type = idl_type.constructor_type_name if is_constructor_attribut
e(attribute) else None |
84 # [CEReactions] | 89 # [CEReactions] |
85 is_ce_reactions = 'CEReactions' in extended_attributes | 90 is_ce_reactions = 'CEReactions' in extended_attributes |
86 if is_ce_reactions: | 91 if is_ce_reactions: |
87 includes.add('core/dom/custom/CEReactionsScope.h') | 92 includes.add('core/dom/custom/CEReactionsScope.h') |
88 # [CustomElementCallbacks], [Reflect] | 93 # [CustomElementCallbacks], [Reflect] |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 131 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
127 'cached_attribute_validation_method': cached_attribute_validation_method
, | 132 'cached_attribute_validation_method': cached_attribute_validation_method
, |
128 'constructor_type': constructor_type, | 133 'constructor_type': constructor_type, |
129 'cpp_name': cpp_name(attribute), | 134 'cpp_name': cpp_name(attribute), |
130 'cpp_type': idl_type.cpp_type, | 135 'cpp_type': idl_type.cpp_type, |
131 'cpp_type_initializer': idl_type.cpp_type_initializer, | 136 'cpp_type_initializer': idl_type.cpp_type_initializer, |
132 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 137 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
133 'enum_type': idl_type.enum_type, | 138 'enum_type': idl_type.enum_type, |
134 'enum_values': idl_type.enum_values, | 139 'enum_values': idl_type.enum_values, |
135 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 140 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
| 141 'has_cross_origin_getter': |
| 142 has_extended_attribute_value(attribute, 'CrossOrigin', None) or |
| 143 has_extended_attribute_value(attribute, 'CrossOrigin', 'Getter'), |
| 144 'has_cross_origin_setter': has_extended_attribute_value(attribute, 'Cros
sOrigin', 'Setter'), |
136 'has_custom_getter': has_custom_getter(attribute), | 145 'has_custom_getter': has_custom_getter(attribute), |
137 'has_custom_setter': has_custom_setter(attribute), | 146 'has_custom_setter': has_custom_setter(attribute), |
138 'has_setter': has_setter(interface, attribute), | 147 'has_setter': has_setter(interface, attribute), |
139 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 148 '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'), | 149 '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'), | 150 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), |
142 'is_ce_reactions': is_ce_reactions, | 151 'is_ce_reactions': is_ce_reactions, |
143 'is_check_security_for_receiver': is_check_security_for_receiver, | 152 'is_check_security_for_receiver': is_check_security_for_receiver, |
144 'is_check_security_for_return_value': is_check_security_for_return_value
, | 153 'is_check_security_for_return_value': is_check_security_for_return_value
, |
145 'is_custom_element_callbacks': is_custom_element_callbacks, | 154 'is_custom_element_callbacks': is_custom_element_callbacks, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 # [PutForwards], [Replaceable] | 534 # [PutForwards], [Replaceable] |
526 def has_setter(interface, attribute): | 535 def has_setter(interface, attribute): |
527 if (is_data_type_property(interface, attribute) and | 536 if (is_data_type_property(interface, attribute) and |
528 (is_constructor_attribute(attribute) or | 537 (is_constructor_attribute(attribute) or |
529 'Replaceable' in attribute.extended_attributes)): | 538 'Replaceable' in attribute.extended_attributes)): |
530 return False | 539 return False |
531 | 540 |
532 return is_writable(attribute) | 541 return is_writable(attribute) |
533 | 542 |
534 | 543 |
535 # [DoNotCheckSecurity], [Unforgeable] | 544 # [Unforgeable] |
536 def access_control_list(interface, attribute): | 545 def access_control_list(interface, attribute): |
537 extended_attributes = attribute.extended_attributes | 546 extended_attributes = attribute.extended_attributes |
538 access_control = [] | 547 access_control = [] |
539 if 'DoNotCheckSecurity' in extended_attributes: | |
540 do_not_check_security = extended_attributes['DoNotCheckSecurity'] | |
541 if do_not_check_security == 'Setter': | |
542 access_control.append('v8::ALL_CAN_WRITE') | |
543 else: | |
544 access_control.append('v8::ALL_CAN_READ') | |
545 if has_setter(interface, attribute): | |
546 access_control.append('v8::ALL_CAN_WRITE') | |
547 if is_unforgeable(interface, attribute): | 548 if is_unforgeable(interface, attribute): |
548 access_control.append('v8::PROHIBITS_OVERWRITING') | 549 access_control.append('v8::PROHIBITS_OVERWRITING') |
549 return access_control or ['v8::DEFAULT'] | 550 return access_control or ['v8::DEFAULT'] |
550 | 551 |
551 | 552 |
552 # [NotEnumerable], [Unforgeable] | 553 # [NotEnumerable], [Unforgeable] |
553 def property_attributes(interface, attribute): | 554 def property_attributes(interface, attribute): |
554 extended_attributes = attribute.extended_attributes | 555 extended_attributes = attribute.extended_attributes |
555 property_attributes_list = [] | 556 property_attributes_list = [] |
556 if ('NotEnumerable' in extended_attributes or | 557 if ('NotEnumerable' in extended_attributes or |
(...skipping 30 matching lines...) Expand all Loading... |
587 lambda self: strip_suffix(self.base_type, 'Constructor')) | 588 lambda self: strip_suffix(self.base_type, 'Constructor')) |
588 | 589 |
589 | 590 |
590 def is_constructor_attribute(attribute): | 591 def is_constructor_attribute(attribute): |
591 # FIXME: replace this with [ConstructorAttribute] extended attribute | 592 # FIXME: replace this with [ConstructorAttribute] extended attribute |
592 return attribute.idl_type.name.endswith('Constructor') | 593 return attribute.idl_type.name.endswith('Constructor') |
593 | 594 |
594 | 595 |
595 def update_constructor_attribute_context(interface, attribute, context): | 596 def update_constructor_attribute_context(interface, attribute, context): |
596 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 597 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |