| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 'only_exposed_to_private_script': is_only_exposed_to_private_script, | 161 'only_exposed_to_private_script': is_only_exposed_to_private_script, |
| 162 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( | 162 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( |
| 163 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), | 163 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa
lse', isolate='scriptState->isolate()'), |
| 164 'property_attributes': property_attributes(interface, attribute), | 164 'property_attributes': property_attributes(interface, attribute), |
| 165 'reflect_empty': extended_attributes.get('ReflectEmpty'), | 165 'reflect_empty': extended_attributes.get('ReflectEmpty'), |
| 166 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), | 166 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), |
| 167 'reflect_missing': extended_attributes.get('ReflectMissing'), | 167 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 168 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), | 168 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly
'), |
| 169 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] | 169 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a
ttribute), # [RuntimeEnabled] |
| 170 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), #
[RuntimeEnabled] | 170 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), #
[RuntimeEnabled] |
| 171 'secure_context_test': v8_utilities.secure_context(attribute, interface)
, # [SecureContext] |
| 171 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), | 172 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), |
| 172 'world_suffixes': ( | 173 'world_suffixes': ( |
| 173 ['', 'ForMainWorld'] | 174 ['', 'ForMainWorld'] |
| 174 if 'PerWorldBindings' in extended_attributes | 175 if 'PerWorldBindings' in extended_attributes |
| 175 else ['']), # [PerWorldBindings] | 176 else ['']), # [PerWorldBindings] |
| 176 } | 177 } |
| 177 | 178 |
| 178 if is_constructor_attribute(attribute): | 179 if is_constructor_attribute(attribute): |
| 179 update_constructor_attribute_context(interface, attribute, context) | 180 update_constructor_attribute_context(interface, attribute, context) |
| 180 if not has_custom_getter(attribute): | 181 if not has_custom_getter(attribute): |
| 181 getter_context(interface, attribute, context) | 182 getter_context(interface, attribute, context) |
| 182 if not has_custom_setter(attribute) and has_setter(interface, attribute): | 183 if not has_custom_setter(attribute) and has_setter(interface, attribute): |
| 183 setter_context(interface, attribute, context) | 184 setter_context(interface, attribute, context) |
| 184 | 185 |
| 185 return context | 186 return context |
| 186 | 187 |
| 187 | 188 |
| 188 def filter_has_accessor_configuration(attributes): | 189 def filter_has_accessor_configuration(attributes): |
| 189 return [attribute for attribute in attributes if | 190 return [attribute for attribute in attributes if |
| 190 not (attribute['exposed_test'] or | 191 not (attribute['exposed_test'] or |
| 192 attribute['secure_context_test'] or |
| 191 attribute['origin_trial_enabled_function'] or | 193 attribute['origin_trial_enabled_function'] or |
| 192 attribute['runtime_enabled_function']) and | 194 attribute['runtime_enabled_function']) and |
| 193 not attribute['is_data_type_property'] and | 195 not attribute['is_data_type_property'] and |
| 194 attribute['should_be_exposed_to_script']] | 196 attribute['should_be_exposed_to_script']] |
| 195 | 197 |
| 196 | 198 |
| 197 def filter_has_attribute_configuration(attributes): | 199 def filter_has_attribute_configuration(attributes): |
| 198 return [attribute for attribute in attributes if | 200 return [attribute for attribute in attributes if |
| 199 not (attribute['exposed_test'] or | 201 not (attribute['exposed_test'] or |
| 202 attribute['secure_context_test'] or |
| 200 attribute['origin_trial_enabled_function'] or | 203 attribute['origin_trial_enabled_function'] or |
| 201 attribute['runtime_enabled_function']) and | 204 attribute['runtime_enabled_function']) and |
| 202 attribute['is_data_type_property'] and | 205 attribute['is_data_type_property'] and |
| 203 attribute['should_be_exposed_to_script']] | 206 attribute['should_be_exposed_to_script']] |
| 204 | 207 |
| 205 | 208 |
| 206 def filter_origin_trial_enabled(attributes): | 209 def filter_origin_trial_enabled(attributes): |
| 207 return [attribute for attribute in attributes if | 210 return [attribute for attribute in attributes if |
| 208 attribute['origin_trial_feature_name'] and | 211 attribute['origin_trial_feature_name'] and |
| 209 not attribute['exposed_test']] | 212 not attribute['exposed_test']] |
| 210 | 213 |
| 211 | 214 |
| 212 def filter_runtime_enabled(attributes): | 215 def filter_purely_runtime_enabled(attributes): |
| 213 return [attribute for attribute in attributes if | 216 return [attribute for attribute in attributes if |
| 214 attribute['runtime_feature_name'] and | 217 not (attribute['exposed_test'] or |
| 215 not attribute['exposed_test']] | 218 attribute['secure_context_test']) and |
| 219 attribute['runtime_feature_name']] |
| 216 | 220 |
| 217 | 221 |
| 218 def attribute_filters(): | 222 def attribute_filters(): |
| 219 return {'has_accessor_configuration': filter_has_accessor_configuration, | 223 return {'has_accessor_configuration': filter_has_accessor_configuration, |
| 220 'has_attribute_configuration': filter_has_attribute_configuration, | 224 'has_attribute_configuration': filter_has_attribute_configuration, |
| 221 'origin_trial_enabled_attributes': filter_origin_trial_enabled, | 225 'origin_trial_enabled_attributes': filter_origin_trial_enabled, |
| 222 'runtime_enabled_attributes': filter_runtime_enabled} | 226 'purely_runtime_enabled_attributes': filter_purely_runtime_enabled} |
| 223 | 227 |
| 224 | 228 |
| 225 ################################################################################ | 229 ################################################################################ |
| 226 # Getter | 230 # Getter |
| 227 ################################################################################ | 231 ################################################################################ |
| 228 | 232 |
| 229 def getter_context(interface, attribute, context): | 233 def getter_context(interface, attribute, context): |
| 230 idl_type = attribute.idl_type | 234 idl_type = attribute.idl_type |
| 231 base_idl_type = idl_type.base_type | 235 base_idl_type = idl_type.base_type |
| 232 extended_attributes = attribute.extended_attributes | 236 extended_attributes = attribute.extended_attributes |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 lambda self: strip_suffix(self.base_type, 'Constructor')) | 568 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 565 | 569 |
| 566 | 570 |
| 567 def is_constructor_attribute(attribute): | 571 def is_constructor_attribute(attribute): |
| 568 # FIXME: replace this with [ConstructorAttribute] extended attribute | 572 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 569 return attribute.idl_type.name.endswith('Constructor') | 573 return attribute.idl_type.name.endswith('Constructor') |
| 570 | 574 |
| 571 | 575 |
| 572 def update_constructor_attribute_context(interface, attribute, context): | 576 def update_constructor_attribute_context(interface, attribute, context): |
| 573 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 577 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| OLD | NEW |