Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: c4fa114ca0b70c47a1c64a6cdb4695b4b2281b55 https://github.com/WebKit/WebKit/commit/c4fa114ca0b70c47a1c64a6cdb4695b4b2281b55 Author: Sosuke Suzuki <sos...@bun.sh> Date: 2025-08-20 (Wed, 20 Aug 2025)
Changed paths: A JSTests/stress/iterator-prototype-flatMap-return-method.js M Source/JavaScriptCore/builtins/JSIteratorPrototype.js Log Message: ----------- [JSC] Fix `Iterator#flatMap` to handle iterators without `return` method https://bugs.webkit.org/show_bug.cgi?id=297532 Reviewed by Keith Miller. 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. * JSTests/stress/iterator-prototype-flatMap-return-method.js: Added. (shouldBe): (throw.new.Error): (shouldBe.let.baseIterator.get return): (shouldBe.set result): (shouldBe.let.set new): * Source/JavaScriptCore/builtins/JSIteratorPrototype.js: (flatMap.iteratedWrapper.return): Canonical link: https://commits.webkit.org/298966@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes