mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibJS: Only initialize in add_constructor() if not already done
This commit is contained in:
parent
ad3242bab7
commit
2f03eb8628
Notes:
sideshowbarker
2024-07-18 12:25:30 +09:00
Author: https://github.com/linusg
Commit: 2f03eb8628
Pull-request: https://github.com/SerenityOS/serenity/pull/7999
1 changed files with 3 additions and 1 deletions
|
@ -111,7 +111,9 @@ inline void GlobalObject::initialize_constructor(const FlyString& property_name,
|
||||||
template<typename ConstructorType>
|
template<typename ConstructorType>
|
||||||
inline void GlobalObject::add_constructor(const FlyString& property_name, ConstructorType*& constructor, Object* prototype)
|
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);
|
define_property(property_name, constructor, Attribute::Writable | Attribute::Configurable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue