LibJS: Add spec comments to WeakRefPrototype
This commit is contained in:
parent
7c9f1dcced
commit
77fc05afd6
Notes:
sideshowbarker
2024-07-17 06:29:49 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/77fc05afd6 Pull-request: https://github.com/SerenityOS/serenity/pull/18336 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 3 additions and 0 deletions
|
@ -29,8 +29,11 @@ ThrowCompletionOr<void> WeakRefPrototype::initialize(Realm& realm)
|
|||
// 26.1.3.2 WeakRef.prototype.deref ( ), https://tc39.es/ecma262/#sec-weak-ref.prototype.deref
|
||||
JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref)
|
||||
{
|
||||
// 1. Let weakRef be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(weakRef, [[WeakRefTarget]]).
|
||||
auto* weak_ref = TRY(typed_this_object(vm));
|
||||
|
||||
// 3. Return WeakRefDeref(weakRef).
|
||||
weak_ref->update_execution_generation();
|
||||
return weak_ref->value().visit(
|
||||
[](Empty) -> Value { return js_undefined(); },
|
||||
|
|
Loading…
Add table
Reference in a new issue