Fix adding fast arrays as keys to a weak container (#3362)
Fixes #3359. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
committed by
Zoltan Herczeg
parent
2e8a8f5caa
commit
16d0e83b64
@@ -411,6 +411,11 @@ static void
|
||||
ecma_op_container_set_weak (ecma_object_t *const key_p, /**< key object */
|
||||
ecma_extended_object_t *const container_p) /**< container */
|
||||
{
|
||||
if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (key_p)))
|
||||
{
|
||||
ecma_fast_array_convert_to_normal (key_p);
|
||||
}
|
||||
|
||||
ecma_string_t *weak_refs_string_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_WEAK_REFS);
|
||||
ecma_property_t *property_p = ecma_find_named_property (key_p, weak_refs_string_p);
|
||||
ecma_collection_t *refs_p;
|
||||
|
||||
@@ -135,6 +135,8 @@ try {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
m1.set([], []);
|
||||
|
||||
assert (WeakMap.prototype.toString() === "[object WeakMap]");
|
||||
|
||||
WeakMap.prototype.set = function () { throw "abrupt set" };
|
||||
|
||||
@@ -119,6 +119,8 @@ try {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
m1.add([]);
|
||||
|
||||
assert (WeakSet.prototype.toString() === "[object WeakSet]");
|
||||
|
||||
WeakSet.prototype.add = function () { throw "abrupt add" };
|
||||
|
||||
Reference in New Issue
Block a user