1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibJS: Handle Proxy with Array target in IsArray() abstract operation

This was missing from Value::is_array(), which is equivalent to the
spec's IsArray() abstract operation - it treats a Proxy value with an
Array target object as being an Array.
It can throw, so needs both the global object and an exception check
now.
This commit is contained in:
Linus Groh 2021-06-08 21:53:36 +01:00 committed by Andreas Kling
parent 9b35231453
commit 83be39c91a
11 changed files with 52 additions and 24 deletions

View file

@ -1669,7 +1669,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
return {};
if (property.type() == ObjectProperty::Type::Spread) {
if (key.is_array()) {
if (key.is_object() && key.as_object().is_array()) {
auto& array_to_spread = static_cast<Array&>(key.as_object());
for (auto& entry : array_to_spread.indexed_properties()) {
object->indexed_properties().put(object, entry.index(), entry.value_and_attributes(&array_to_spread).value);
@ -1695,7 +1695,6 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
return {};
}
}
continue;
}