Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 131ab02a49787e17a714c936056d84e56682b749 https://github.com/WebKit/WebKit/commit/131ab02a49787e17a714c936056d84e56682b749 Author: Devin Rousso <h...@devinrousso.com> Date: 2025-08-09 (Sat, 09 Aug 2025)
Changed paths: A JSTests/stress/iterator-prototype-sliding.js M Source/JavaScriptCore/builtins/JSIteratorPrototype.js M Source/JavaScriptCore/runtime/JSIteratorPrototype.cpp Log Message: ----------- [JSC] add support for `Iterator.prototype.sliding` https://bugs.webkit.org/show_bug.cgi?id=297163 Reviewed by Yusuke Suzuki. If the number given to `Iterator.prototype.windows` is larger than the number of items in the iterator, the resulting resulting "window" will be empty. ```js ([ 1, 2, 3 ]).values().windows(5) // [ ] ``` Instead using `Iterator.prototype.sliding` it would contain all of the items. ```js ([ 1, 2, 3 ]).values().windows(5) // [ 1, 2, 3 ] ``` Other than that one difference, `Iterator.prototype.sliding` has the same behavior as `Iterator.prototype.windows`. * Source/JavaScriptCore/builtins/JSIteratorPrototype.js: (sliding): Added. * Source/JavaScriptCore/runtime/JSIteratorPrototype.cpp: (JSC::JSIteratorPrototype::finishCreation): * JSTests/stress/iterator-prototype-sliding.js: Added. Canonical link: https://commits.webkit.org/298471@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