Bound function 'length' property should be early initialized (#4421)

This patch fixes #4402.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-01-07 12:10:54 +01:00
committed by GitHub
parent fc701aef6d
commit 6dfd02a08c
2 changed files with 25 additions and 4 deletions
@@ -301,7 +301,8 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
ecma_deref_object (prototype_obj_p);
}
ecma_value_t target_length = ecma_make_integer_value (0);
bound_func_p->target_length = ecma_make_integer_value (0);
ecma_string_t *len_string = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_property_descriptor_t prop_desc;
ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p,
@@ -332,13 +333,11 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
{
ecma_number_t len_num;
ecma_op_to_integer (len_value, &len_num);
target_length = ecma_make_number_value (len_num);
bound_func_p->target_length = ecma_make_number_value (len_num);
}
ecma_free_value (len_value);
}
bound_func_p->target_length = target_length;
/* 12. */
ecma_value_t name_value = ecma_op_object_get_by_magic_id (this_arg_obj_p, LIT_MAGIC_STRING_NAME);
if (ECMA_IS_VALUE_ERROR (name_value))