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:
Linus Groh 2023-01-10 00:11:24 +00:00 committed by Tim Flynn
parent 63136615d2
commit 7762c1ac61
Notes: sideshowbarker 2024-07-17 06:29:49 +09:00

View file

@ -267,6 +267,8 @@ JS_ENUMERATE_TYPED_ARRAYS
{ \
auto& vm = this->vm(); \
\
VERIFY(!m_##snake_namespace##snake_name##_prototype); \
VERIFY(!m_##snake_namespace##snake_name##_constructor); \
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##_constructor = heap().allocate<Namespace::ConstructorName>(m_realm, m_realm, *typed_array_constructor()); \