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

Unified Diff: test/mjsunit/regexp.js

Issue 2452923002: [regexp] Use SameValue in @@search as specced (Closed)
Patch Set: Created 4 years, 2 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 | « src/builtins/builtins-regexp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regexp.js
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js
index 4087790d01f0f3a76fe43eac107f492a65a0bab7..fd698967c4e4526b9310632496a1bf77e5e99f38 100644
--- a/test/mjsunit/regexp.js
+++ b/test/mjsunit/regexp.js
@@ -739,3 +739,11 @@ const RegExpPrototypeExec = RegExp.prototype.exec;
RegExp.prototype.exec = function() { throw new Error(); }
assertThrows(() => "abc".replace(/./, ""));
RegExp.prototype.exec = RegExpPrototypeExec;
+
+// Test the code path in RE.proto[@@search] when previousLastIndex is a receiver
+// but can't be converted to a primitive. This exposed a crash in the
+// C++ implementation of @@search.
+
+var re = /./;
+re.lastIndex = { [Symbol.toPrimitive]: 42 };
+() => "abc".search(re);
Dan Ehrenberg 2016/11/02 12:03:45 Does this test actually run anything? Did you mean
jgruber 2016/11/07 07:56:18 Good catch, thanks! This line was originally in an
« no previous file with comments | « src/builtins/builtins-regexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698