summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp14
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h3
3 files changed, 14 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
index cc75f71b28..f2189206ae 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
@@ -458,7 +458,7 @@ ThrowCompletionOr<Reference> make_super_property_reference(GlobalObject& global_
// 2. Assert: env.HasSuperBinding() is true.
VERIFY(env.has_super_binding());
// 3. Let baseValue be ? env.GetSuperBase().
- auto base_value = env.get_super_base();
+ auto base_value = TRY(env.get_super_base());
// 4. Let bv be ? RequireObjectCoercible(baseValue).
auto bv = TRY(require_object_coercible(global_object, base_value));
// 5. Return the Reference Record { [[Base]]: bv, [[ReferencedName]]: propertyKey, [[Strict]]: strict, [[ThisValue]]: actualThis }.
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp
index 3ec7edc950..4668640b3c 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp
@@ -5,8 +5,8 @@
*/
#include <LibJS/Interpreter.h>
+#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/FunctionEnvironment.h>
-#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace JS {
@@ -29,13 +29,21 @@ void FunctionEnvironment::visit_edges(Visitor& visitor)
}
// 9.1.1.3.5 GetSuperBase ( ), https://tc39.es/ecma262/#sec-getsuperbase
-Value FunctionEnvironment::get_super_base() const
+ThrowCompletionOr<Value> FunctionEnvironment::get_super_base() const
{
VERIFY(m_function_object);
+
+ // 1. Let home be envRec.[[FunctionObject]].[[HomeObject]].
auto home_object = m_function_object->home_object();
+
+ // 2. If home has the value undefined, return undefined.
if (!home_object)
return js_undefined();
- return TRY_OR_DISCARD(home_object->internal_get_prototype_of());
+
+ // 3. Assert: Type(home) is Object.
+
+ // 4. Return ? home.[[GetPrototypeOf]]().
+ return { TRY(home_object->internal_get_prototype_of()) };
}
// 9.1.1.3.2 HasThisBinding ( ), https://tc39.es/ecma262/#sec-function-environment-records-hasthisbinding
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h
index eaf582e1db..0a2d9e5108 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h
+++ b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h
@@ -6,6 +6,7 @@
#pragma once
+#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/DeclarativeEnvironment.h>
#include <LibJS/Runtime/ECMAScriptFunctionObject.h>
@@ -42,7 +43,7 @@ public:
void set_new_target(Value new_target) { m_new_target = new_target; }
// Abstract operations
- Value get_super_base() const;
+ ThrowCompletionOr<Value> get_super_base() const;
bool has_super_binding() const;
virtual bool has_this_binding() const override;
virtual Value get_this_binding(GlobalObject&) const override;