From ecba29c158c1ae916fa59141ec50635f278c30e0 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 15 Mar 2022 14:08:10 +0000 Subject: [PATCH] LibJS: Set internal function name of NativeError constructors By using the same NativeFunction constructor as plain ErrorConstructor and passing the name, TypeError & co. will now include their name in backtraces and such. Eventually we should probably rely on [[InitialName]] for this, but for now that's how it works. --- Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 9f6b879513..5b6da08c72 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -64,7 +64,7 @@ ThrowCompletionOr ErrorConstructor::construct(FunctionObject& new_targe #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \ ConstructorName::ConstructorName(GlobalObject& global_object) \ - : NativeFunction(*static_cast(global_object.error_constructor())) \ + : NativeFunction(vm().names.ClassName.as_string(), *static_cast(global_object.error_constructor())) \ { \ } \ \