1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibJS: Make length_of_array_like() take an Object rather than Value

The pseudo-code from the spec says "Assert: Type(obj) is Object.", so we
can just enforce this at compile time rather than taking it literally
and doing "ASSERT(value.is_object())".

Also fix an issue where the absence of a "length" property on the object
would cause a crash (to_number() on empty value).
This commit is contained in:
Linus Groh 2021-01-10 14:08:27 +01:00 committed by Andreas Kling
parent a5e557472c
commit 9be0b664e3
3 changed files with 10 additions and 9 deletions

View file

@ -341,7 +341,7 @@ bool same_value(Value lhs, Value rhs);
bool same_value_zero(Value lhs, Value rhs);
bool same_value_non_numeric(Value lhs, Value rhs);
TriState abstract_relation(GlobalObject&, bool left_first, Value lhs, Value rhs);
size_t length_of_array_like(GlobalObject&, Value);
size_t length_of_array_like(GlobalObject&, const Object&);
}