1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

LibJS: Convert ProxyObject::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent 6e386acb11
commit e0818bf21e
3 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ static ThrowCompletionOr<ProxyObject*> proxy_create(VM& vm, Value target, Value
return vm.throw_completion<TypeError>(ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects());
if (!handler.is_object())
return vm.throw_completion<TypeError>(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)

View file

@ -15,9 +15,9 @@
namespace JS {
ProxyObject* ProxyObject::create(Realm& realm, Object& target, Object& handler)
NonnullGCPtr<ProxyObject> ProxyObject::create(Realm& realm, Object& target, Object& handler)
{
return realm.heap().allocate<ProxyObject>(realm, target, handler, *realm.intrinsics().object_prototype());
return *realm.heap().allocate<ProxyObject>(realm, target, handler, *realm.intrinsics().object_prototype());
}
ProxyObject::ProxyObject(Object& target, Object& handler, Object& prototype)

View file

@ -16,7 +16,7 @@ class ProxyObject final : public FunctionObject {
JS_OBJECT(ProxyObject, FunctionObject);
public:
static ProxyObject* create(Realm&, Object& target, Object& handler);
static NonnullGCPtr<ProxyObject> create(Realm&, Object& target, Object& handler);
virtual ~ProxyObject() override = default;