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

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: Update new IDL compiler to match 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if is_call_with_script_state: 73 if is_call_with_script_state:
74 includes.add('bindings/v8/ScriptState.h') 74 includes.add('bindings/v8/ScriptState.h')
75 is_check_security_for_node = 'CheckSecurity' in extended_attributes 75 is_check_security_for_node = 'CheckSecurity' in extended_attributes
76 if is_check_security_for_node: 76 if is_check_security_for_node:
77 includes.add('bindings/v8/BindingSecurity.h') 77 includes.add('bindings/v8/BindingSecurity.h')
78 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s 78 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s
79 if is_custom_element_callbacks: 79 if is_custom_element_callbacks:
80 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') 80 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
81 81
82 # Used for 'has_exception_state' (do we have an ExceptionState variable?) 82 # Used for 'has_exception_state' (do we have an ExceptionState variable?)
83 has_serialized_script_value_argument = any( 83 has_exception_raising_argument = any(
Nils Barth (inactive) 2014/01/06 02:58:09 Could you inline this into the value for 'has_ex
sof 2014/01/06 21:01:25 Done.
84 argument for argument in arguments 84 argument for argument in arguments
85 if argument.idl_type == 'SerializedScriptValue') 85 if argument.idl_type == 'SerializedScriptValue' or
86 v8_types.is_integer_type(argument.idl_type))
86 is_check_security_for_frame = ( 87 is_check_security_for_frame = (
87 'CheckSecurity' in interface.extended_attributes and 88 'CheckSecurity' in interface.extended_attributes and
88 'DoNotCheckSecurity' not in extended_attributes) 89 'DoNotCheckSecurity' not in extended_attributes)
89 is_raises_exception = 'RaisesException' in extended_attributes 90 is_raises_exception = 'RaisesException' in extended_attributes
90 91
91 contents = { 92 contents = {
92 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] 93 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging]
93 'arguments': [generate_argument(interface, method, argument, index) 94 'arguments': [generate_argument(interface, method, argument, index)
94 for index, argument in enumerate(arguments)], 95 for index, argument in enumerate(arguments)],
95 'conditional_string': v8_utilities.conditional_string(method), 96 'conditional_string': v8_utilities.conditional_string(method),
96 'cpp_type': v8_types.cpp_type(idl_type), 97 'cpp_type': v8_types.cpp_type(idl_type),
97 'cpp_value': this_cpp_value, 98 'cpp_value': this_cpp_value,
98 'custom_signature': this_custom_signature, 99 'custom_signature': this_custom_signature,
99 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] 100 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
100 'do_not_check_signature': not(this_custom_signature or is_static or 101 'do_not_check_signature': not(this_custom_signature or is_static or
101 v8_utilities.has_extended_attribute(method, 102 v8_utilities.has_extended_attribute(method,
102 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', 103 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable',
103 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), 104 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])),
104 'function_template': function_template(), 105 'function_template': function_template(),
105 'idl_type': idl_type, 106 'idl_type': idl_type,
106 'has_exception_state': 107 'has_exception_state':
107 is_raises_exception or is_check_security_for_frame or 108 is_raises_exception or is_check_security_for_frame or
108 has_serialized_script_value_argument or 109 has_exception_raising_argument or
109 name in ['addEventListener', 'removeEventListener'], 110 name in ['addEventListener', 'removeEventListener'],
110 'has_serialized_script_value_argument': has_serialized_script_value_argu ment,
111 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 111 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
112 'is_call_with_script_arguments': is_call_with_script_arguments, 112 'is_call_with_script_arguments': is_call_with_script_arguments,
113 'is_call_with_script_state': is_call_with_script_state, 113 'is_call_with_script_state': is_call_with_script_state,
114 'is_check_security_for_frame': is_check_security_for_frame, 114 'is_check_security_for_frame': is_check_security_for_frame,
115 'is_check_security_for_node': is_check_security_for_node, 115 'is_check_security_for_node': is_check_security_for_node,
116 'is_custom': 'Custom' in extended_attributes, 116 'is_custom': 'Custom' in extended_attributes,
117 'is_custom_element_callbacks': is_custom_element_callbacks, 117 'is_custom_element_callbacks': is_custom_element_callbacks,
118 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, 118 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
119 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 119 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
120 'is_raises_exception': is_raises_exception, 120 'is_raises_exception': is_raises_exception,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format( 235 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format(
236 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 236 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index)
237 # [Default=NullString] 237 # [Default=NullString]
238 if (argument.is_optional and idl_type == 'DOMString' and 238 if (argument.is_optional and idl_type == 'DOMString' and
239 extended_attributes.get('Default') == 'NullString'): 239 extended_attributes.get('Default') == 'NullString'):
240 v8_value = 'argumentOrNull(info, %s)' % index 240 v8_value = 'argumentOrNull(info, %s)' % index
241 else: 241 else:
242 v8_value = 'info[%s]' % index 242 v8_value = 'info[%s]' % index
243 return v8_types.v8_value_to_local_cpp_value( 243 return v8_types.v8_value_to_local_cpp_value(
244 idl_type, argument.extended_attributes, v8_value, name, index=index) 244 idl_type, argument.extended_attributes, v8_value, name, index=index)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698