Backed out changeset 2a44daf61d7f (bug 1640479) for build bustages on bug1640479.js. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-05-27 23:20:51 +03:00
parent e7258ec672
commit 5c6bd8bcfd
3 changed files with 5 additions and 17 deletions

View File

@ -1,13 +0,0 @@
var failures = 0;
var i = 0;
function foo() {
var e;
var r = RegExp("(?<_" + (i++) + "a>)");
try { e = r.exec("a"); } catch {}
e = r.exec("a");
if (e.groups === undefined) failures++;
}
oomTest(foo);
assertEq(failures, 0);

View File

@ -480,16 +480,16 @@ bool CompilePattern(JSContext* cx, MutableHandleRegExpShared re,
return true;
}
}
// Add one to account for the whole-match capture
uint32_t pairCount = data.capture_count + 1;
re->useRegExpMatch(pairCount);
if (!data.capture_name_map.is_null()) {
RootedNativeObject namedCaptures(cx, data.capture_name_map->inner());
if (!RegExpShared::initializeNamedCaptures(cx, re, namedCaptures)) {
return false;
}
}
// All fallible initialization has succeeded, so we can change state.
// Add one to capture_count to account for the whole-match capture.
uint32_t pairCount = data.capture_count + 1;
re->useRegExpMatch(pairCount);
}
MOZ_ASSERT(re->kind() == RegExpShared::Kind::RegExp);

View File

@ -1137,6 +1137,7 @@ void RegExpShared::useRegExpMatch(size_t pairCount) {
/* static */
bool RegExpShared::initializeNamedCaptures(JSContext* cx, HandleRegExpShared re,
HandleNativeObject namedCaptures) {
MOZ_ASSERT(re->kind() == RegExpShared::Kind::RegExp);
MOZ_ASSERT(!re->groupsTemplate_);
MOZ_ASSERT(!re->namedCaptureIndices_);