Bug 1841609: Handle stack overflow in large regexp tests r=mgaudet

For some reason these are crashing in beta simulation with `InternalError: too much recursion`.

Instead of trying to pick out the precise set of platforms to skip these tests on, I've just wrapped the guilty code in a try-catch. I tested this locally by increasing the size of the regexp enough to make the test throw on x64 as well.

Differential Revision: https://phabricator.services.mozilla.com/D190622
This commit is contained in:
Iain Ireland 2023-10-11 14:22:40 +00:00
Родитель 170eb50d5e
Коммит 159fddc7a2
2 изменённых файлов: 14 добавлений и 6 удалений

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

@ -7,10 +7,14 @@ for (var i = 0; i < 500; ++i) {
input += "a";
}
var r = RegExp(s);
var e = r.exec(input);
try {
var r = RegExp(s);
var e = r.exec(input);
for (var i = 0; i < 500; i++) {
for (var i = 0; i < 500; i++) {
assertEq(e.groups["a" + i], "a");
assertEq(e.groups["b" + i], undefined);
}
} catch (err) {
assertEq(err.message, "too much recursion");
}

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

@ -7,14 +7,18 @@ for (var i = 0; i < 500; ++i) {
input += "a";
}
var r = RegExp(s, "d");
var e = r.exec(input);
try {
var r = RegExp(s, "d");
var e = r.exec(input);
for (var i = 0; i < 500; i++) {
for (var i = 0; i < 500; i++) {
assertEq(e.groups["a" + i], "a");
assertEq(e.groups["b" + i], undefined);
assertEq(e.indices.groups["a" + i][0], i)
assertEq(e.indices.groups["a" + i][1], i + 1)
assertEq(e.indices.groups["b" + i], undefined)
}
} catch (err) {
assertEq(err.message, "too much recursion");
}