RESOLVED FIXED297532
[JSC] Fix `Iterator#flatMap` to handle iterators without `return` method
https://bugs.webkit.org/show_bug.cgi?id=297532
Summary [JSC] Fix `Iterator#flatMap` to handle iterators without `return` method
Sosuke Suzuki
Reported 2025-08-18 07:30:19 PDT
According to the spec, IteratorClose should check if the return method exists before calling it, returning the completion value unchanged when the method is undefined. However, the current implementation of Iterator.prototype.flatMap unconditionally calls iterated.return(), causing a TypeError when used with iterators that don't have a return method (e.g., Map.prototype.entries(), Set.prototype.values()). This patch fixes the issue by checking if the return method exists before calling it. original report https://github.com/oven-sh/bun/issues/17518
Attachments
Sosuke Suzuki
Comment 1 2025-08-18 07:31:08 PDT
EWS
Comment 2 2025-08-20 10:41:37 PDT
Committed 298966@main (c4fa114ca0b7): <https://commits.webkit.org/298966@main> Reviewed commits have been landed. Closing PR #49530 and removing active labels.
Radar WebKit Bug Importer
Comment 3 2025-08-20 10:42:13 PDT
Note You need to log in before you can comment on or make changes to this bug.