diff --git a/js/src/builtin/Array.cpp b/js/src/builtin/Array.cpp index 46068590c8dc..9034aa72fe1c 100644 --- a/js/src/builtin/Array.cpp +++ b/js/src/builtin/Array.cpp @@ -4128,6 +4128,15 @@ static bool array_proto_finish(JSContext* cx, JS::HandleObject ctor, return false; } +#ifdef NIGHTLY_BUILD + if (cx->realm()->creationOptions().getArrayGroupingEnabled()) { + if (!DefineDataProperty(cx, unscopables, cx->names().groupBy, value) || + !DefineDataProperty(cx, unscopables, cx->names().groupByToMap, value)) { + return false; + } + } +#endif + #ifdef ENABLE_CHANGE_ARRAY_BY_COPY if (cx->options().changeArrayByCopy()) { if (!DefineDataProperty(cx, unscopables, cx->names().withAt, value) || diff --git a/js/src/tests/non262/Array/unscopables.js b/js/src/tests/non262/Array/unscopables.js index 7f17a4b37a09..226b7314dab1 100644 --- a/js/src/tests/non262/Array/unscopables.js +++ b/js/src/tests/non262/Array/unscopables.js @@ -44,6 +44,11 @@ if (getBuildConfiguration()['change-array-by-copy'] && getRealmConfiguration().e expectedKeys.push("withAt", "withReversed", "withSorted", "withSpliced"); } +if (!getBuildConfiguration().release_or_beta && getRealmConfiguration().enableArrayGrouping) { + expectedKeys.push("groupBy", "groupByToMap"); + expectedKeys.sort(); +} + assertDeepEq(keys, expectedKeys); for (let key of keys)