1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibJS: Only initialize in add_constructor() if not already done

This commit is contained in:
Linus Groh 2021-06-11 18:03:24 +01:00
parent ad3242bab7
commit 2f03eb8628

View file

@ -111,7 +111,9 @@ inline void GlobalObject::initialize_constructor(const FlyString& property_name,
template<typename ConstructorType>
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);
}