mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibJS: Convert ProxyConstructor functions to ThrowCompletionOr
This commit is contained in:
parent
92bd64cb56
commit
7b5ccbc5ed
Notes:
sideshowbarker
2024-07-18 01:46:02 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/7b5ccbc5ed1 Pull-request: https://github.com/SerenityOS/serenity/pull/10675 Reviewed-by: https://github.com/linusg ✅
2 changed files with 4 additions and 4 deletions
|
@ -34,7 +34,7 @@ void ProxyConstructor::initialize(GlobalObject& global_object)
|
|||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_old_native_function(vm.names.revocable, revocable, 2, attr);
|
||||
define_native_function(vm.names.revocable, revocable, 2, attr);
|
||||
|
||||
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ ThrowCompletionOr<Object*> ProxyConstructor::construct(FunctionObject&)
|
|||
}
|
||||
|
||||
// 28.2.2.1 Proxy.revocable ( target, handler ), https://tc39.es/ecma262/#sec-proxy.revocable
|
||||
JS_DEFINE_OLD_NATIVE_FUNCTION(ProxyConstructor::revocable)
|
||||
JS_DEFINE_NATIVE_FUNCTION(ProxyConstructor::revocable)
|
||||
{
|
||||
auto* proxy = TRY_OR_DISCARD(proxy_create(global_object, vm.argument(0), vm.argument(1)));
|
||||
auto* proxy = TRY(proxy_create(global_object, vm.argument(0), vm.argument(1)));
|
||||
|
||||
// 28.2.2.1.1 Proxy Revocation Functions, https://tc39.es/ecma262/#sec-proxy-revocation-functions
|
||||
auto* revoker = NativeFunction::create(global_object, "", [proxy_handle = make_handle(proxy)](auto&, auto&) -> ThrowCompletionOr<Value> {
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
|
||||
JS_DECLARE_OLD_NATIVE_FUNCTION(revocable);
|
||||
JS_DECLARE_NATIVE_FUNCTION(revocable);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue