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