From 1adf57530cc7d183eb30401b83b94e2690f074ae Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 13 Oct 2021 22:05:27 +0100 Subject: [PATCH] js: Implement pretty-printing of ShadowRealm --- Userland/Utilities/js.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 0995744b89..2a162ddd6a 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -385,6 +386,12 @@ static void print_array_buffer(JS::Object const& object, HashTable& } } +static void print_shadow_realm(JS::Object const&, HashTable&) +{ + // Not much we can show here that would be useful. Realm pointer address?! + print_type("ShadowRealm"); +} + template static void print_number(T number) requires IsArithmetic { @@ -707,6 +714,8 @@ static void print_value(JS::Value value, HashTable& seen_objects) return print_promise(object, seen_objects); if (is(object)) return print_array_buffer(object, seen_objects); + if (is(object)) + return print_shadow_realm(object, seen_objects); if (object.is_typed_array()) return print_typed_array(object, seen_objects); if (is(object))