diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-24 16:01:06 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-24 16:01:06 +0100 |
commit | 5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3 (patch) | |
tree | 5818ef1493eb4531162f5dc6e193f5227caf9049 /js/src/builtin/RegExpLocalReplaceOpt.h.js | |
parent | aae3a117342e8959c074ea9f36cefac772f608d3 (diff) | |
download | UXP-5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3.tar UXP-5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3.tar.gz UXP-5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3.tar.lz UXP-5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3.tar.xz UXP-5fd5b2ac2f396eb1d8707a691aa26ad159ad25e3.zip |
Bug 1317397: Only set lastIndex for global or sticky RegExps in RegExpBuiltinExec per ES2017
Diffstat (limited to 'js/src/builtin/RegExpLocalReplaceOpt.h.js')
-rw-r--r-- | js/src/builtin/RegExpLocalReplaceOpt.h.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/js/src/builtin/RegExpLocalReplaceOpt.h.js b/js/src/builtin/RegExpLocalReplaceOpt.h.js index 96451d8a0..1acd6a73a 100644 --- a/js/src/builtin/RegExpLocalReplaceOpt.h.js +++ b/js/src/builtin/RegExpLocalReplaceOpt.h.js @@ -11,7 +11,7 @@ // * FUNCTIONAL -- replaceValue is a function // * neither of above -- replaceValue is a string without "$" -// ES 2017 draft 03bfda119d060aca4099d2b77cf43f6d4f11cfa2 21.2.5.8 +// ES 2017 draft 6390c2f1b34b309895d31d8c0512eac8660a0210 21.2.5.8 // steps 11.a-16. // Optimized path for @@replace with the following conditions: // * global flag is false @@ -36,8 +36,10 @@ function FUNC_NAME(rx, S, lengthS, replaceValue if (globalOrSticky) { // 21.2.5.2.2 RegExpBuiltinExec, step 12.a. if (lastIndex > lengthS) { - // FIXME: Implement changes for bug 1317397. - rx.lastIndex = 0; + if (globalOrSticky) + rx.lastIndex = 0; + + // Steps 12-16. return S; } } else { @@ -51,8 +53,8 @@ function FUNC_NAME(rx, S, lengthS, replaceValue // Step 11.b. if (result === null) { // 21.2.5.2.2 RegExpBuiltinExec, steps 12.a.i, 12.c.i. - // FIXME: Implement changes for bug 1317397. - rx.lastIndex = 0; + if (globalOrSticky) + rx.lastIndex = 0; // Steps 12-16. return S; |