[[DefaultValue]] should be called twice when setting object as Array length

In section 15.4.5.1, both step 3.c and 3.d should call [[DefaultValue]].

JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
This commit is contained in:
Youngil Choi
2016-08-24 23:06:40 +09:00
committed by Eunji Jeong
parent db176aa01d
commit 98cec9afb8
2 changed files with 25 additions and 0 deletions
@@ -198,6 +198,13 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
uint32_t new_len_uint32 = ecma_number_to_uint32 (new_len_num);
// d.
if (ecma_is_value_object (property_desc_p->value))
{
ecma_value_t compared_num_val = ecma_op_to_number (property_desc_p->value);
new_len_num = ecma_get_number_from_value (compared_num_val);
ecma_free_value (compared_num_val);
}
if (((ecma_number_t) new_len_uint32) != new_len_num)
{
return ecma_raise_range_error (ECMA_ERR_MSG (""));