Index: third_party/WebKit/Source/bindings/scripts/v8_methods.py |
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_methods.py b/third_party/WebKit/Source/bindings/scripts/v8_methods.py |
index ee7fb6cea54892b554a9786332e45ecb1e015725..a029cc38deb0880e7042cdd24ace14039be77eac 100644 |
--- a/third_party/WebKit/Source/bindings/scripts/v8_methods.py |
+++ b/third_party/WebKit/Source/bindings/scripts/v8_methods.py |
@@ -234,6 +234,30 @@ def argument_context(interface, method, argument, index, is_visible=True): |
this_cpp_value = cpp_value(interface, method, index) |
is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
+ # ArrayBufferViews that contain SharedArrayBuffers are not allowed, in |
+ # general. These conditions check various patterns that occur in the IDL |
+ # files. has_array_buffer_view is a catch-all; if a new method is added |
+ # which does not match any specified, it will raise an exception. |
+ is_array_buffer_view = idl_type.is_array_buffer_view |
+ is_flexible_array_buffer_view = ( |
+ 'FlexibleArrayBufferView' in extended_attributes) |
+ is_union_with_abv = ( |
+ idl_type.is_union_type and |
+ any(member_type.is_array_buffer_view |
+ for member_type in idl_type.member_types)) |
+ is_sequence_of_union_with_abv = ( |
+ idl_type.is_array_or_sequence_type and |
+ idl_type.element_type.is_union_type and |
+ any(member_type.is_array_buffer_view |
+ for member_type in idl_type.element_type.member_types)) |
+ has_array_buffer_view = any(t.is_array_buffer_view |
+ for t in idl_type.idl_types()) |
+ |
+ if has_array_buffer_view and not ( |
+ is_array_buffer_view or is_union_with_abv or |
+ is_sequence_of_union_with_abv): |
+ raise Exception('ArrayBufferView in argument with unsupported pattern.') |
+ |
# [LegacyInterfaceTypeChecking] |
has_type_checking_interface = ( |
not is_legacy_interface_type_checking(interface, method) and |
@@ -261,13 +285,17 @@ def argument_context(interface, method, argument, index, is_visible=True): |
'idl_type': idl_type.base_type, |
'idl_type_object': idl_type, |
'index': index, |
+ 'is_array_buffer_view': is_array_buffer_view, |
'is_callback_function': idl_type.is_callback_function, |
'is_callback_interface': idl_type.is_callback_interface, |
# FIXME: Remove generic 'Dictionary' special-casing |
'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictionary', |
'is_explicit_nullable': idl_type.is_explicit_nullable, |
+ 'is_flexible_array_buffer_view': is_flexible_array_buffer_view, |
'is_nullable': idl_type.is_nullable, |
'is_optional': argument.is_optional, |
+ 'is_sequence_of_union_with_array_buffer_view': is_sequence_of_union_with_abv, |
+ 'is_union_with_array_buffer_view': is_union_with_abv, |
'is_variadic': argument.is_variadic, |
'is_variadic_wrapper_type': is_variadic_wrapper_type, |
'is_wrapper_type': idl_type.is_wrapper_type, |