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

Unified Diff: test/mjsunit/es6/string-replace.js

Issue 2845153002: [string] Fix null handling in MaybeCallFunctionAtSymbol (Closed)
Patch Set: Clarify comments Created 3 years, 8 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-string-gen.cc ('k') | test/mjsunit/es6/string-split.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/string-replace.js
diff --git a/test/mjsunit/es6/string-replace.js b/test/mjsunit/es6/string-replace.js
index 0beb57a5368607af0ead51fb3f1d334c2c41b664..16cadc5369f9d57d693137f0f8c014da65096703 100644
--- a/test/mjsunit/es6/string-replace.js
+++ b/test/mjsunit/es6/string-replace.js
@@ -3,7 +3,8 @@
// found in the LICENSE file.
var pattern = {
- [Symbol.replace]: (string, newValue) => string + newValue
+ [Symbol.replace]: (string, newValue) => string + newValue,
+ toString: () => "c"
};
// Check object coercible fails.
assertThrows(() => String.prototype.replace.call(null, pattern, "x"),
@@ -13,5 +14,8 @@ assertEquals("abcdex", "abcde".replace(pattern, "x"));
// Non-callable override.
pattern[Symbol.replace] = "dumdidum";
assertThrows(() => "abcde".replace(pattern, "x"), TypeError);
+// Null override.
+pattern[Symbol.replace] = null;
+assertEquals("abXde", "abcde".replace(pattern, "X"));
assertEquals("[Symbol.replace]", RegExp.prototype[Symbol.replace].name);
« no previous file with comments | « src/builtins/builtins-string-gen.cc ('k') | test/mjsunit/es6/string-split.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698