1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +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:
Linus Groh 2023-01-10 00:11:24 +00:00 committed by Tim Flynn
parent 63136615d2
commit 7762c1ac61

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()); \