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/vm/RegExpStatics.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/vm/RegExpStatics.cpp')
-rw-r--r-- | js/src/vm/RegExpStatics.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/js/src/vm/RegExpStatics.cpp b/js/src/vm/RegExpStatics.cpp index 27bc988db6..7073e084fd 100644 --- a/js/src/vm/RegExpStatics.cpp +++ b/js/src/vm/RegExpStatics.cpp @@ -81,7 +81,8 @@ RegExpStatics::executeLazy(JSContext* cx) /* Retrieve or create the RegExpShared in this compartment. */ RootedRegExpShared shared(cx); - if (!cx->compartment()->regExps.get(cx, lazySource, lazyFlags, &shared)) + RootedAtom source(cx, lazySource); + if (!cx->compartment()->regExps.get(cx, source, lazyFlags, &shared)) return false; /* @@ -91,7 +92,8 @@ RegExpStatics::executeLazy(JSContext* cx) /* Execute the full regular expression. */ RootedLinearString input(cx, matchesInput); - RegExpRunStatus status = shared->execute(cx, input, lazyIndex, &this->matches, nullptr); + RegExpRunStatus status = RegExpShared::execute(cx, &shared, input, lazyIndex, &this->matches, + nullptr); if (status == RegExpRunStatus_Error) return false; |