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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 extended_attributes['RaisesException'] in [None, 'Setter']) | 69 extended_attributes['RaisesException'] in [None, 'Setter']) |
70 # [TypeChecking] | 70 # [TypeChecking] |
71 has_type_checking_interface = ( | 71 has_type_checking_interface = ( |
72 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or | 72 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or |
73 has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) a
nd | 73 has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) a
nd |
74 idl_type.is_wrapper_type) | 74 idl_type.is_wrapper_type) |
75 has_type_checking_nullable = ( | 75 has_type_checking_nullable = ( |
76 (has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or | 76 (has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or |
77 has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) an
d | 77 has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) an
d |
78 idl_type.is_wrapper_type) | 78 idl_type.is_wrapper_type) |
| 79 has_type_checking_unrestricted = ( |
| 80 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or |
| 81 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')
) and |
| 82 idl_type.name in ('Float', 'Double')) |
79 | 83 |
80 if (base_idl_type == 'EventHandler' and | 84 if (base_idl_type == 'EventHandler' and |
81 interface.name in ['Window', 'WorkerGlobalScope'] and | 85 interface.name in ['Window', 'WorkerGlobalScope'] and |
82 attribute.name == 'onerror'): | 86 attribute.name == 'onerror'): |
83 includes.add('bindings/v8/V8ErrorHandler.h') | 87 includes.add('bindings/v8/V8ErrorHandler.h') |
84 | 88 |
85 contents = { | 89 contents = { |
86 'access_control_list': access_control_list(attribute), | 90 'access_control_list': access_control_list(attribute), |
87 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] | 91 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] |
88 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] | 92 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] |
89 'cached_attribute_validation_method': extended_attributes.get('CachedAtt
ribute'), | 93 'cached_attribute_validation_method': extended_attributes.get('CachedAtt
ribute'), |
90 'conditional_string': v8_utilities.conditional_string(attribute), | 94 'conditional_string': v8_utilities.conditional_string(attribute), |
91 'constructor_type': idl_type.constructor_type_name | 95 'constructor_type': idl_type.constructor_type_name |
92 if is_constructor_attribute(attribute) else None, | 96 if is_constructor_attribute(attribute) else None, |
93 'cpp_name': cpp_name(attribute), | 97 'cpp_name': cpp_name(attribute), |
94 'cpp_type': idl_type.cpp_type, | 98 'cpp_type': idl_type.cpp_type, |
95 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 99 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
96 'enum_validation_expression': idl_type.enum_validation_expression, | 100 'enum_validation_expression': idl_type.enum_validation_expression, |
97 'has_custom_getter': has_custom_getter, | 101 'has_custom_getter': has_custom_getter, |
98 'has_custom_setter': has_custom_setter, | 102 'has_custom_setter': has_custom_setter, |
| 103 'has_setter_exception_state': |
| 104 is_setter_raises_exception or has_type_checking_interface or |
| 105 has_type_checking_nullable or has_type_checking_unrestricted or |
| 106 idl_type.is_integer_type, |
99 'has_type_checking_interface': has_type_checking_interface, | 107 'has_type_checking_interface': has_type_checking_interface, |
100 'has_type_checking_nullable': has_type_checking_nullable, | 108 'has_type_checking_nullable': has_type_checking_nullable, |
| 109 'has_type_checking_unrestricted': has_type_checking_unrestricted, |
101 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 110 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
102 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), | 111 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), |
103 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), | 112 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), |
104 'is_check_security_for_node': is_check_security_for_node, | 113 'is_check_security_for_node': is_check_security_for_node, |
105 'is_custom_element_callbacks': is_custom_element_callbacks, | 114 'is_custom_element_callbacks': is_custom_element_callbacks, |
106 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, | 115 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, |
107 'is_getter_raises_exception': ( # [RaisesException] | 116 'is_getter_raises_exception': # [RaisesException] |
108 'RaisesException' in extended_attributes and | 117 'RaisesException' in extended_attributes and |
109 extended_attributes['RaisesException'] in [None, 'Getter']), | 118 extended_attributes['RaisesException'] in (None, 'Getter'), |
110 'is_initialized_by_event_constructor': | 119 'is_initialized_by_event_constructor': |
111 'InitializedByEventConstructor' in extended_attributes, | 120 'InitializedByEventConstructor' in extended_attributes, |
112 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 121 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), |
113 'is_nullable': attribute.idl_type.is_nullable, | 122 'is_nullable': attribute.idl_type.is_nullable, |
114 'is_partial_interface_member': | 123 'is_partial_interface_member': |
115 'PartialInterfaceImplementedAs' in extended_attributes, | 124 'PartialInterfaceImplementedAs' in extended_attributes, |
116 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 125 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
117 'is_read_only': attribute.is_read_only, | 126 'is_read_only': attribute.is_read_only, |
118 'is_reflect': is_reflect, | 127 'is_reflect': is_reflect, |
119 'is_replaceable': 'Replaceable' in attribute.extended_attributes, | 128 'is_replaceable': 'Replaceable' in attribute.extended_attributes, |
120 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value(attribute, 'SetterCallWith', 'ExecutionContext'), | 129 'is_setter_call_with_execution_context': v8_utilities.has_extended_attri
bute_value(attribute, 'SetterCallWith', 'ExecutionContext'), |
121 'is_setter_raises_exception': is_setter_raises_exception, | 130 'is_setter_raises_exception': is_setter_raises_exception, |
122 'has_setter_exception_state': ( | |
123 is_setter_raises_exception or has_type_checking_interface or | |
124 has_type_checking_nullable or idl_type.is_integer_type), | |
125 'is_static': attribute.is_static, | 131 'is_static': attribute.is_static, |
126 'is_url': 'URL' in extended_attributes, | 132 'is_url': 'URL' in extended_attributes, |
127 'is_unforgeable': 'Unforgeable' in extended_attributes, | 133 'is_unforgeable': 'Unforgeable' in extended_attributes, |
128 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] | 134 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] |
129 'name': attribute.name, | 135 'name': attribute.name, |
130 'per_context_enabled_function': v8_utilities.per_context_enabled_functio
n_name(attribute), # [PerContextEnabled] | 136 'per_context_enabled_function': v8_utilities.per_context_enabled_functio
n_name(attribute), # [PerContextEnabled] |
131 'property_attributes': property_attributes(attribute), | 137 'property_attributes': property_attributes(attribute), |
132 'put_forwards': 'PutForwards' in extended_attributes, | 138 'put_forwards': 'PutForwards' in extended_attributes, |
133 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 139 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
134 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 140 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 lambda self: strip_suffix(self.base_type, 'Constructor')) | 416 lambda self: strip_suffix(self.base_type, 'Constructor')) |
411 | 417 |
412 | 418 |
413 def is_constructor_attribute(attribute): | 419 def is_constructor_attribute(attribute): |
414 # FIXME: replace this with [ConstructorAttribute] extended attribute | 420 # FIXME: replace this with [ConstructorAttribute] extended attribute |
415 return attribute.idl_type.base_type.endswith('Constructor') | 421 return attribute.idl_type.base_type.endswith('Constructor') |
416 | 422 |
417 | 423 |
418 def generate_constructor_getter(interface, attribute, contents): | 424 def generate_constructor_getter(interface, attribute, contents): |
419 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] | 425 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] |
OLD | NEW |