Handle revoked Proxy during [[Get]] operation (#4349)

The handling of Proxy.[[Get]] was not fully correctly in the case when the
Proxy was revoked during the execution of the handler.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-12-04 10:49:40 +01:00
committed by GitHub
parent de37e1e049
commit 89ff0fcf1f
5 changed files with 45 additions and 7 deletions
@@ -920,6 +920,19 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc
if (!ecma_is_value_object (proto))
{
ecma_free_value (proto);
#if ENABLED (JERRY_BUILTIN_PROXY)
if (ECMA_OBJECT_IS_PROXY (ctor_obj_p))
{
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) ctor_obj_p;
if (ecma_is_value_null (proxy_obj_p->handler))
{
ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid."));
return NULL;
}
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
proto_obj_p = ecma_builtin_get (default_proto_id);
ecma_ref_object (proto_obj_p);
}