| Index: Source/bindings/scripts/v8_methods.py
|
| diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
|
| index 7d2b9f8c2d185e24f6ce5231ec40a29d1f35be9b..d6059e38bcc4c8fe28e8f4f29446ca7ffadc33d8 100644
|
| --- a/Source/bindings/scripts/v8_methods.py
|
| +++ b/Source/bindings/scripts/v8_methods.py
|
| @@ -197,17 +197,22 @@ def argument_context(interface, method, argument, index):
|
| has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
|
| idl_type.is_wrapper_type)
|
|
|
| - type_checked = (type_checking_interface and
|
| - # These allow null and undefined values, so a type-check is still required.
|
| - not idl_type.is_nullable and
|
| - not (argument.is_optional and
|
| - 'Default' in extended_attributes))
|
| -
|
| if ('ImplementedInPrivateScript' in extended_attributes and
|
| not idl_type.is_wrapper_type and
|
| not idl_type.is_basic_type):
|
| raise Exception('Private scripts supports only primitive types and DOM wrappers.')
|
|
|
| + convert_v8_value_to_local_cpp_value = v8_value_to_local_cpp_value(
|
| + argument, index, return_promise=method.returns_promise)
|
| +
|
| + # "Unsafe" conversion, to use when the argument's type has already been
|
| + # checked. Set to None if same as regular conversion, to avoid emitting
|
| + # duplicate copies of the same code.
|
| + convert_v8_value_to_local_cpp_value_without_type_check = v8_value_to_local_cpp_value(
|
| + argument, index, needs_type_check=False, return_promise=method.returns_promise)
|
| + if convert_v8_value_to_local_cpp_value == convert_v8_value_to_local_cpp_value_without_type_check:
|
| + convert_v8_value_to_local_cpp_value_without_type_check = None
|
| +
|
| default_cpp_value = argument.default_cpp_value
|
| return {
|
| 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes,
|
| @@ -242,7 +247,8 @@ def argument_context(interface, method, argument, index):
|
| creation_context='scriptState->context()->Global()'),
|
| 'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
|
| 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
|
| - 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, type_checked, return_promise=method.returns_promise),
|
| + 'v8_value_to_local_cpp_value': convert_v8_value_to_local_cpp_value,
|
| + 'v8_value_to_local_cpp_value_without_type_check': convert_v8_value_to_local_cpp_value_without_type_check,
|
| 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type),
|
| }
|
|
|
| @@ -370,14 +376,15 @@ def v8_value_to_local_cpp_variadic_value(argument, index, return_promise):
|
| return '%s%s(%s)' % (macro, suffix, ', '.join(macro_args))
|
|
|
|
|
| -def v8_value_to_local_cpp_value(argument, index, type_checked, return_promise=False):
|
| +def v8_value_to_local_cpp_value(argument, index, needs_type_check=True, return_promise=False):
|
| extended_attributes = argument.extended_attributes
|
| idl_type = argument.idl_type
|
| name = argument.name
|
| if argument.is_variadic:
|
| return v8_value_to_local_cpp_variadic_value(argument, index, return_promise)
|
| - return idl_type.v8_value_to_local_cpp_value(extended_attributes, 'info[%s]' % index,
|
| - name, needs_type_check=not type_checked, index=index, declare_variable=False, return_promise=return_promise)
|
| + return idl_type.v8_value_to_local_cpp_value(
|
| + extended_attributes, 'info[%s]' % index, name, needs_type_check=needs_type_check,
|
| + index=index, declare_variable=False, return_promise=return_promise)
|
|
|
|
|
| ################################################################################
|
|
|