mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2026-02-07 16:51:46 +00:00
Convert fast array to normal array when the prototype is changed (#4198)
If the prototype of a fast array is changed, for example to a Proxy object, the array should be converted back to a normal array. This is required to correctly handle any [[Get]]/[[Set]]/etc... calls which should trigger these method calls on the before mentioned Proxy object. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
parent
d9653823ca
commit
da2299d277
@ -2924,6 +2924,16 @@ ecma_op_ordinary_object_set_prototype_of (ecma_object_t *obj_p, /**< base object
|
|||||||
/* 1. */
|
/* 1. */
|
||||||
JERRY_ASSERT (ecma_is_value_object (proto) || ecma_is_value_null (proto));
|
JERRY_ASSERT (ecma_is_value_object (proto) || ecma_is_value_null (proto));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the prototype of a fast array changes it is required to fall back to
|
||||||
|
* a "normal" array object. This ensures that all [[Get]]/[[Set]]/etc. calls
|
||||||
|
* works as expected.
|
||||||
|
*/
|
||||||
|
if (ecma_op_object_is_fast_array (obj_p))
|
||||||
|
{
|
||||||
|
ecma_fast_array_convert_to_normal (obj_p);
|
||||||
|
}
|
||||||
|
|
||||||
/* 3. */
|
/* 3. */
|
||||||
ecma_object_t *current_proto_p = ECMA_GET_POINTER (ecma_object_t, ecma_op_ordinary_object_get_prototype_of (obj_p));
|
ecma_object_t *current_proto_p = ECMA_GET_POINTER (ecma_object_t, ecma_op_ordinary_object_get_prototype_of (obj_p));
|
||||||
ecma_object_t *new_proto_p = ecma_is_value_null (proto) ? NULL : ecma_get_object_from_value (proto);
|
ecma_object_t *new_proto_p = ecma_is_value_null (proto) ? NULL : ecma_get_object_from_value (proto);
|
||||||
|
|||||||
@ -988,7 +988,6 @@
|
|||||||
<test id="built-ins/Proxy/revocable/revocation-function-nonconstructor.js"><reason></reason></test>
|
<test id="built-ins/Proxy/revocable/revocation-function-nonconstructor.js"><reason></reason></test>
|
||||||
<test id="built-ins/Proxy/revocable/target-is-revoked-function-proxy.js"><reason></reason></test>
|
<test id="built-ins/Proxy/revocable/target-is-revoked-function-proxy.js"><reason></reason></test>
|
||||||
<test id="built-ins/Proxy/revocable/target-is-revoked-proxy.js"><reason></reason></test>
|
<test id="built-ins/Proxy/revocable/target-is-revoked-proxy.js"><reason></reason></test>
|
||||||
<test id="built-ins/Proxy/set/call-parameters-prototype-index.js"><reason></reason></test>
|
|
||||||
<test id="built-ins/Proxy/set/trap-is-not-callable-realm.js"><reason></reason></test>
|
<test id="built-ins/Proxy/set/trap-is-not-callable-realm.js"><reason></reason></test>
|
||||||
<test id="built-ins/Proxy/setPrototypeOf/toboolean-trap-result-false.js"><reason></reason></test>
|
<test id="built-ins/Proxy/setPrototypeOf/toboolean-trap-result-false.js"><reason></reason></test>
|
||||||
<test id="built-ins/Proxy/setPrototypeOf/trap-is-not-callable-realm.js"><reason></reason></test>
|
<test id="built-ins/Proxy/setPrototypeOf/trap-is-not-callable-realm.js"><reason></reason></test>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user