Fix assertion fail in typedarray_prototype_to locale_string (#4285)
Change typedarray_prototype_to_locale_string_helper to use ecma_op_invoke_magic_id instead JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
This commit is contained in:
@@ -1557,63 +1557,26 @@ static ecma_value_t
|
||||
ecma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_t *info_p, /**< object info */
|
||||
uint32_t index) /** array index */
|
||||
{
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
ecma_value_t element_value = ecma_get_typedarray_element (info_p->buffer_p + index, info_p->id);
|
||||
|
||||
ecma_value_t element_obj = ecma_op_create_number_object (element_value);
|
||||
ecma_value_t call_value = ecma_op_invoke_by_magic_id (element_value, LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, NULL, 0);
|
||||
|
||||
ecma_free_value (element_value);
|
||||
|
||||
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (element_obj));
|
||||
|
||||
ecma_object_t *element_obj_p = ecma_get_object_from_value (element_obj);
|
||||
|
||||
ecma_value_t func_value = ecma_op_object_get_by_magic_id (element_obj_p,
|
||||
LIT_MAGIC_STRING_TO_LOCALE_STRING_UL);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (func_value))
|
||||
if (ECMA_IS_VALUE_ERROR (call_value))
|
||||
{
|
||||
ecma_deref_object (element_obj_p);
|
||||
return func_value;
|
||||
return call_value;
|
||||
}
|
||||
|
||||
if (ecma_op_is_callable (func_value))
|
||||
ecma_string_t *str_p = ecma_op_to_string (call_value);
|
||||
|
||||
ecma_free_value (call_value);
|
||||
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
{
|
||||
ecma_object_t *func_obj = ecma_get_object_from_value (func_value);
|
||||
ecma_value_t call_value = ecma_op_function_call (func_obj,
|
||||
element_obj,
|
||||
NULL,
|
||||
0);
|
||||
|
||||
ecma_deref_object (func_obj);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (call_value))
|
||||
{
|
||||
ecma_deref_object (element_obj_p);
|
||||
return call_value;
|
||||
}
|
||||
|
||||
ecma_string_t *str_p = ecma_op_to_string (call_value);
|
||||
|
||||
ecma_free_value (call_value);
|
||||
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
{
|
||||
ecma_deref_object (element_obj_p);
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_string_value (str_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_free_value (func_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("'toLocaleString' is missing or not a function."));
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_deref_object (element_obj_p);
|
||||
|
||||
return ret_value;
|
||||
return ecma_make_string_value (str_p);
|
||||
} /* ecma_builtin_typedarray_prototype_to_locale_string_helper */
|
||||
|
||||
/**
|
||||
|
||||
@@ -407,16 +407,7 @@
|
||||
<test id="built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/subarray/speciesctor-get-species-returns-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/subarray/speciesctor-get-species.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws.js"><reason></reason></test>
|
||||
|
||||
Reference in New Issue
Block a user