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

Side by Side Diff: Source/bindings/scripts/unstable/v8_methods.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') 64 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState')
65 if is_call_with_script_state: 65 if is_call_with_script_state:
66 includes.add('bindings/v8/ScriptState.h') 66 includes.add('bindings/v8/ScriptState.h')
67 is_check_security_for_node = 'CheckSecurity' in extended_attributes 67 is_check_security_for_node = 'CheckSecurity' in extended_attributes
68 if is_check_security_for_node: 68 if is_check_security_for_node:
69 includes.add('bindings/v8/BindingSecurity.h') 69 includes.add('bindings/v8/BindingSecurity.h')
70 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s 70 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s
71 if is_custom_element_callbacks: 71 if is_custom_element_callbacks:
72 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') 72 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
73 73
74 # Used for 'has_exception_state' (do we have an ExceptionState variable?)
75 has_serialized_script_value_argument = any(
76 argument for argument in arguments
77 if argument.idl_type == 'SerializedScriptValue')
78 is_check_security_for_frame = ( 74 is_check_security_for_frame = (
79 'CheckSecurity' in interface.extended_attributes and 75 'CheckSecurity' in interface.extended_attributes and
80 'DoNotCheckSecurity' not in extended_attributes) 76 'DoNotCheckSecurity' not in extended_attributes)
81 is_raises_exception = 'RaisesException' in extended_attributes 77 is_raises_exception = 'RaisesException' in extended_attributes
82 78
83 contents = { 79 contents = {
84 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] 80 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging]
85 'arguments': [generate_argument(interface, method, argument, index) 81 'arguments': [generate_argument(interface, method, argument, index)
86 for index, argument in enumerate(arguments)], 82 for index, argument in enumerate(arguments)],
87 'conditional_string': v8_utilities.conditional_string(method), 83 'conditional_string': v8_utilities.conditional_string(method),
88 'cpp_type': v8_types.cpp_type(idl_type), 84 'cpp_type': v8_types.cpp_type(idl_type),
89 'cpp_value': this_cpp_value, 85 'cpp_value': this_cpp_value,
90 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] 86 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
91 'do_not_check_signature': not(is_static or 87 'do_not_check_signature': not(is_static or
92 v8_utilities.has_extended_attribute(method, 88 v8_utilities.has_extended_attribute(method,
93 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', 89 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable',
94 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), 90 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])),
95 'function_template': function_template(), 91 'function_template': function_template(),
96 'idl_type': idl_type, 92 'idl_type': idl_type,
97 'has_exception_state': 93 'has_exception_state':
98 is_raises_exception or is_check_security_for_frame or 94 is_raises_exception or
99 has_serialized_script_value_argument or 95 is_check_security_for_frame or
96 any(argument for argument in arguments
97 if argument.idl_type == 'SerializedScriptValue' or
98 v8_types.is_integer_type(argument.idl_type)) or
100 name in ['addEventListener', 'removeEventListener'], 99 name in ['addEventListener', 'removeEventListener'],
101 'has_serialized_script_value_argument': has_serialized_script_value_argu ment,
102 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 100 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
103 'is_call_with_script_arguments': is_call_with_script_arguments, 101 'is_call_with_script_arguments': is_call_with_script_arguments,
104 'is_call_with_script_state': is_call_with_script_state, 102 'is_call_with_script_state': is_call_with_script_state,
105 'is_check_security_for_frame': is_check_security_for_frame, 103 'is_check_security_for_frame': is_check_security_for_frame,
106 'is_check_security_for_node': is_check_security_for_node, 104 'is_check_security_for_node': is_check_security_for_node,
107 'is_custom': 'Custom' in extended_attributes, 105 'is_custom': 'Custom' in extended_attributes,
108 'is_custom_element_callbacks': is_custom_element_callbacks, 106 'is_custom_element_callbacks': is_custom_element_callbacks,
109 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, 107 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
110 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 108 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
111 'is_raises_exception': is_raises_exception, 109 'is_raises_exception': is_raises_exception,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format( 202 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format(
205 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 203 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index)
206 # [Default=NullString] 204 # [Default=NullString]
207 if (argument.is_optional and idl_type == 'DOMString' and 205 if (argument.is_optional and idl_type == 'DOMString' and
208 extended_attributes.get('Default') == 'NullString'): 206 extended_attributes.get('Default') == 'NullString'):
209 v8_value = 'argumentOrNull(info, %s)' % index 207 v8_value = 'argumentOrNull(info, %s)' % index
210 else: 208 else:
211 v8_value = 'info[%s]' % index 209 v8_value = 'info[%s]' % index
212 return v8_types.v8_value_to_local_cpp_value( 210 return v8_types.v8_value_to_local_cpp_value(
213 idl_type, argument.extended_attributes, v8_value, name, index=index) 211 idl_type, argument.extended_attributes, v8_value, name, index=index)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_attributes.py ('k') | Source/bindings/scripts/unstable/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698