mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibJS: Close iterator on throw completion in Array.from
This regressed in #10190
This commit is contained in:
parent
99bc429f3f
commit
5f80d8245d
Notes:
sideshowbarker
2024-07-18 03:30:54 +09:00
Author: https://github.com/IdanHo
Commit: 5f80d8245d
Pull-request: https://github.com/SerenityOS/serenity/pull/10192
Reviewed-by: https://github.com/davidot ✅
1 changed files with 3 additions and 2 deletions
|
@ -149,11 +149,12 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from)
|
|||
|
||||
Value mapped_value;
|
||||
if (map_fn) {
|
||||
mapped_value = TRY_OR_DISCARD(vm.call(*map_fn, this_arg, next_value, Value(k)));
|
||||
if (vm.exception()) {
|
||||
auto mapped_value_or_error = vm.call(*map_fn, this_arg, next_value, Value(k));
|
||||
if (mapped_value_or_error.is_error()) {
|
||||
iterator_close(*iterator);
|
||||
return {};
|
||||
}
|
||||
mapped_value = mapped_value_or_error.release_value();
|
||||
} else {
|
||||
mapped_value = next_value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue