1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

LibWeb+LibJS: Format Console arguments with JS::Print

Instead of just calling JS::Value::to_string_without_side_effects() when
printing values to the console, have all the console clients use
the same JS::Print that the REPL does to print values.

This method leaves some things to be desired as far as OOM hardening
goes, however. We should be able to create a String in a way that
doesn't OOM on failure so hard.
This commit is contained in:
Andrew Kaster 2023-01-08 10:42:26 -07:00 committed by Linus Groh
parent 0ea697ace5
commit f40094d014
6 changed files with 25 additions and 4 deletions

View file

@ -558,7 +558,7 @@ public:
return JS::js_undefined();
}
auto output = TRY_OR_THROW_OOM(*g_vm, String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>()));
auto output = TRY(generically_format_values(arguments.get<JS::MarkedVector<JS::Value>>()));
#ifdef AK_OS_SERENITY
m_console.output_debug_message(log_level, output);
#endif