1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

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%.
This commit is contained in:
Linus Groh 2021-06-11 00:20:27 +01:00
parent 70fc0a528c
commit 0e38c9b2f7

View file

@ -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<Object*>(global_object.error_constructor())) \
{ \
} \
\