1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibJS: Add spec comments to FinalizationRegistryConstructor

This commit is contained in:
Linus Groh 2023-01-27 21:52:18 +00:00
parent 39301cce70
commit 2473940526

View file

@ -33,6 +33,8 @@ void FinalizationRegistryConstructor::initialize(Realm& realm)
ThrowCompletionOr<Value> FinalizationRegistryConstructor::call()
{
auto& vm = this->vm();
// 1. If NewTarget is undefined, throw a TypeError exception.
return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, vm.names.FinalizationRegistry);
}
@ -41,8 +43,6 @@ ThrowCompletionOr<NonnullGCPtr<Object>> FinalizationRegistryConstructor::constru
{
auto& vm = this->vm();
// NOTE: Step 1 is implemented in FinalizationRegistryConstructor::call()
// 2. If IsCallable(cleanupCallback) is false, throw a TypeError exception.
auto cleanup_callback = vm.argument(0);
if (!cleanup_callback.is_function())