diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 291bf5edb5..e7dcd95d7c 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -21,7 +21,7 @@ static ThrowCompletionOr proxy_create(VM& vm, Value target, Value return vm.throw_completion(ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects()); if (!handler.is_object()) return vm.throw_completion(ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects()); - return ProxyObject::create(realm, target.as_object(), handler.as_object()); + return ProxyObject::create(realm, target.as_object(), handler.as_object()).ptr(); } ProxyConstructor::ProxyConstructor(Realm& realm) diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index a1efa6326e..c8e79102af 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -15,9 +15,9 @@ namespace JS { -ProxyObject* ProxyObject::create(Realm& realm, Object& target, Object& handler) +NonnullGCPtr ProxyObject::create(Realm& realm, Object& target, Object& handler) { - return realm.heap().allocate(realm, target, handler, *realm.intrinsics().object_prototype()); + return *realm.heap().allocate(realm, target, handler, *realm.intrinsics().object_prototype()); } ProxyObject::ProxyObject(Object& target, Object& handler, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.h b/Userland/Libraries/LibJS/Runtime/ProxyObject.h index c7ac85170b..21868c8792 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.h @@ -16,7 +16,7 @@ class ProxyObject final : public FunctionObject { JS_OBJECT(ProxyObject, FunctionObject); public: - static ProxyObject* create(Realm&, Object& target, Object& handler); + static NonnullGCPtr create(Realm&, Object& target, Object& handler); virtual ~ProxyObject() override = default;