From 2f03eb8628dbb2d6c643c09309d92237dd0152fc Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 11 Jun 2021 18:03:24 +0100 Subject: [PATCH] LibJS: Only initialize in add_constructor() if not already done --- Userland/Libraries/LibJS/Runtime/GlobalObject.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h index 96bd795c08..910f3f17b1 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h @@ -111,7 +111,9 @@ inline void GlobalObject::initialize_constructor(const FlyString& property_name, template inline void GlobalObject::add_constructor(const FlyString& property_name, ConstructorType*& constructor, Object* prototype) { - initialize_constructor(property_name, constructor, prototype); + // Some constructors are pre-initialized separately. + if (!constructor) + initialize_constructor(property_name, constructor, prototype); define_property(property_name, constructor, Attribute::Writable | Attribute::Configurable); }