1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +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

@ -386,11 +386,10 @@ static void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects)
seen_objects.set(&value.as_object());
}
if (value.is_array())
return print_array(static_cast<JS::Array&>(value.as_object()), seen_objects);
if (value.is_object()) {
auto& object = value.as_object();
if (object.is_array())
return print_array(static_cast<JS::Array&>(object), seen_objects);
if (object.is_function())
return print_function(object, seen_objects);
if (is<JS::Date>(object))