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

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

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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 # [CheckSecurity] 50 # [CheckSecurity]
51 is_check_security_for_node = 'CheckSecurity' in extended_attributes 51 is_check_security_for_node = 'CheckSecurity' in extended_attributes
52 if is_check_security_for_node: 52 if is_check_security_for_node:
53 includes.add('bindings/v8/BindingSecurity.h') 53 includes.add('bindings/v8/BindingSecurity.h')
54 # [Custom] 54 # [Custom]
55 has_custom_getter = ('Custom' in extended_attributes and 55 has_custom_getter = ('Custom' in extended_attributes and
56 extended_attributes['Custom'] in [None, 'Getter']) 56 extended_attributes['Custom'] in [None, 'Getter'])
57 has_custom_setter = (not attribute.is_read_only and 57 has_custom_setter = (not attribute.is_read_only and
58 'Custom' in extended_attributes and 58 'Custom' in extended_attributes and
59 extended_attributes['Custom'] in [None, 'Setter']) 59 extended_attributes['Custom'] in [None, 'Setter'])
60
61 has_strict_type_checking = (
62 'StrictTypeChecking' in extended_attributes and
63 v8_types.is_interface_type(idl_type))
64
65 is_setter_raises_exception = (
66 'RaisesException' in extended_attributes and
67 extended_attributes['RaisesException'] in [None, 'Setter'])
68
60 # [Reflect] 69 # [Reflect]
61 is_reflect = 'Reflect' in extended_attributes 70 is_reflect = 'Reflect' in extended_attributes
62 if is_reflect: 71 if is_reflect:
63 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') 72 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
64 73
65 if (idl_type == 'EventHandler' and 74 if (idl_type == 'EventHandler' and
66 interface.name in ['Window', 'WorkerGlobalScope'] and 75 interface.name in ['Window', 'WorkerGlobalScope'] and
67 attribute.name == 'onerror'): 76 attribute.name == 'onerror'):
68 includes.add('bindings/v8/V8ErrorHandler.h') 77 includes.add('bindings/v8/V8ErrorHandler.h')
69 78
70 contents = { 79 contents = {
71 'access_control_list': access_control_list(attribute), 80 'access_control_list': access_control_list(attribute),
72 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 81 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
73 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 82 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
74 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 83 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
75 'conditional_string': v8_utilities.conditional_string(attribute), 84 'conditional_string': v8_utilities.conditional_string(attribute),
76 'constructor_type': v8_types.constructor_type(idl_type) 85 'constructor_type': v8_types.constructor_type(idl_type)
77 if is_constructor_attribute(attribute) else None, 86 if is_constructor_attribute(attribute) else None,
78 'cpp_name': cpp_name(attribute), 87 'cpp_name': cpp_name(attribute),
79 'cpp_type': v8_types.cpp_type(idl_type), 88 'cpp_type': v8_types.cpp_type(idl_type),
80 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 89 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
81 'enum_validation_expression': 90 'enum_validation_expression':
82 v8_utilities.enum_validation_expression(idl_type), 91 v8_utilities.enum_validation_expression(idl_type),
83 'has_custom_getter': has_custom_getter, 92 'has_custom_getter': has_custom_getter,
84 'has_custom_setter': has_custom_setter, 93 'has_custom_setter': has_custom_setter,
85 'has_strict_type_checking': ( 94 'has_strict_type_checking': has_strict_type_checking,
86 'StrictTypeChecking' in extended_attributes and
87 v8_types.is_interface_type(idl_type)),
88 'idl_type': idl_type, 95 'idl_type': idl_type,
89 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'), 96 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'),
90 'is_check_security_for_node': is_check_security_for_node, 97 'is_check_security_for_node': is_check_security_for_node,
91 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, 98 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
92 'is_getter_raises_exception': ( # [RaisesException] 99 'is_getter_raises_exception': ( # [RaisesException]
93 'RaisesException' in extended_attributes and 100 'RaisesException' in extended_attributes and
94 extended_attributes['RaisesException'] in [None, 'Getter']), 101 extended_attributes['RaisesException'] in [None, 'Getter']),
95 'is_initialized_by_event_constructor': 102 'is_initialized_by_event_constructor':
96 'InitializedByEventConstructor' in extended_attributes, 103 'InitializedByEventConstructor' in extended_attributes,
97 'is_keep_alive_for_gc': is_keep_alive_for_gc(attribute), 104 'is_keep_alive_for_gc': is_keep_alive_for_gc(attribute),
98 'is_nullable': attribute.is_nullable, 105 'is_nullable': attribute.is_nullable,
99 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 106 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
100 'is_read_only': attribute.is_read_only, 107 'is_read_only': attribute.is_read_only,
101 'is_reflect': is_reflect, 108 'is_reflect': is_reflect,
102 'is_replaceable': 'Replaceable' in attribute.extended_attributes, 109 'is_replaceable': 'Replaceable' in attribute.extended_attributes,
103 'is_setter_raises_exception': ( 110 'is_setter_raises_exception': is_setter_raises_exception,
104 'RaisesException' in extended_attributes and 111 'has_setter_exception_state': (
105 extended_attributes['RaisesException'] in [None, 'Setter']), 112 is_setter_raises_exception or has_strict_type_checking or
113 v8_types.is_integer_type(idl_type)),
106 'is_static': attribute.is_static, 114 'is_static': attribute.is_static,
107 'is_unforgeable': 'Unforgeable' in extended_attributes, 115 'is_unforgeable': 'Unforgeable' in extended_attributes,
108 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] 116 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs]
109 'name': attribute.name, 117 'name': attribute.name,
110 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled] 118 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled]
111 'property_attributes': property_attributes(attribute), 119 'property_attributes': property_attributes(attribute),
112 'setter_callback': setter_callback_name(interface, attribute), 120 'setter_callback': setter_callback_name(interface, attribute),
113 'v8_type': v8_types.v8_type(idl_type), 121 'v8_type': v8_types.v8_type(idl_type),
114 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] 122 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled]
115 'world_suffixes': ['', 'ForMainWorld'] 123 'world_suffixes': ['', 'ForMainWorld']
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 property_attributes_list.append('v8::DontEnum') 330 property_attributes_list.append('v8::DontEnum')
323 if 'Unforgeable' in extended_attributes: 331 if 'Unforgeable' in extended_attributes:
324 property_attributes_list.append('v8::DontDelete') 332 property_attributes_list.append('v8::DontDelete')
325 return property_attributes_list or ['v8::None'] 333 return property_attributes_list or ['v8::None']
326 334
327 335
328 # Constructors 336 # Constructors
329 337
330 def is_constructor_attribute(attribute): 338 def is_constructor_attribute(attribute):
331 return attribute.idl_type.endswith('Constructor') 339 return attribute.idl_type.endswith('Constructor')
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/scripts/unstable/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698