mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibJS: Verify that objects are only initialized once
We already do this in a couple of other places, we wouldn't ever want to re-assign already initialized constructor and prototype objects.
This commit is contained in:
parent
63136615d2
commit
7762c1ac61
Notes:
sideshowbarker
2024-07-17 06:29:49 +09:00
Author: https://github.com/linusg
Commit: 7762c1ac61
Pull-request: https://github.com/SerenityOS/serenity/pull/16939
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 2 additions and 0 deletions
|
@ -267,6 +267,8 @@ JS_ENUMERATE_TYPED_ARRAYS
|
||||||
{ \
|
{ \
|
||||||
auto& vm = this->vm(); \
|
auto& vm = this->vm(); \
|
||||||
\
|
\
|
||||||
|
VERIFY(!m_##snake_namespace##snake_name##_prototype); \
|
||||||
|
VERIFY(!m_##snake_namespace##snake_name##_constructor); \
|
||||||
if constexpr (IsTypedArrayConstructor<Namespace::ConstructorName>) { \
|
if constexpr (IsTypedArrayConstructor<Namespace::ConstructorName>) { \
|
||||||
m_##snake_namespace##snake_name##_prototype = heap().allocate<Namespace::PrototypeName>(m_realm, *typed_array_prototype()); \
|
m_##snake_namespace##snake_name##_prototype = heap().allocate<Namespace::PrototypeName>(m_realm, *typed_array_prototype()); \
|
||||||
m_##snake_namespace##snake_name##_constructor = heap().allocate<Namespace::ConstructorName>(m_realm, m_realm, *typed_array_constructor()); \
|
m_##snake_namespace##snake_name##_constructor = heap().allocate<Namespace::ConstructorName>(m_realm, m_realm, *typed_array_constructor()); \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue