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

Side by Side Diff: Source/bindings/scripts/unstable/v8_attributes.py

Issue 27476003: IDL compiler: [Unforgeable] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 # [DeprecateAs] 131 # [DeprecateAs]
132 v8_utilities.generate_deprecate_as(attribute, contents, includes) 132 v8_utilities.generate_deprecate_as(attribute, contents, includes)
133 if is_check_security_for_node or is_getter_raises_exception: 133 if is_check_security_for_node or is_getter_raises_exception:
134 includes.update(set(['bindings/v8/ExceptionMessages.h', 134 includes.update(set(['bindings/v8/ExceptionMessages.h',
135 'bindings/v8/ExceptionState.h'])) 135 'bindings/v8/ExceptionState.h']))
136 136
137 contents.update({ 137 contents.update({
138 'activity_logging_getter': v8_utilities.has_activity_logging(attribute, includes, 'Getter'), # [ActivityLogging] 138 'activity_logging_getter': v8_utilities.has_activity_logging(attribute, includes, 'Getter'), # [ActivityLogging]
139 'is_check_security_for_node': is_check_security_for_node, 139 'is_check_security_for_node': is_check_security_for_node,
140 'is_getter_raises_exception': is_getter_raises_exception, 140 'is_getter_raises_exception': is_getter_raises_exception,
141 'is_unforgeable': 'Unforgeable' in extended_attributes,
141 }) 142 })
142 143
143 return contents, includes 144 return contents, includes
144 145
145 146
146 def getter_expression(interface, attribute, contents, includes): 147 def getter_expression(interface, attribute, contents, includes):
147 arguments = [] 148 arguments = []
148 if 'Reflect' in attribute.extended_attributes: 149 if 'Reflect' in attribute.extended_attributes:
149 getter_base_name = content_attribute_getter_base_name(attribute, include s, arguments) 150 getter_base_name = content_attribute_getter_base_name(attribute, include s, arguments)
150 else: 151 else:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 not( 207 not(
207 # Node lifetime is managed by object grouping. 208 # Node lifetime is managed by object grouping.
208 v8_types.dom_node_type(idl_type) or 209 v8_types.dom_node_type(idl_type) or
209 # A self-reference is unnecessary. 210 # A self-reference is unnecessary.
210 attribute.name == 'self' or 211 attribute.name == 'self' or
211 # FIXME: Remove these hard-coded hacks. 212 # FIXME: Remove these hard-coded hacks.
212 idl_type in ['EventHandler', 'Promise', 'Window'] or 213 idl_type in ['EventHandler', 'Promise', 'Window'] or
213 idl_type.startswith('HTML')))) 214 idl_type.startswith('HTML'))))
214 215
215 216
216 # [DoNotCheckSecurity], [DoNotCheckSecurityOnGetter], [DoNotCheckSecurityOnSette r] 217 # [DoNotCheckSecurity], [DoNotCheckSecurityOnGetter], [DoNotCheckSecurityOnSette r], [Unforgeable]
217 def access_control_list(attribute): 218 def access_control_list(attribute):
218 extended_attributes = attribute.extended_attributes 219 extended_attributes = attribute.extended_attributes
220 access_control = []
219 if 'DoNotCheckSecurity' in extended_attributes: 221 if 'DoNotCheckSecurity' in extended_attributes:
220 access_control = ['v8::ALL_CAN_READ'] 222 access_control.append('v8::ALL_CAN_READ')
221 if not attribute.is_read_only: 223 if not attribute.is_read_only:
222 access_control.append('v8::ALL_CAN_WRITE') 224 access_control.append('v8::ALL_CAN_WRITE')
223 return access_control
224 if 'DoNotCheckSecurityOnSetter' in extended_attributes: 225 if 'DoNotCheckSecurityOnSetter' in extended_attributes:
225 return ['v8::ALL_CAN_WRITE'] 226 access_control.append('v8::ALL_CAN_WRITE')
226 if 'DoNotCheckSecurityOnGetter' in extended_attributes: 227 if 'DoNotCheckSecurityOnGetter' in extended_attributes:
227 return ['v8::ALL_CAN_READ'] 228 access_control.append('v8::ALL_CAN_READ')
228 return ['v8::DEFAULT'] 229 if 'Unforgeable' in extended_attributes:
230 access_control.append('v8::PROHIBITS_OVERWRITING')
231 return access_control or ['v8::DEFAULT']
229 232
230 233
231 # [NotEnumerable] 234 # [NotEnumerable], [Unforgeable]
232 def property_attributes(attribute): 235 def property_attributes(attribute):
236 extended_attributes = attribute.extended_attributes
233 property_attributes_list = [] 237 property_attributes_list = []
234 if 'NotEnumerable' in attribute.extended_attributes: 238 if 'NotEnumerable' in extended_attributes:
235 property_attributes_list.append('v8::DontEnum') 239 property_attributes_list.append('v8::DontEnum')
240 if 'Unforgeable' in extended_attributes:
241 property_attributes_list.append('v8::DontDelete')
236 return property_attributes_list or ['v8::None'] 242 return property_attributes_list or ['v8::None']
237 243
238 244
239 # [PerWorldBindings] 245 # [PerWorldBindings]
240 def getter_for_main_world(interface, attribute): 246 def getter_for_main_world(interface, attribute):
241 if 'PerWorldBindings' not in attribute.extended_attributes: 247 if 'PerWorldBindings' not in attribute.extended_attributes:
242 return '0' 248 return '0'
243 return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) 249 return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name)
244 250
245 251
246 def setter_for_main_world(interface, attribute): 252 def setter_for_main_world(interface, attribute):
247 if ('PerWorldBindings' not in attribute.extended_attributes or 253 if ('PerWorldBindings' not in attribute.extended_attributes or
248 attribute.is_read_only): 254 attribute.is_read_only):
249 return '0' 255 return '0'
250 return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) 256 return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698