| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 93 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
| 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 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 98 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
| 99 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), | 99 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va
lue(attribute, 'CallWith', 'ExecutionContext'), |
| 100 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), | 100 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a
ttribute, 'CallWith', 'ScriptState'), |
| 101 'is_check_security_for_node': is_check_security_for_node, | 101 'is_check_security_for_node': is_check_security_for_node, |
| 102 'is_custom_element_callbacks': is_custom_element_callbacks, | 102 'is_custom_element_callbacks': is_custom_element_callbacks, |
| 103 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, | 103 'is_expose_js_accessors': should_expose_js_accessors(attribute, interfac
e), |
| 104 'is_getter_raises_exception': # [RaisesException] | 104 'is_getter_raises_exception': # [RaisesException] |
| 105 'RaisesException' in extended_attributes and | 105 'RaisesException' in extended_attributes and |
| 106 extended_attributes['RaisesException'] in (None, 'Getter'), | 106 extended_attributes['RaisesException'] in (None, 'Getter'), |
| 107 'is_implemented_in_private_script': is_implemented_in_private_script, | 107 'is_implemented_in_private_script': is_implemented_in_private_script, |
| 108 'is_initialized_by_event_constructor': | 108 'is_initialized_by_event_constructor': |
| 109 'InitializedByEventConstructor' in extended_attributes, | 109 'InitializedByEventConstructor' in extended_attributes, |
| 110 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), | 110 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), |
| 111 'is_nullable': idl_type.is_nullable, | 111 'is_nullable': idl_type.is_nullable, |
| 112 'is_explicit_nullable': idl_type.is_explicit_nullable, | 112 'is_explicit_nullable': idl_type.is_explicit_nullable, |
| 113 'is_partial_interface_member': | 113 'is_partial_interface_member': |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 | 481 |
| 482 # [Custom], [Custom=Setter] | 482 # [Custom], [Custom=Setter] |
| 483 def has_custom_setter(attribute): | 483 def has_custom_setter(attribute): |
| 484 extended_attributes = attribute.extended_attributes | 484 extended_attributes = attribute.extended_attributes |
| 485 return (not attribute.is_read_only and | 485 return (not attribute.is_read_only and |
| 486 'Custom' in extended_attributes and | 486 'Custom' in extended_attributes and |
| 487 extended_attributes['Custom'] in [None, 'Setter']) | 487 extended_attributes['Custom'] in [None, 'Setter']) |
| 488 | 488 |
| 489 | 489 |
| 490 # [ExposeJSAccessors] |
| 491 def should_expose_js_accessors(attribute, interface): |
| 492 extended_attributes = attribute.extended_attributes |
| 493 |
| 494 # FIXME: We should move all DOM attributes to prototype chains |
| 495 # (except for a couple that really need to stay on instances). |
| 496 # These conditions are a hack to move DOM attributes that we can |
| 497 # move easily to prototype chains. Eventually all the conditions |
| 498 # will be gone. |
| 499 return (not has_custom_getter(attribute) and |
| 500 not has_custom_setter(attribute) and |
| 501 not attribute.is_static and |
| 502 'Replaceable' not in extended_attributes and |
| 503 'Unforgeable' not in extended_attributes and |
| 504 'PutForwards' not in extended_attributes and |
| 505 not v8_utilities.per_context_enabled_function_name(attribute) and |
| 506 not v8_utilities.runtime_enabled_function_name(attribute) and |
| 507 not is_constructor_attribute(attribute) and |
| 508 not interface.name == 'Window' and |
| 509 not interface.name == 'WorkerGlobalScope' and |
| 510 not attribute.idl_type.base_type == 'EventHandler' and |
| 511 not v8_utilities.indexed_property_getter(interface) and |
| 512 not v8_utilities.indexed_property_setter(interface) and |
| 513 not v8_utilities.indexed_property_deleter(interface) and |
| 514 not v8_utilities.named_property_getter(interface) and |
| 515 not v8_utilities.named_property_setter(interface) and |
| 516 not v8_utilities.named_property_deleter(interface) and |
| 517 'OverrideBuiltins' not in interface.extended_attributes) |
| 518 |
| 519 |
| 490 ################################################################################ | 520 ################################################################################ |
| 491 # Constructors | 521 # Constructors |
| 492 ################################################################################ | 522 ################################################################################ |
| 493 | 523 |
| 494 idl_types.IdlType.constructor_type_name = property( | 524 idl_types.IdlType.constructor_type_name = property( |
| 495 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 525 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
| 496 lambda self: strip_suffix(self.base_type, 'Constructor')) | 526 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 497 | 527 |
| 498 | 528 |
| 499 def is_constructor_attribute(attribute): | 529 def is_constructor_attribute(attribute): |
| 500 # FIXME: replace this with [ConstructorAttribute] extended attribute | 530 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 501 return attribute.idl_type.name.endswith('Constructor') | 531 return attribute.idl_type.name.endswith('Constructor') |
| 502 | 532 |
| 503 | 533 |
| 504 def constructor_getter_context(interface, attribute, context): | 534 def constructor_getter_context(interface, attribute, context): |
| 505 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 535 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| OLD | NEW |