From 0e38c9b2f76bc4877dec7447b700c5651f181ace Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 11 Jun 2021 00:20:27 +0100 Subject: [PATCH] LibJS: Set NativeError constructors' prototype to Error constructor The FunctionPrototype is correct for ErrorConstructor itself: 20.5.2 Properties of the Error Constructor The Error constructor: - has a [[Prototype]] internal slot whose value is %Function.prototype%. However, not for all the other "NativeError" constructors: 20.5.6.2 Properties of the NativeError Constructors Each NativeError constructor: - has a [[Prototype]] internal slot whose value is %Error%. --- 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 22c019a694..ffd20b75c7 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -42,7 +42,7 @@ Value ErrorConstructor::construct(Function&) #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \ ConstructorName::ConstructorName(GlobalObject& global_object) \ - : NativeFunction(*global_object.function_prototype()) \ + : NativeFunction(*static_cast(global_object.error_constructor())) \ { \ } \ \