Correctly handle the Proxy IsCallable and IsConstructor information (#4264)

The `IsCallable(target)` and `IsConstructor(target)` info
can't be stored in the target/handler values.
If the input for the ProxyCreate was a revocable Proxy the original target's
callable/constructor information must be retained even after the
Proxy was revoked.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-11-17 10:38:25 +01:00
committed by GitHub
parent 7262b98021
commit 5d916fb8d4
6 changed files with 99 additions and 8 deletions
@@ -66,6 +66,20 @@ ecma_proxy_create (ecma_value_t target, /**< proxy target */
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;
/* ES2015: 7. */
/* ES11+: 5. */
if (ecma_op_is_callable (target))
{
ECMA_SET_FIRST_BIT_TO_POINTER_TAG (obj_p->u1.property_list_cp);
/* ES2015: 7.b. */
/* ES11+: 5.b. */
if (ecma_is_constructor (target))
{
ECMA_SET_SECOND_BIT_TO_POINTER_TAG (obj_p->u1.property_list_cp);
}
}
/* ES2015: 8. */
/* ES11+: 6. */
proxy_obj_p->target = target;