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

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

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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_methods.py ('k') | Source/bindings/templates/methods.cpp » ('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 c2ebdcd17f1ec7428f7727a8f514f7d577c96930..1ca7631c8ef85a9400fc9bfc4c11ac834d263bf9 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -523,7 +523,7 @@ def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
return expression
-def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False):
+def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False):
"""Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
# FIXME: Support union type.
@@ -550,6 +550,12 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
# v8::TryCatch.
suffix = ''
+ if return_promise:
+ suffix += '_PROMISE'
+ args.append('info')
+ if macro == 'TONATIVE_VOID_EXCEPTIONSTATE':
+ args.append('ScriptState::current(%s)' % isolate)
+
if declare_variable:
args.insert(0, this_cpp_type)
else:
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698