LibJS: Treat passing undefined as no argument for console labels

- Affects time, timeLog, timeEnd, count, and countReset functions
This commit is contained in:
Gasim Gasimzada 2024-08-08 21:54:14 +02:00 committed by Sam Atkins
commit 8545756d17
Notes: github-actions[bot] 2024-08-09 10:03:23 +00:00

View file

@ -203,7 +203,7 @@ ThrowCompletionOr<Value> Console::dir()
static ThrowCompletionOr<String> label_or_fallback(VM& vm, StringView fallback)
{
return vm.argument_count() > 0
return vm.argument_count() > 0 && !vm.argument(0).is_undefined()
? vm.argument(0).to_string(vm)
: TRY_OR_THROW_OOM(vm, String::from_utf8(fallback));
}