mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
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:
parent
44659f2f2a
commit
4db1712f90
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/awesomekling
Commit: 4db1712f90
Pull-request: https://github.com/SerenityOS/serenity/pull/24035
Issue: https://github.com/SerenityOS/serenity/issues/14612
13 changed files with 95 additions and 34 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue