1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +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

@ -58,11 +58,10 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has
seen_objects.set(&value.as_object());
}
if (value.is_array())
return array_to_html(static_cast<const Array&>(value.as_object()), output_html, seen_objects);
if (value.is_object()) {
auto& object = value.as_object();
if (object.is_array())
return array_to_html(static_cast<const Array&>(object), output_html, seen_objects);
output_html.append(wrap_string_in_style(object.class_name(), StyleType::ObjectType));
if (object.is_function())
return function_to_html(object, output_html, seen_objects);