Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/regexp.js

Issue 2843024: Less intrusive patch for regexp bug. (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index 79ac44bb0308ad60f8d122488a2a3ae6cd9ff682..f0945b34594433675edc14d66768e2de56760264 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -197,7 +197,6 @@ function RegExpExec(string) {
%_ObjectEquals(cache.regExp, this) &&
%_ObjectEquals(cache.subject, string)) {
if (cache.answerSaved) {
- if (this.global) this.lastIndex = 0;
return CloneRegExpResult(cache.answer);
} else {
saveAnswer = true;
@@ -231,7 +230,10 @@ function RegExpExec(string) {
var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo);
if (matchIndices == null) {
- if (this.global) this.lastIndex = 0;
+ if (this.global) {
+ this.lastIndex = 0;
+ if (lastIndex != 0) return matchIndices;
+ }
cache.lastIndex = lastIndex;
cache.regExp = this;
cache.subject = s;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698