| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 'number_of_attributes': 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class_name
if attributes else '0', | 60 'number_of_attributes': 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class_name
if attributes else '0', |
| 61 'attribute_templates': '%sAttributes' % v8_class_name if attributes else
'0', | 61 'attribute_templates': '%sAttributes' % v8_class_name if attributes else
'0', |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 def generate_attribute_and_includes(interface, attribute): | 65 def generate_attribute_and_includes(interface, attribute): |
| 66 idl_type = attribute.data_type | 66 idl_type = attribute.data_type |
| 67 extended_attributes = attribute.extended_attributes | 67 extended_attributes = attribute.extended_attributes |
| 68 this_is_keep_alive_for_gc = is_keep_alive_for_gc(attribute) | 68 this_is_keep_alive_for_gc = is_keep_alive_for_gc(attribute) |
| 69 contents = { | 69 contents = { |
| 70 'access_control_list': access_control_list(attribute), |
| 70 'cached_attribute_validation_method': extended_attributes.get('CachedAtt
ribute'), | 71 'cached_attribute_validation_method': extended_attributes.get('CachedAtt
ribute'), |
| 71 'conditional_string': v8_utilities.generate_conditional_string(attribute
), | 72 'conditional_string': v8_utilities.generate_conditional_string(attribute
), |
| 72 'cpp_type': v8_types.cpp_type(idl_type), | 73 'cpp_type': v8_types.cpp_type(idl_type), |
| 73 'idl_type': idl_type, | 74 'idl_type': idl_type, |
| 74 'is_keep_alive_for_gc': this_is_keep_alive_for_gc, | 75 'is_keep_alive_for_gc': this_is_keep_alive_for_gc, |
| 75 'is_nullable': attribute.is_nullable, | 76 'is_nullable': attribute.is_nullable, |
| 76 'is_static': attribute.is_static, | 77 'is_static': attribute.is_static, |
| 77 'name': attribute.name, | 78 'name': attribute.name, |
| 78 'v8_type': v8_types.v8_type(idl_type), | 79 'v8_type': v8_types.v8_type(idl_type), |
| 79 } | 80 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 v8_types.wrapper_type(idl_type) and | 158 v8_types.wrapper_type(idl_type) and |
| 158 # There are some exceptions, however: | 159 # There are some exceptions, however: |
| 159 not( | 160 not( |
| 160 # Node lifetime is managed by object grouping. | 161 # Node lifetime is managed by object grouping. |
| 161 v8_types.dom_node_type(idl_type) or | 162 v8_types.dom_node_type(idl_type) or |
| 162 # A self-reference is unnecessary. | 163 # A self-reference is unnecessary. |
| 163 attribute.name == 'self' or | 164 attribute.name == 'self' or |
| 164 # FIXME: Remove these hard-coded hacks. | 165 # FIXME: Remove these hard-coded hacks. |
| 165 idl_type in ['EventHandler', 'Promise', 'Window'] or | 166 idl_type in ['EventHandler', 'Promise', 'Window'] or |
| 166 idl_type.startswith('HTML')))) | 167 idl_type.startswith('HTML')))) |
| 168 |
| 169 |
| 170 # [DoNotCheckSecurity], [DoNotCheckSecurityOnGetter], [DoNotCheckSecurityOnSette
r] |
| 171 def access_control_list(attribute): |
| 172 extended_attributes = attribute.extended_attributes |
| 173 if 'DoNotCheckSecurity' in extended_attributes: |
| 174 access_control = ['v8::ALL_CAN_READ'] |
| 175 if not attribute.is_read_only: |
| 176 access_control.append('v8::ALL_CAN_WRITE') |
| 177 return access_control |
| 178 if 'DoNotCheckSecurityOnSetter' in extended_attributes: |
| 179 return ['v8::ALL_CAN_WRITE'] |
| 180 if 'DoNotCheckSecurityOnGetter' in extended_attributes: |
| 181 return ['v8::ALL_CAN_READ'] |
| 182 return ['v8::DEFAULT'] |
| OLD | NEW |