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

Unified Diff: Source/bindings/scripts/unstable/v8_types.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/unstable/v8_types.py
diff --git a/Source/bindings/scripts/unstable/v8_types.py b/Source/bindings/scripts/unstable/v8_types.py
index 131b804ce9e7c792218028e3314687d19c046e8d..7de6daa67b5cf00824915e613e7905897d1453b6 100644
--- a/Source/bindings/scripts/unstable/v8_types.py
+++ b/Source/bindings/scripts/unstable/v8_types.py
@@ -57,7 +57,13 @@ BASIC_TYPES = set([
# unrestricted float is not supported
'double',
# unrestricted double is not supported
- # integer types
+ # http://www.w3.org/TR/WebIDL/#idl-types
+ 'DOMString',
+ 'Date',
+ # http://www.w3.org/TR/WebIDL/#es-type-mapping
+ 'void',
+])
+INTEGER_TYPES = set([
# http://www.w3.org/TR/WebIDL/#dfn-integer-type
'byte',
'octet',
@@ -68,12 +74,8 @@ BASIC_TYPES = set([
'unsigned long',
'long long',
'unsigned long long',
- # http://www.w3.org/TR/WebIDL/#idl-types
- 'DOMString',
- 'Date',
- # http://www.w3.org/TR/WebIDL/#es-type-mapping
- 'void',
])
+BASIC_TYPES.update(INTEGER_TYPES)
enum_types = {} # name -> values
callback_function_types = set()
@@ -92,6 +94,10 @@ def is_basic_type(idl_type):
return idl_type in BASIC_TYPES
+def is_integer_type(idl_type):
+ return idl_type in INTEGER_TYPES
+
+
def is_callback_function_type(idl_type):
return idl_type in callback_function_types
@@ -377,8 +383,10 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index):
add_includes_for_type(idl_type)
if 'EnforceRange' in extended_attributes:
- arguments = ', '.join([v8_value, 'EnforceRange', 'ok'])
- else: # NormalConversion
+ arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState'])
+ elif is_integer_type(idl_type): # NormalConversion
+ arguments = ', '.join([v8_value, 'exceptionState'])
+ else:
arguments = v8_value
if idl_type in V8_VALUE_TO_CPP_VALUE:
@@ -421,8 +429,8 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
idl_type = preprocess_idl_type(idl_type)
if idl_type == 'DOMString':
format_string = 'V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID({cpp_type}, {variable_name}, {cpp_value})'
- elif 'EnforceRange' in extended_attributes:
- format_string = 'V8TRYCATCH_WITH_TYPECHECK_VOID({cpp_type}, {variable_name}, {cpp_value}, info.GetIsolate())'
+ elif is_integer_type(idl_type):
+ format_string = 'V8TRYCATCH_EXCEPTION_VOID({cpp_type}, {variable_name}, {cpp_value}, exceptionState)'
else:
format_string = 'V8TRYCATCH_VOID({cpp_type}, {variable_name}, {cpp_value})'
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698