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

Unified Diff: src/regexp.js

Issue 2826020: Fix bug in regexp exec with global regexps. (Closed)
Patch Set: Addressed review comment. 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 | test/mjsunit/regress/regress-45469.js » ('j') | 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 9367f15f91d88cd36ae6e83b43f1945061166ee5..79ac44bb0308ad60f8d122488a2a3ae6cd9ff682 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -197,6 +197,7 @@ 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;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-45469.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698