Fix JSON.stringify (#2759)
There was a wrong check on the property types, it did not check that the property was name accessor. Also fixed a test case. JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
This commit is contained in:
committed by
László Langó
parent
60bbd731e5
commit
9c10d82e4a
@@ -1590,8 +1590,7 @@ ecma_builtin_json_object (ecma_object_t *obj_p, /**< the object*/
|
||||
|
||||
JERRY_ASSERT (ecma_is_property_enumerable (property));
|
||||
|
||||
if (ECMA_PROPERTY_GET_TYPE (property) == ECMA_PROPERTY_TYPE_NAMEDDATA
|
||||
|| ECMA_PROPERTY_GET_TYPE (property) == ECMA_PROPERTY_TYPE_VIRTUAL)
|
||||
if (ECMA_PROPERTY_GET_TYPE (property) != ECMA_PROPERTY_TYPE_SPECIAL)
|
||||
{
|
||||
ecma_append_to_values_collection (property_keys_p, *ecma_value_p, 0);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ function completeAssign (target, sources) {
|
||||
}
|
||||
|
||||
var copy = completeAssign ({}, [obj]);
|
||||
assert (JSON.stringify (copy) === '{"foo":1}');
|
||||
assert (JSON.stringify (copy) === '{"foo":1,"bar":2}');
|
||||
assert (copy.bar === 2);
|
||||
|
||||
// Test when target is not coercible to object
|
||||
|
||||
Reference in New Issue
Block a user