mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibJS: Make FunctionObject's m_home_object an Object*, not Value
As the name implies (and the spec confirms), this is only ever going to be an object or "nothing", or "undefined" in the spec. By taking this literally and updating a check to check for `is_undefined()`, we introduced a bug - the value was still initialized as an empty value. Instead, use a pointer to an Object - either we have one, or we don't. Fixes #8448.
This commit is contained in:
parent
83f3f396ad
commit
fe9dc47320
2 changed files with 6 additions and 6 deletions
|
@ -33,9 +33,9 @@ Value FunctionEnvironment::get_super_base() const
|
|||
{
|
||||
VERIFY(m_function_object);
|
||||
auto home_object = m_function_object->home_object();
|
||||
if (home_object.is_undefined())
|
||||
if (!home_object)
|
||||
return js_undefined();
|
||||
return home_object.as_object().internal_get_prototype_of();
|
||||
return home_object->internal_get_prototype_of();
|
||||
}
|
||||
|
||||
// 9.1.1.3.2 HasThisBinding ( ), https://tc39.es/ecma262/#sec-function-environment-records-hasthisbinding
|
||||
|
@ -51,7 +51,7 @@ bool FunctionEnvironment::has_super_binding() const
|
|||
{
|
||||
if (this_binding_status() == ThisBindingStatus::Lexical)
|
||||
return false;
|
||||
if (function_object().home_object().is_undefined())
|
||||
if (!function_object().home_object())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue