mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Correctly release wrapper object in JSON stringify (#4361)
When an error occurs accessing a property during JSON stringify call the wrapper object is not freed at the correct place. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
parent
fe216d4710
commit
035e5a27fa
@ -1268,6 +1268,7 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
|||||||
|
|
||||||
if (ECMA_IS_VALUE_ERROR (to_json))
|
if (ECMA_IS_VALUE_ERROR (to_json))
|
||||||
{
|
{
|
||||||
|
ecma_free_value (value);
|
||||||
return to_json;
|
return to_json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,3 +51,14 @@ try {
|
|||||||
assert(JSON.stringify("ab𬄕c") === '"ab𬄕\\u001fc"');
|
assert(JSON.stringify("ab𬄕c") === '"ab𬄕\\u001fc"');
|
||||||
assert(JSON.stringify("ab\uDC01cd") === '"ab\\udc01c\\u001fd"');
|
assert(JSON.stringify("ab\uDC01cd") === '"ab\\udc01c\\u001fd"');
|
||||||
assert(JSON.stringify("ab\uDC01cd\uD8331e") === '"ab\\udc01c\\u001fd\\ud8331e"');
|
assert(JSON.stringify("ab\uDC01cd\uD8331e") === '"ab\\udc01c\\u001fd\\ud8331e"');
|
||||||
|
|
||||||
|
// Test case where the proxy is already revoked
|
||||||
|
var handle = Proxy.revocable([], {});
|
||||||
|
handle.revoke();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSON.stringify(handle.proxy);
|
||||||
|
assert(false);
|
||||||
|
} catch (ex) {
|
||||||
|
assert(ex instanceof TypeError);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user