LibWeb: Split JS wrapper constructors into construct/initialize

This commit is contained in:
Andreas Kling 2020-06-20 17:28:13 +02:00
commit 03da70c7d0
Notes: sideshowbarker 2024-07-19 05:31:37 +09:00
31 changed files with 107 additions and 55 deletions

View file

@ -49,8 +49,10 @@ private:
template<class NativeObject>
inline Wrapper* wrap_impl(JS::Heap& heap, NativeObject& native_object)
{
if (!native_object.wrapper())
native_object.set_wrapper(*heap.allocate<typename NativeObject::WrapperType>(heap.interpreter().global_object(), native_object));
if (!native_object.wrapper()) {
auto& global_object = heap.interpreter().global_object();
native_object.set_wrapper(*heap.allocate<typename NativeObject::WrapperType>(global_object, global_object, native_object));
}
return native_object.wrapper();
}