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 # Explicitly specified as accessors with the extended attribute. | |
488 if 'ExposeJSAccessors' in extended_attributes: | |
haraken
2015/03/11 03:19:32
You can now remove this IDL attribute.
Yuki
2015/03/11 08:44:36
Done.
| |
489 return True | |
490 | |
491 # FIXME: We should move all of the following DOM attributes to prototype | |
492 # chains. | |
493 if (is_constructor_attribute(attribute) or | |
494 has_custom_getter(attribute) or | |
495 has_custom_setter(attribute) or | |
496 interface.name == 'Window' or | |
497 interface.name == 'WorkerGlobalScope' or | |
498 v8_utilities.indexed_property_getter(interface) or | |
499 v8_utilities.indexed_property_setter(interface) or | |
500 v8_utilities.indexed_property_deleter(interface) or | |
501 v8_utilities.named_property_getter(interface) or | |
502 v8_utilities.named_property_setter(interface) or | |
503 v8_utilities.named_property_deleter(interface)): | |
504 return False | |
505 | |
506 return True | |
507 | |
508 | |
478 ################################################################################ | 509 ################################################################################ |
479 # Constructors | 510 # Constructors |
480 ################################################################################ | 511 ################################################################################ |
481 | 512 |
482 idl_types.IdlType.constructor_type_name = property( | 513 idl_types.IdlType.constructor_type_name = property( |
483 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 514 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
484 lambda self: strip_suffix(self.base_type, 'Constructor')) | 515 lambda self: strip_suffix(self.base_type, 'Constructor')) |
485 | 516 |
486 | 517 |
487 def is_constructor_attribute(attribute): | 518 def is_constructor_attribute(attribute): |
488 # FIXME: replace this with [ConstructorAttribute] extended attribute | 519 # FIXME: replace this with [ConstructorAttribute] extended attribute |
489 return attribute.idl_type.name.endswith('Constructor') | 520 return attribute.idl_type.name.endswith('Constructor') |
490 | 521 |
491 | 522 |
492 def constructor_getter_context(interface, attribute, context): | 523 def constructor_getter_context(interface, attribute, context): |
493 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] | 524 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] |
OLD | NEW |