Commit f354558c authored by jgruber's avatar jgruber Committed by Commit bot

[regexp] Fix a test case for RE.proto[@@search]

The test case did not test anything in its original form. Fix it and add
documentation.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2481733002
Cr-Commit-Position: refs/heads/master@{#40794}
parent acd0c3cf
...@@ -741,9 +741,10 @@ assertThrows(() => "abc".replace(/./, "")); ...@@ -741,9 +741,10 @@ assertThrows(() => "abc".replace(/./, ""));
RegExp.prototype.exec = RegExpPrototypeExec; RegExp.prototype.exec = RegExpPrototypeExec;
// Test the code path in RE.proto[@@search] when previousLastIndex is a receiver // 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 // but can't be converted to a primitive. This exposed a crash in an older
// C++ implementation of @@search. // C++ implementation of @@search which a) still relied on Object::Equals,
// and b) incorrectly returned isolate->pending_exception() on error.
var re = /./; var re = /./;
re.lastIndex = { [Symbol.toPrimitive]: 42 }; re.lastIndex = { [Symbol.toPrimitive]: 42 };
() => "abc".search(re); try { "abc".search(re); } catch (_) {} // Ensure we don't crash.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment