Chromium Code Reviews

Unified Diff: src/js/string-iterator.js

Issue 1783643002: String.prototype[Symbol.iterator] does RequireObjectCoercible(this) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/string-iterator.js
diff --git a/src/js/string-iterator.js b/src/js/string-iterator.js
index 3c331dd1a2da4e99dc0e84be7c9ffa091f01acad..0fbdd5273957fbee25461127319ff2f1f42e5345 100644
--- a/src/js/string-iterator.js
+++ b/src/js/string-iterator.js
@@ -32,6 +32,10 @@ function StringIterator() {}
// 21.1.5.1 CreateStringIterator Abstract Operation
function CreateStringIterator(string) {
+ if (IS_NULL_OR_UNDEFINED(string)) {
adamk 2016/03/09 23:31:58 There's a macro for this: CHECK_OBJECT_COERCIBLE(
Dan Ehrenberg 2016/03/09 23:53:59 Awesome, applied
+ throw MakeTypeError(kIncompatibleMethodReceiver,
+ 'String.prototype[Symbol.iterator]');
+ }
var s = TO_STRING(string);
var iterator = new StringIterator;
SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s);
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine