LibJS+LibWeb: Make Console, ConsoleClient & subclasses GC-allocated

These objects had confusing ownership semantics. Let's just throw them
all on the GC heap and stop worrying about it.
This commit is contained in:
Andreas Kling 2024-04-20 21:19:51 +02:00
commit 4db1712f90
Notes: sideshowbarker 2024-07-17 06:20:50 +09:00
13 changed files with 95 additions and 34 deletions

View file

@ -13,6 +13,8 @@
namespace Web::HTML {
JS_DEFINE_ALLOCATOR(WorkerDebugConsoleClient);
WorkerDebugConsoleClient::WorkerDebugConsoleClient(JS::Console& console)
: ConsoleClient(console)
{
@ -34,7 +36,7 @@ void WorkerDebugConsoleClient::end_group()
// 2.3. Printer(logLevel, args[, options]), https://console.spec.whatwg.org/#printer
JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::LogLevel log_level, PrinterArguments arguments)
{
auto& vm = m_console.realm().vm();
auto& vm = m_console->realm().vm();
auto indent = TRY_OR_THROW_OOM(vm, String::repeated(' ', m_group_stack_depth * 2));
@ -59,7 +61,7 @@ JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::
}
auto output = TRY(generically_format_values(arguments.get<JS::MarkedVector<JS::Value>>()));
m_console.output_debug_message(log_level, output);
m_console->output_debug_message(log_level, output);
switch (log_level) {
case JS::Console::LogLevel::Debug: