mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibJS: Throw if the trap result of OwnPropertyKeys contains duplicates
This commit is contained in:
parent
d577678658
commit
dd27490ee1
4 changed files with 21 additions and 11 deletions
|
@ -57,7 +57,7 @@ size_t length_of_array_like(GlobalObject& global_object, Object const& object)
|
|||
}
|
||||
|
||||
// 7.3.19 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike
|
||||
MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value value, Function<Result<void, ErrorType>(Value)> check_value)
|
||||
MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value value, Function<void(Value)> check_value)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
auto& heap = global_object.heap();
|
||||
|
@ -76,11 +76,9 @@ MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value v
|
|||
if (vm.exception())
|
||||
return MarkedValueList { heap };
|
||||
if (check_value) {
|
||||
auto result = check_value(next);
|
||||
if (result.is_error()) {
|
||||
vm.throw_exception<TypeError>(global_object, result.release_error());
|
||||
check_value(next);
|
||||
if (vm.exception())
|
||||
return MarkedValueList { heap };
|
||||
}
|
||||
}
|
||||
list.append(next);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue