summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-04-12 23:15:33 +0200
committerLinus Groh <mail@linusgroh.de>2023-04-13 13:04:44 +0200
commit77fc05afd6b48c562acc668e905f459fa867b88f (patch)
tree05c1036a57d60d8bb14690551fea0859b310b2ae
parent7c9f1dcced0c93b5e0a4363fe466f22dc9c8cf3e (diff)
downloadserenity-77fc05afd6b48c562acc668e905f459fa867b88f.zip
LibJS: Add spec comments to WeakRefPrototype
-rw-r--r--Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp
index c512798bd2..9dc1dee494 100644
--- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp
@@ -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(); },