summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/MarkupGenerator.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-06-08 21:53:36 +0100
committerAndreas Kling <kling@serenityos.org>2021-06-08 23:53:13 +0200
commit83be39c91aeff53c5dfd158844e8ad73f10ae9d2 (patch)
treea7b493153ec3319a886a493a962d6541ae6a4ff9 /Userland/Libraries/LibJS/MarkupGenerator.cpp
parent9b35231453ddcf939dd10c40787ee7e5ef5b5fe0 (diff)
downloadserenity-83be39c91aeff53c5dfd158844e8ad73f10ae9d2.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/MarkupGenerator.cpp')
-rw-r--r--Userland/Libraries/LibJS/MarkupGenerator.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp
index 1b9cd408d1..e4af4f7021 100644
--- a/Userland/Libraries/LibJS/MarkupGenerator.cpp
+++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp
@@ -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);