diff options
author | Job Bautista <jobbautista9@protonmail.com> | 2023-01-26 15:20:34 +0800 |
---|---|---|
committer | Job Bautista <jobbautista9@protonmail.com> | 2023-01-26 15:26:32 +0800 |
commit | 997616e30830e6e2c030e7cfc9ca78c0606529eb (patch) | |
tree | a96e0c2eefde8cb408a84bf436b04a79c6cc5369 /js/src/builtin/RegExp.cpp | |
parent | f5761df1c72fc66b9e93e3be48d4ddc74b291cf1 (diff) | |
download | uxp-997616e30830e6e2c030e7cfc9ca78c0606529eb.tar.gz |
Issue #2083 - Part 3: Fix RegExpShared rooting hazards now it's a GC thing.
Based on Mozilla bug 1345177.
Changes from the original bug's patch:
- The original patch didn't have a dotAll for a call to irregexp::ParsePattern,
so let's make our dotAll a member of the MutableHandleRegExpShared re.
- Make RegExpShared::initializeNamedCaptures, introduced in Issue #1285, static.
This resolves a build bustage where static RegExpShared::compile was trying to
use a member function.
Diffstat (limited to 'js/src/builtin/RegExp.cpp')
-rw-r--r-- | js/src/builtin/RegExp.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 33c2854dae..46a2862909 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -164,10 +164,11 @@ CreateRegExpSearchResult(JSContext* cx, const MatchPairs& matches) * steps 3, 9-14, except 12.a.i, 12.c.i.1. */ static RegExpRunStatus -ExecuteRegExpImpl(JSContext* cx, RegExpStatics* res, RegExpShared& re, HandleLinearString input, - size_t searchIndex, MatchPairs* matches, size_t* endIndex) +ExecuteRegExpImpl(JSContext* cx, RegExpStatics* res, MutableHandleRegExpShared re, + HandleLinearString input, size_t searchIndex, MatchPairs* matches, + size_t* endIndex) { - RegExpRunStatus status = re.execute(cx, input, searchIndex, matches, endIndex); + RegExpRunStatus status = RegExpShared::execute(cx, re, input, searchIndex, matches, endIndex); /* Out of spec: Update RegExpStatics. */ if (status == RegExpRunStatus_Success && res) { @@ -175,7 +176,7 @@ ExecuteRegExpImpl(JSContext* cx, RegExpStatics* res, RegExpShared& re, HandleLin if (!res->updateFromMatchPairs(cx, input, *matches)) return RegExpRunStatus_Error; } else { - res->updateLazily(cx, input, &re, searchIndex); + res->updateLazily(cx, input, re, searchIndex); } } return status; @@ -193,7 +194,7 @@ js::ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, Handle<RegExpObject*> ScopedMatchPairs matches(&cx->tempLifoAlloc()); - RegExpRunStatus status = ExecuteRegExpImpl(cx, res, *shared, input, *lastIndex, + RegExpRunStatus status = ExecuteRegExpImpl(cx, res, &shared, input, *lastIndex, &matches, nullptr); if (status == RegExpRunStatus_Error) return false; @@ -1036,7 +1037,7 @@ ExecuteRegExp(JSContext* cx, HandleObject regexp, HandleString string, } /* Steps 3, 11-14, except 12.a.i, 12.c.i.1. */ - RegExpRunStatus status = ExecuteRegExpImpl(cx, res, *re, input, lastIndex, matches, endIndex); + RegExpRunStatus status = ExecuteRegExpImpl(cx, res, &re, input, lastIndex, matches, endIndex); if (status == RegExpRunStatus_Error) return RegExpRunStatus_Error; |