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

Unified Diff: Source/bindings/scripts/v8_types.py

Issue 938733003: IDL: Fix exception handling when converting V8 value to union/dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_union.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 6b76eadd2ed7dc13771662500cd2f0ec0926d251..653f80fb647b3bd3caac6b98afaa7b8a30ea998a 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -594,7 +594,7 @@ def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
# FIXME: this function should be refactored, as this takes too many flags.
-def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name=None, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False, needs_exception_state_for_string=False, restricted_float=False):
+def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name=None, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False, needs_exception_state_for_string=False, restricted_float=False, no_throw=False):
"""Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, raw_type=True)
@@ -605,8 +605,13 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index, isolate, restricted_float=restricted_float)
+ if no_throw:
+ no_throw = '_NOTHROW'
+ else:
+ no_throw = ''
+
if idl_type.is_dictionary or idl_type.is_union_type:
- return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(%s, exceptionState)' % cpp_value
+ return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL%s(%s, exceptionState)' % (no_throw, cpp_value)
if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state:
# Types that need error handling and use one of a group of (C++) macros
@@ -640,6 +645,9 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
else:
suffix += '_INTERNAL'
+ if macro != 'TOSTRING_VOID_EXCEPTIONSTATE':
+ suffix += no_throw
+
return '%s(%s)' % (macro + suffix, ', '.join(args))
# Types that don't need error handling, and simply assign a value to the
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_union.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698