Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_attributes.py

Issue 2506393004: binding: Makes non-cross-origin-accessible attrs be accessor props. (Closed)
Patch Set: Synced. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 extended_attributes = attribute.extended_attributes 64 extended_attributes = attribute.extended_attributes
65 65
66 idl_type.add_includes_for_type(extended_attributes) 66 idl_type.add_includes_for_type(extended_attributes)
67 if idl_type.enum_values: 67 if idl_type.enum_values:
68 includes.add('core/inspector/ConsoleMessage.h') 68 includes.add('core/inspector/ConsoleMessage.h')
69 69
70 # [CheckSecurity] 70 # [CheckSecurity]
71 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes 71 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes
72 is_check_security_for_receiver = ( 72 is_check_security_for_receiver = (
73 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and 73 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and
74 not is_do_not_check_security) 74 is_do_not_check_security)
75 is_check_security_for_return_value = ( 75 is_check_security_for_return_value = (
76 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) 76 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue'))
77 if is_check_security_for_receiver or is_check_security_for_return_value: 77 if is_check_security_for_receiver or is_check_security_for_return_value:
78 includes.add('bindings/core/v8/BindingSecurity.h') 78 includes.add('bindings/core/v8/BindingSecurity.h')
79 # [Constructor] 79 # [Constructor]
80 # TODO(yukishiino): Constructors are much like methods although constructors 80 # TODO(yukishiino): Constructors are much like methods although constructors
81 # are not methods. Constructors must be data-type properties, and we can 81 # are not methods. Constructors must be data-type properties, and we can
82 # support them as a kind of methods. 82 # support them as a kind of methods.
83 constructor_type = idl_type.constructor_type_name if is_constructor_attribut e(attribute) else None 83 constructor_type = idl_type.constructor_type_name if is_constructor_attribut e(attribute) else None
84 # [CEReactions] 84 # [CEReactions]
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 'has_setter': has_setter(interface, attribute), 143 'has_setter': has_setter(interface, attribute),
144 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 144 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
145 'is_cached_accessor': is_cached_accessor, 145 'is_cached_accessor': is_cached_accessor,
146 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 146 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
147 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 147 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
148 'is_ce_reactions': is_ce_reactions, 148 'is_ce_reactions': is_ce_reactions,
149 'is_check_security_for_receiver': is_check_security_for_receiver, 149 'is_check_security_for_receiver': is_check_security_for_receiver,
150 'is_check_security_for_return_value': is_check_security_for_return_value , 150 'is_check_security_for_return_value': is_check_security_for_return_value ,
151 'is_custom_element_callbacks': is_custom_element_callbacks, 151 'is_custom_element_callbacks': is_custom_element_callbacks,
152 # TODO(yukishiino): Make all DOM attributes accessor-type properties. 152 # TODO(yukishiino): Make all DOM attributes accessor-type properties.
153 'is_data_type_property': not ('CachedAccessor' in extended_attributes) a nd is_data_type_property(interface, attribute), 153 'is_data_type_property': is_data_type_property(interface, attribute),
154 'is_getter_raises_exception': # [RaisesException] 154 'is_getter_raises_exception': # [RaisesException]
155 'RaisesException' in extended_attributes and 155 'RaisesException' in extended_attributes and
156 extended_attributes['RaisesException'] in (None, 'Getter'), 156 extended_attributes['RaisesException'] in (None, 'Getter'),
157 'is_implemented_in_private_script': is_implemented_in_private_script, 157 'is_implemented_in_private_script': is_implemented_in_private_script,
158 'is_keep_alive_for_gc': keep_alive_for_gc, 158 'is_keep_alive_for_gc': keep_alive_for_gc,
159 'is_lenient_this': 'LenientThis' in extended_attributes, 159 'is_lenient_this': 'LenientThis' in extended_attributes,
160 'is_nullable': idl_type.is_nullable, 160 'is_nullable': idl_type.is_nullable,
161 'is_explicit_nullable': idl_type.is_explicit_nullable, 161 'is_explicit_nullable': idl_type.is_explicit_nullable,
162 'is_partial_interface_member': 162 'is_partial_interface_member':
163 'PartialInterfaceImplementedAs' in extended_attributes, 163 'PartialInterfaceImplementedAs' in extended_attributes,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 ################################################################################ 530 ################################################################################
531 531
532 # Property descriptor's {writable: boolean} 532 # Property descriptor's {writable: boolean}
533 def is_writable(attribute): 533 def is_writable(attribute):
534 return (not attribute.is_read_only or 534 return (not attribute.is_read_only or
535 'PutForwards' in attribute.extended_attributes or 535 'PutForwards' in attribute.extended_attributes or
536 'Replaceable' in attribute.extended_attributes) 536 'Replaceable' in attribute.extended_attributes)
537 537
538 538
539 def is_data_type_property(interface, attribute): 539 def is_data_type_property(interface, attribute):
540 if 'CachedAccessor' in attribute.extended_attributes:
541 return False
540 return (is_constructor_attribute(attribute) or 542 return (is_constructor_attribute(attribute) or
541 interface.name == 'Window' or 543 'DoNotCheckSecurity' in attribute.extended_attributes)
542 interface.name == 'Location')
543 544
544 545
545 # [PutForwards], [Replaceable] 546 # [PutForwards], [Replaceable]
546 def has_setter(interface, attribute): 547 def has_setter(interface, attribute):
547 if (is_data_type_property(interface, attribute) and 548 if (is_data_type_property(interface, attribute) and
548 (is_constructor_attribute(attribute) or 549 (is_constructor_attribute(attribute) or
549 'Replaceable' in attribute.extended_attributes)): 550 'Replaceable' in attribute.extended_attributes)):
550 return False 551 return False
551 552
552 return is_writable(attribute) 553 return is_writable(attribute)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 lambda self: strip_suffix(self.base_type, 'Constructor')) 608 lambda self: strip_suffix(self.base_type, 'Constructor'))
608 609
609 610
610 def is_constructor_attribute(attribute): 611 def is_constructor_attribute(attribute):
611 # FIXME: replace this with [ConstructorAttribute] extended attribute 612 # FIXME: replace this with [ConstructorAttribute] extended attribute
612 return attribute.idl_type.name.endswith('Constructor') 613 return attribute.idl_type.name.endswith('Constructor')
613 614
614 615
615 def update_constructor_attribute_context(interface, attribute, context): 616 def update_constructor_attribute_context(interface, attribute, context):
616 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 617 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698