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

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

Issue 1380503002: binding: Makes Window/Location's attributes accessor-type properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the test for cross-origin accesses. Created 4 years, 7 months 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 extended_attributes = attribute.extended_attributes 50 extended_attributes = attribute.extended_attributes
51 51
52 idl_type.add_includes_for_type(extended_attributes) 52 idl_type.add_includes_for_type(extended_attributes)
53 if idl_type.enum_values: 53 if idl_type.enum_values:
54 includes.add('core/inspector/ConsoleMessage.h') 54 includes.add('core/inspector/ConsoleMessage.h')
55 55
56 # [CheckSecurity] 56 # [CheckSecurity]
57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes 57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes
58 is_check_security_for_receiver = ( 58 is_check_security_for_receiver = (
59 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and 59 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and
60 not is_do_not_check_security) 60 is_do_not_check_security)
61 is_check_security_for_return_value = ( 61 is_check_security_for_return_value = (
62 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) 62 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue'))
63 if is_check_security_for_receiver or is_check_security_for_return_value: 63 if is_check_security_for_receiver or is_check_security_for_return_value:
64 includes.add('bindings/core/v8/BindingSecurity.h') 64 includes.add('bindings/core/v8/BindingSecurity.h')
65 # [Constructor] 65 # [Constructor]
66 # TODO(yukishiino): Constructors are much like methods although constructors 66 # TODO(yukishiino): Constructors are much like methods although constructors
67 # are not methods. Constructors must be data-type properties, and we can 67 # are not methods. Constructors must be data-type properties, and we can
68 # support them as a kind of methods. 68 # support them as a kind of methods.
69 constructor_type = idl_type.constructor_type_name if is_constructor_attribut e(attribute) else None 69 constructor_type = idl_type.constructor_type_name if is_constructor_attribut e(attribute) else None
70 # [CustomElementCallbacks], [Reflect] 70 # [CustomElementCallbacks], [Reflect]
71 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s 71 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s
72 is_reflect = 'Reflect' in extended_attributes 72 is_reflect = 'Reflect' in extended_attributes
73 if is_custom_element_callbacks or is_reflect: 73 if is_custom_element_callbacks or is_reflect:
74 includes.add('core/dom/custom/V0CustomElementProcessingStack.h') 74 includes.add('core/dom/custom/V0CustomElementProcessingStack.h')
75 # [ImplementedInPrivateScript] 75 # [ImplementedInPrivateScript]
76 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes 76 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes
77 if is_implemented_in_private_script: 77 if is_implemented_in_private_script:
78 includes.add('bindings/core/v8/PrivateScriptRunner.h') 78 includes.add('bindings/core/v8/PrivateScriptRunner.h')
79 includes.add('core/frame/LocalFrame.h') 79 includes.add('core/frame/LocalFrame.h')
80 includes.add('platform/ScriptForbiddenScope.h') 80 includes.add('platform/ScriptForbiddenScope.h')
81 # [OnlyExposedToPrivateScript] 81 # [OnlyExposedToPrivateScript]
82 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes 82 is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended _attributes
83 # [PerWorldBindings] 83 # [PerWorldBindings]
84 if 'PerWorldBindings' in extended_attributes: 84 if 'PerWorldBindings' in extended_attributes:
85 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface .name, attribute.name) 85 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface .name, attribute.name)
86 86
87 if (base_idl_type == 'EventHandler' and 87 if (base_idl_type == 'EventHandler' and
88 interface.name in ['Window', 'WorkerGlobalScope'] and 88 interface.name in ['Window', 'WorkerGlobalScope'] and
89 attribute.name == 'onerror'): 89 attribute.name == 'onerror'):
90 includes.add('bindings/core/v8/V8ErrorHandler.h') 90 includes.add('bindings/core/v8/V8ErrorHandler.h')
91 91
92 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e') 92 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e')
93 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) 93 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
94 if cached_attribute_validation_method or keep_alive_for_gc: 94 if cached_attribute_validation_method or keep_alive_for_gc:
95 includes.add('bindings/core/v8/V8HiddenValue.h') 95 includes.add('bindings/core/v8/V8HiddenValue.h')
96 96
97 context = { 97 context = {
98 'access_control_list': access_control_list(interface, attribute), 98 'access_control_list': access_control_list(interface, attribute),
99 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 99 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
(...skipping 13 matching lines...) Expand all
113 'has_custom_setter': has_custom_setter(attribute), 113 'has_custom_setter': has_custom_setter(attribute),
114 'has_setter': has_setter(interface, attribute), 114 'has_setter': has_setter(interface, attribute),
115 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 115 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
116 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 116 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
117 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 117 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
118 'is_check_security_for_receiver': is_check_security_for_receiver, 118 'is_check_security_for_receiver': is_check_security_for_receiver,
119 'is_check_security_for_return_value': is_check_security_for_return_value , 119 'is_check_security_for_return_value': is_check_security_for_return_value ,
120 'is_custom_element_callbacks': is_custom_element_callbacks, 120 'is_custom_element_callbacks': is_custom_element_callbacks,
121 # TODO(yukishiino): Make all DOM attributes accessor-type properties. 121 # TODO(yukishiino): Make all DOM attributes accessor-type properties.
122 'is_data_type_property': is_data_type_property(interface, attribute), 122 'is_data_type_property': is_data_type_property(interface, attribute),
123 'is_getter_raises_exception': # [RaisesException] 123 'is_getter_raises_exception': ( # [RaisesException]
124 'RaisesException' in extended_attributes and 124 'RaisesException' in extended_attributes and
125 extended_attributes['RaisesException'] in (None, 'Getter'), 125 extended_attributes['RaisesException'] in (None, 'Getter')),
126 'is_implemented_in_private_script': is_implemented_in_private_script, 126 'is_implemented_in_private_script': is_implemented_in_private_script,
127 'is_keep_alive_for_gc': keep_alive_for_gc, 127 'is_keep_alive_for_gc': keep_alive_for_gc,
128 'is_lenient_this': 'LenientThis' in extended_attributes, 128 'is_lenient_this': 'LenientThis' in extended_attributes,
129 'is_nullable': idl_type.is_nullable, 129 'is_nullable': idl_type.is_nullable,
130 'is_explicit_nullable': idl_type.is_explicit_nullable, 130 'is_explicit_nullable': idl_type.is_explicit_nullable,
131 'is_partial_interface_member': 131 'is_partial_interface_member':
132 'PartialInterfaceImplementedAs' in extended_attributes, 132 'PartialInterfaceImplementedAs' in extended_attributes,
133 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 133 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
134 'is_put_forwards': 'PutForwards' in extended_attributes, 134 'is_put_forwards': 'PutForwards' in extended_attributes,
135 'is_read_only': attribute.is_read_only, 135 'is_read_only': attribute.is_read_only,
(...skipping 12 matching lines...) Expand all
148 'only_exposed_to_private_script': is_only_exposed_to_private_script, 148 'only_exposed_to_private_script': is_only_exposed_to_private_script,
149 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 149 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
150 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa lse', isolate='scriptState->isolate()'), 150 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa lse', isolate='scriptState->isolate()'),
151 'property_attributes': property_attributes(interface, attribute), 151 'property_attributes': property_attributes(interface, attribute),
152 'reflect_empty': extended_attributes.get('ReflectEmpty'), 152 'reflect_empty': extended_attributes.get('ReflectEmpty'),
153 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 153 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
154 'reflect_missing': extended_attributes.get('ReflectMissing'), 154 'reflect_missing': extended_attributes.get('ReflectMissing'),
155 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly '), 155 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly '),
156 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] 156 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled]
157 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 157 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
158 'world_suffixes': ['', 'ForMainWorld'] 158 'world_suffixes': (['', 'ForMainWorld']
159 if 'PerWorldBindings' in extended_attributes 159 if 'PerWorldBindings' in extended_attributes
160 else [''], # [PerWorldBindings] 160 else ['']), # [PerWorldBindings]
161 } 161 }
162 162
163 if is_constructor_attribute(attribute): 163 if is_constructor_attribute(attribute):
164 update_constructor_attribute_context(interface, attribute, context) 164 update_constructor_attribute_context(interface, attribute, context)
165 if not has_custom_getter(attribute): 165 if not has_custom_getter(attribute):
166 getter_context(interface, attribute, context) 166 getter_context(interface, attribute, context)
167 if not has_custom_setter(attribute) and has_setter(interface, attribute): 167 if not has_custom_setter(attribute) and has_setter(interface, attribute):
168 setter_context(interface, attribute, context) 168 setter_context(interface, attribute, context)
169 169
170 return context 170 return context
(...skipping 10 matching lines...) Expand all
181 181
182 cpp_value = getter_expression(interface, attribute, context) 182 cpp_value = getter_expression(interface, attribute, context)
183 # Normally we can inline the function call into the return statement to 183 # Normally we can inline the function call into the return statement to
184 # avoid the overhead of using a Ref<> temporary, but for some cases 184 # avoid the overhead of using a Ref<> temporary, but for some cases
185 # (nullable types, EventHandler, [CachedAttribute], or if there are 185 # (nullable types, EventHandler, [CachedAttribute], or if there are
186 # exceptions), we need to use a local variable. 186 # exceptions), we need to use a local variable.
187 # FIXME: check if compilers are smart enough to inline this, and if so, 187 # FIXME: check if compilers are smart enough to inline this, and if so,
188 # always use a local variable (for readability and CG simplicity). 188 # always use a local variable (for readability and CG simplicity).
189 if 'ImplementedInPrivateScript' in extended_attributes: 189 if 'ImplementedInPrivateScript' in extended_attributes:
190 if (not idl_type.is_wrapper_type and 190 if (not idl_type.is_wrapper_type and
191 not idl_type.is_basic_type and 191 not idl_type.is_basic_type and
192 not idl_type.is_enum): 192 not idl_type.is_enum):
193 raise Exception('Private scripts supports only primitive types and D OM wrappers.') 193 raise Exception('Private scripts supports only primitive types and D OM wrappers.')
194 194
195 context['cpp_value_original'] = cpp_value 195 context['cpp_value_original'] = cpp_value
196 cpp_value = 'result' 196 cpp_value = 'result'
197 elif (idl_type.is_explicit_nullable or 197 elif (idl_type.is_explicit_nullable or
198 base_idl_type == 'EventHandler' or 198 base_idl_type == 'EventHandler' or
199 'CachedAttribute' in extended_attributes or 199 'CachedAttribute' in extended_attributes or
200 'ReflectOnly' in extended_attributes or 200 'ReflectOnly' in extended_attributes or
201 context['is_keep_alive_for_gc'] or 201 context['is_keep_alive_for_gc'] or
202 context['is_getter_raises_exception']): 202 context['is_getter_raises_exception']):
203 context['cpp_value_original'] = cpp_value 203 context['cpp_value_original'] = cpp_value
204 cpp_value = 'cppValue' 204 cpp_value = 'cppValue'
205 205
206 def v8_set_return_value_statement(for_main_world=False): 206 def v8_set_return_value_statement(for_main_world=False):
207 if context['is_keep_alive_for_gc'] or 'CachedAttribute' in extended_attr ibutes: 207 if context['is_keep_alive_for_gc'] or 'CachedAttribute' in extended_attr ibutes:
208 return 'v8SetReturnValue(info, v8Value)' 208 return 'v8SetReturnValue(info, v8Value)'
209 return idl_type.v8_set_return_value( 209 return idl_type.v8_set_return_value(
210 cpp_value, extended_attributes=extended_attributes, script_wrappable ='impl', 210 cpp_value, extended_attributes=extended_attributes, script_wrappable ='impl',
211 for_main_world=for_main_world, is_static=attribute.is_static) 211 for_main_world=for_main_world, is_static=attribute.is_static)
212 212
213 def v8_set_return_value_statement_for_security_failure():
214 # In the case that the security check fails, there is no common rule for
215 # the return value. The return value depends on each attribute.
216 # However, we shouldn't return null or undefiend for attributes of type
217 # boolean or DOMString at least. We're making the best guess here.
haraken 2016/04/27 11:08:54 Hmm, this logic looks pretty random. What does Fir
Yuki 2016/04/27 15:09:56 Probably Firefox does what the spec specifies. If
218 if idl_type.is_explicit_nullable:
219 return 'v8SetReturnValueNull(info)'
220 if idl_type.is_boolean_type:
221 return 'v8SetReturnValueBool(info, false)'
222 if idl_type.is_numeric_type:
223 return 'v8SetReturnValueInt(info, 0)'
224 if idl_type.is_string_type:
225 return 'v8SetReturnValueEmptyString(info)'
226 return 'v8SetReturnValueNull(info)'
227
213 context.update({ 228 context.update({
214 'cpp_value': cpp_value, 229 'cpp_value': cpp_value,
215 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 230 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
216 cpp_value=cpp_value, creation_context='holder', 231 cpp_value=cpp_value, creation_context='holder',
217 extended_attributes=extended_attributes), 232 extended_attributes=extended_attributes),
218 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True), 233 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True),
219 'v8_set_return_value': v8_set_return_value_statement(), 234 'v8_set_return_value': v8_set_return_value_statement(),
235 'v8_set_return_value_for_security_failure':
236 v8_set_return_value_statement_for_security_failure(),
220 }) 237 })
221 238
239
222 def getter_expression(interface, attribute, context): 240 def getter_expression(interface, attribute, context):
223 arguments = [] 241 arguments = []
224 this_getter_base_name = getter_base_name(interface, attribute, arguments) 242 this_getter_base_name = getter_base_name(interface, attribute, arguments)
225 getter_name = scoped_name(interface, attribute, this_getter_base_name) 243 getter_name = scoped_name(interface, attribute, this_getter_base_name)
226 244
227 if 'ImplementedInPrivateScript' in attribute.extended_attributes: 245 if 'ImplementedInPrivateScript' in attribute.extended_attributes:
228 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G etCurrentContext()))') 246 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G etCurrentContext()))')
229 arguments.append('impl') 247 arguments.append('impl')
230 arguments.append('&result') 248 arguments.append('&result')
231 arguments.extend(v8_utilities.call_with_arguments( 249 arguments.extend(v8_utilities.call_with_arguments(
232 attribute.extended_attributes.get('CallWith'))) 250 attribute.extended_attributes.get('CallWith')))
233 # Members of IDL partial interface definitions are implemented in C++ as 251 # Members of IDL partial interface definitions are implemented in C++ as
234 # static member functions, which for instance members (non-static members) 252 # static member functions, which for instance members (non-static members)
235 # take *impl as their first argument 253 # take *impl as their first argument
236 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and 254 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and
237 not 'ImplementedInPrivateScript' in attribute.extended_attributes and 255 'ImplementedInPrivateScript' not in attribute.extended_attributes an d
238 not attribute.is_static): 256 not attribute.is_static):
239 arguments.append('*impl') 257 arguments.append('*impl')
240 if attribute.idl_type.is_explicit_nullable: 258 if attribute.idl_type.is_explicit_nullable:
241 arguments.append('isNull') 259 arguments.append('isNull')
242 if context['is_getter_raises_exception']: 260 if context['is_getter_raises_exception']:
243 arguments.append('exceptionState') 261 arguments.append('exceptionState')
244 if attribute.idl_type.use_output_parameter_for_result: 262 if attribute.idl_type.use_output_parameter_for_result:
245 arguments.append('result') 263 arguments.append('result')
246 264
247 expression = '%s(%s)' % (getter_name, ', '.join(arguments)) 265 expression = '%s(%s)' % (getter_name, ', '.join(arguments))
248 # Needed to handle getter expressions returning Type& as the 266 # Needed to handle getter expressions returning Type& as the
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 extended_attributes.get('SetterCallWith') or 384 extended_attributes.get('SetterCallWith') or
367 extended_attributes.get('CallWith')) 385 extended_attributes.get('CallWith'))
368 386
369 this_setter_base_name = setter_base_name(interface, attribute, arguments) 387 this_setter_base_name = setter_base_name(interface, attribute, arguments)
370 setter_name = scoped_name(interface, attribute, this_setter_base_name) 388 setter_name = scoped_name(interface, attribute, this_setter_base_name)
371 389
372 # Members of IDL partial interface definitions are implemented in C++ as 390 # Members of IDL partial interface definitions are implemented in C++ as
373 # static member functions, which for instance members (non-static members) 391 # static member functions, which for instance members (non-static members)
374 # take *impl as their first argument 392 # take *impl as their first argument
375 if ('PartialInterfaceImplementedAs' in extended_attributes and 393 if ('PartialInterfaceImplementedAs' in extended_attributes and
376 not 'ImplementedInPrivateScript' in extended_attributes and 394 'ImplementedInPrivateScript' not in extended_attributes and
377 not attribute.is_static): 395 not attribute.is_static):
378 arguments.append('*impl') 396 arguments.append('*impl')
379 idl_type = attribute.idl_type 397 idl_type = attribute.idl_type
380 if 'ImplementedInPrivateScript' in extended_attributes: 398 if 'ImplementedInPrivateScript' in extended_attributes:
381 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G etCurrentContext()))') 399 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G etCurrentContext()))')
382 arguments.append('impl') 400 arguments.append('impl')
383 arguments.append('cppValue') 401 arguments.append('cppValue')
384 elif idl_type.base_type == 'EventHandler': 402 elif idl_type.base_type == 'EventHandler':
385 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) 403 getter_name = scoped_name(interface, attribute, cpp_name(attribute))
386 context['event_handler_getter_expression'] = '%s(%s)' % ( 404 context['event_handler_getter_expression'] = '%s(%s)' % (
387 getter_name, ', '.join(arguments)) 405 getter_name, ', '.join(arguments))
388 if (interface.name in ['Window', 'WorkerGlobalScope'] and 406 if (interface.name in ['Window', 'WorkerGlobalScope'] and
389 attribute.name == 'onerror'): 407 attribute.name == 'onerror'):
390 includes.add('bindings/core/v8/V8ErrorHandler.h') 408 includes.add('bindings/core/v8/V8ErrorHandler.h')
391 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') 409 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))')
392 else: 410 else:
393 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') 411 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)')
394 else: 412 else:
395 arguments.append('cppValue') 413 arguments.append('cppValue')
396 if context['is_setter_raises_exception']: 414 if context['is_setter_raises_exception']:
397 arguments.append('exceptionState') 415 arguments.append('exceptionState')
398 416
399 return '%s(%s)' % (setter_name, ', '.join(arguments)) 417 return '%s(%s)' % (setter_name, ', '.join(arguments))
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 454
437 # Property descriptor's {writable: boolean} 455 # Property descriptor's {writable: boolean}
438 def is_writable(attribute): 456 def is_writable(attribute):
439 return (not attribute.is_read_only or 457 return (not attribute.is_read_only or
440 'PutForwards' in attribute.extended_attributes or 458 'PutForwards' in attribute.extended_attributes or
441 'Replaceable' in attribute.extended_attributes) 459 'Replaceable' in attribute.extended_attributes)
442 460
443 461
444 def is_data_type_property(interface, attribute): 462 def is_data_type_property(interface, attribute):
445 return (is_constructor_attribute(attribute) or 463 return (is_constructor_attribute(attribute) or
446 interface.name == 'Window' or 464 'DoNotCheckSecurity' in attribute.extended_attributes)
447 interface.name == 'Location')
448 465
449 466
450 # [PutForwards], [Replaceable] 467 # [PutForwards], [Replaceable]
451 def has_setter(interface, attribute): 468 def has_setter(interface, attribute):
452 if (is_data_type_property(interface, attribute) and 469 if (is_data_type_property(interface, attribute) and
453 (is_constructor_attribute(attribute) or 470 (is_constructor_attribute(attribute) or
454 'Replaceable' in attribute.extended_attributes)): 471 'Replaceable' in attribute.extended_attributes)):
455 return False 472 return False
456 473
457 return is_writable(attribute) 474 return is_writable(attribute)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 lambda self: strip_suffix(self.base_type, 'Constructor')) 529 lambda self: strip_suffix(self.base_type, 'Constructor'))
513 530
514 531
515 def is_constructor_attribute(attribute): 532 def is_constructor_attribute(attribute):
516 # FIXME: replace this with [ConstructorAttribute] extended attribute 533 # FIXME: replace this with [ConstructorAttribute] extended attribute
517 return attribute.idl_type.name.endswith('Constructor') 534 return attribute.idl_type.name.endswith('Constructor')
518 535
519 536
520 def update_constructor_attribute_context(interface, attribute, context): 537 def update_constructor_attribute_context(interface, attribute, context):
521 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] or context['origin_trial_enabled_function'] # TODO(chasej): Should/can this be true when OriginTrialEnabled is inherited from containing in terface? 538 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] or context['origin_trial_enabled_function'] # TODO(chasej): Should/can this be true when OriginTrialEnabled is inherited from containing in terface?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698