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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 'enum_validation_expression': idl_type.enum_validation_expression, | 94 'enum_validation_expression': idl_type.enum_validation_expression, |
95 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 95 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
96 'has_custom_getter': has_custom_getter(attribute), | 96 'has_custom_getter': has_custom_getter(attribute), |
97 'has_custom_setter': has_custom_setter(attribute), | 97 'has_custom_setter': has_custom_setter(attribute), |
98 'has_setter': has_setter(attribute), | 98 'has_setter': has_setter(attribute), |
99 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 99 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
100 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), | 100 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), |
101 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), | 101 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), |
102 'is_check_security_for_node': is_check_security_for_node, | 102 'is_check_security_for_node': is_check_security_for_node, |
103 'is_custom_element_callbacks': is_custom_element_callbacks, | 103 'is_custom_element_callbacks': is_custom_element_callbacks, |
104 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, | 104 'is_expose_js_accessors': is_expose_js_accessors(interface, attribute), |
105 'is_getter_raises_exception': # [RaisesException] | 105 'is_getter_raises_exception': # [RaisesException] |
106 'RaisesException' in extended_attributes and | 106 'RaisesException' in extended_attributes and |
107 extended_attributes['RaisesException'] in (None, 'Getter'), | 107 extended_attributes['RaisesException'] in (None, 'Getter'), |
108 'is_implemented_in_private_script': is_implemented_in_private_script, | 108 'is_implemented_in_private_script': is_implemented_in_private_script, |
109 'is_initialized_by_event_constructor': | 109 'is_initialized_by_event_constructor': |
110 'InitializedByEventConstructor' in extended_attributes, | 110 'InitializedByEventConstructor' in extended_attributes, |
111 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 111 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), |
112 'is_nullable': idl_type.is_nullable, | 112 'is_nullable': idl_type.is_nullable, |
113 'is_explicit_nullable': idl_type.is_explicit_nullable, | 113 'is_explicit_nullable': idl_type.is_explicit_nullable, |
114 'is_partial_interface_member': | 114 'is_partial_interface_member': |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 | 469 |
470 # [Custom], [Custom=Setter] | 470 # [Custom], [Custom=Setter] |
471 def has_custom_setter(attribute): | 471 def has_custom_setter(attribute): |
472 extended_attributes = attribute.extended_attributes | 472 extended_attributes = attribute.extended_attributes |
473 return (not attribute.is_read_only and | 473 return (not attribute.is_read_only and |
474 'Custom' in extended_attributes and | 474 'Custom' in extended_attributes and |
475 extended_attributes['Custom'] in [None, 'Setter']) | 475 extended_attributes['Custom'] in [None, 'Setter']) |
476 | 476 |
477 | 477 |
| 478 # [ExposeJSAccessors] |
| 479 def is_expose_js_accessors(interface, attribute): |
| 480 extended_attributes = attribute.extended_attributes |
| 481 |
| 482 # These attributes must not be accessors on prototype chains. |
| 483 if (attribute.is_static or |
| 484 'Unforgeable' in extended_attributes or |
| 485 'OverrideBuiltins' in interface.extended_attributes): |
| 486 return False |
| 487 |
| 488 # FIXME: We should move all of the following DOM attributes to prototype |
| 489 # chains. |
| 490 if (is_constructor_attribute(attribute) or |
| 491 has_custom_getter(attribute) or |
| 492 has_custom_setter(attribute) or |
| 493 interface.name == 'Window' or |
| 494 interface.name == 'WorkerGlobalScope' or |
| 495 v8_utilities.indexed_property_getter(interface) or |
| 496 v8_utilities.indexed_property_setter(interface) or |
| 497 v8_utilities.indexed_property_deleter(interface) or |
| 498 v8_utilities.named_property_getter(interface) or |
| 499 v8_utilities.named_property_setter(interface) or |
| 500 v8_utilities.named_property_deleter(interface)): |
| 501 return False |
| 502 |
| 503 return True |
| 504 |
| 505 |
478 ################################################################################ | 506 ################################################################################ |
479 # Constructors | 507 # Constructors |
480 ################################################################################ | 508 ################################################################################ |
481 | 509 |
482 idl_types.IdlType.constructor_type_name = property( | 510 idl_types.IdlType.constructor_type_name = property( |
483 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 511 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
484 lambda self: strip_suffix(self.base_type, 'Constructor')) | 512 lambda self: strip_suffix(self.base_type, 'Constructor')) |
485 | 513 |
486 | 514 |
487 def is_constructor_attribute(attribute): | 515 def is_constructor_attribute(attribute): |
488 # FIXME: replace this with [ConstructorAttribute] extended attribute | 516 # FIXME: replace this with [ConstructorAttribute] extended attribute |
489 return attribute.idl_type.name.endswith('Constructor') | 517 return attribute.idl_type.name.endswith('Constructor') |
490 | 518 |
491 | 519 |
492 def constructor_getter_context(interface, attribute, context): | 520 def constructor_getter_context(interface, attribute, context): |
493 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 521 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |