Prechádzať zdrojové kódy

LibJS: Treat passing undefined as no argument for console labels

- Affects time, timeLog, timeEnd, count, and countReset functions
Gasim Gasimzada 11 mesiacov pred
rodič
commit
8545756d17
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      Userland/Libraries/LibJS/Console.cpp

+ 1 - 1
Userland/Libraries/LibJS/Console.cpp

@@ -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));
 }