Bug 1749477 - new array methods should be unscopable; r=evilpie

Differential Revision: https://phabricator.services.mozilla.com/D137281
This commit is contained in:
Yulia Startsev 2022-02-01 09:04:02 +00:00
Родитель cb32ea121d
Коммит d64d8cad2e
2 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -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) ||

Просмотреть файл

@ -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)