commit af11b5d57ebfe2eb32c03eef70bd05861b4ed15b
parent d19af0f64f5a734b92608a18544a17fb00af13fa
Author: Daniel Minor <dminor@mozilla.com>
Date: Wed, 17 Dec 2025 17:21:51 +0000
Bug 2003333 - Ship joint iteration; r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D275835
Diffstat:
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/js/src/builtin/Iterator.js b/js/src/builtin/Iterator.js
@@ -1090,7 +1090,6 @@ function* IteratorConcatGenerator(iterables) {
}
}
-#ifdef NIGHTLY_BUILD
/**
* Iterator.zip (iterables [, options])
*
@@ -1670,6 +1669,7 @@ function IteratorCloseAllForException(iters) {
// Step 2. (Performed in caller)
}
+#ifdef NIGHTLY_BUILD
/**
* CreateNumericRangeIterator (start, end, optionOrStep, type)
* Step 18
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
@@ -13425,6 +13425,9 @@ bool SetGlobalOptionsPreJSInit(const OptionParser& op) {
}
JS::Prefs::setAtStartup_experimental_symbols_as_weakmap_keys(
symbolsAsWeakMapKeys);
+ if (op.getBoolOption("enable-joint-iteration")) {
+ JS::Prefs::setAtStartup_experimental_joint_iteration(true);
+ }
#ifdef NIGHTLY_BUILD
if (op.getBoolOption("enable-async-iterator-helpers")) {
@@ -13436,9 +13439,6 @@ bool SetGlobalOptionsPreJSInit(const OptionParser& op) {
if (op.getBoolOption("enable-iterator-range")) {
JS::Prefs::setAtStartup_experimental_iterator_range(true);
}
- if (op.getBoolOption("enable-joint-iteration")) {
- JS::Prefs::setAtStartup_experimental_joint_iteration(true);
- }
if (op.getBoolOption("enable-upsert")) {
JS::Prefs::setAtStartup_experimental_upsert(true);
}
diff --git a/js/src/vm/Iteration.cpp b/js/src/vm/Iteration.cpp
@@ -1955,9 +1955,9 @@ static const JSFunctionSpec iterator_static_methods[] = {
JS_SELF_HOSTED_FN("concat", "IteratorConcat", 0, 0),
#ifdef NIGHTLY_BUILD
JS_SELF_HOSTED_FN("range", "IteratorRange", 3, 0),
+#endif
JS_SELF_HOSTED_FN("zip", "IteratorZip", 2, 0),
JS_SELF_HOSTED_FN("zipKeyed", "IteratorZipKeyed", 2, 0),
-#endif
JS_FS_END,
};
diff --git a/js/src/vm/JSObject.cpp b/js/src/vm/JSObject.cpp
@@ -2206,6 +2206,11 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
id == NameToId(cx->names().concat)) {
return true;
}
+ if (!JS::Prefs::experimental_joint_iteration() &&
+ (id == NameToId(cx->names().zip) ||
+ id == NameToId(cx->names().zipKeyed))) {
+ return true;
+ }
}
#ifdef JS_HAS_INTL_API
@@ -2224,11 +2229,6 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
(id == NameToId(cx->names().range))) {
return true;
}
- if (!JS::Prefs::experimental_joint_iteration() &&
- (id == NameToId(cx->names().zip) ||
- id == NameToId(cx->names().zipKeyed))) {
- return true;
- }
}
if (key == JSProto_Map || key == JSProto_WeakMap) {
if (!JS::Prefs::experimental_upsert() &&
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -9035,11 +9035,18 @@
set_spidermonkey_pref: startup
# Experimental support for Iterator Sequencing in JavaScript.
-- name: javascript.options.experimental.iterator_sequencing
- type: bool
- value: true
- mirror: always
- set_spidermonkey_pref: startup
+- name: javascript.options.experimental.iterator_sequencing
+ type: bool
+ value: true
+ mirror: always
+ set_spidermonkey_pref: startup
+
+ # Experimental support for Joint Iteration in JavaScript.
+- name: javascript.options.experimental.joint_iteration
+ type: bool
+ value: true
+ mirror: always
+ set_spidermonkey_pref: startup
#ifdef NIGHTLY_BUILD
# Experimental support for Async Iterator Helpers in JavaScript.
@@ -9056,13 +9063,6 @@
mirror: always
set_spidermonkey_pref: startup
- # Experimental support for Joint Iteration in JavaScript.
-- name: javascript.options.experimental.joint_iteration
- type: bool
- value: false
- mirror: always
- set_spidermonkey_pref: startup
-
# Experimental support for immutable ArrayBuffers in JavaScript.
- name: javascript.options.experimental.arraybuffer_immutable
type: bool