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

Unified Diff: src/regexp.js

Issue 2854025: Bring bugfix of global regexps to the 2.1 branch. (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 | src/version.cc » ('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 dc1b0429f7094c5c4fe80d5af5515c8fd2e5fb91..69cf136d108e1cd21bc30f445dc3919fe4879700 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -213,7 +213,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 | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698