tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit eecf1428dd0019a1c4694d203166f5d97dc91baa
parent dce7e1b78eb5c206240f063576c867ba1fd7147b
Author: Meg Ford <meg387@gmail.com>
Date:   Wed, 12 Nov 2025 15:32:54 +0000

Bug 1998512 - Add placeholder `chunks` and `windows` methods to Iterator.prototype. r=dminor

Differential Revision: https://phabricator.services.mozilla.com/D271917

Diffstat:
Mjs/src/builtin/Iterator.js | 18++++++++++++++++++
Mjs/src/vm/CommonPropertyNames.h | 2++
Mjs/src/vm/Iteration.cpp | 4++++
Mjs/src/vm/JSObject.cpp | 6++++++
4 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/js/src/builtin/Iterator.js b/js/src/builtin/Iterator.js @@ -1922,4 +1922,22 @@ function IteratorRange(start, end, optionOrStep) { ThrowTypeError(JSMSG_ITERATOR_RANGE_INVALID_START); } + +/** + * Iterator.prototype.chunks ( chunkSize ) + * + * https://tc39.es/proposal-iterator-chunking/#sec-iterator.prototype.chunks + */ +function IteratorChunks(chunkSize) { + return false; +} + +/** + * Iterator.prototype.windows ( windowSize, undersized ) + * + * https://tc39.es/proposal-iterator-chunking/#sec-iterator.prototype.windows + */ +function IteratorWindows(windowSize, undersized) { + return false; +} #endif diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h @@ -75,6 +75,7 @@ MACRO_(caseFirst, "caseFirst") \ MACRO_(catch_, "catch") \ MACRO_(cause, "cause") \ + MACRO_(chunks, "chunks") \ MACRO_(class_, "class") \ MACRO_(cleanupSome, "cleanupSome") \ MACRO_(collation, "collation") \ @@ -555,6 +556,7 @@ MACRO_(weeksDisplay, "weeksDisplay") \ MACRO_(weeksStyle, "weeksStyle") \ MACRO_(while_, "while") \ + MACRO_(windows, "windows") \ MACRO_(with, "with") \ MACRO_(written, "written") \ MACRO_(toReversed, "toReversed") \ diff --git a/js/src/vm/Iteration.cpp b/js/src/vm/Iteration.cpp @@ -1939,6 +1939,10 @@ static const JSFunctionSpec iterator_methods[] = { #ifdef ENABLE_EXPLICIT_RESOURCE_MANAGEMENT JS_SELF_HOSTED_SYM_FN(dispose, "IteratorDispose", 0, 0), #endif +#ifdef NIGHTLY_BUILD + JS_SELF_HOSTED_FN("chunks", "IteratorChunks", 1, 0), + JS_SELF_HOSTED_FN("windows", "IteratorWindows", 2, 0), +#endif JS_FS_END, }; diff --git a/js/src/vm/JSObject.cpp b/js/src/vm/JSObject.cpp @@ -2245,6 +2245,12 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx, return true; } } + if (key == JSProto_Iterator && !JS::Prefs::experimental_iterator_chunking()) { + if (id == NameToId(cx->names().chunks) || + id == NameToId(cx->names().windows)) { + return true; + } + } #endif if (key == JSProto_Function &&