diff --git a/src/builtins/builtins-iterator-gen.cc b/src/builtins/builtins-iterator-gen.cc index 21f6039f08..be7711704b 100644 --- a/src/builtins/builtins-iterator-gen.cc +++ b/src/builtins/builtins-iterator-gen.cc @@ -40,7 +40,11 @@ IteratorRecord IteratorBuiltinsAssembler::GetIterator(Node* context, Branch(IsJSReceiver(iterator), &get_next, &if_notobject); BIND(&if_notobject); - { ThrowTypeError(context, MessageTemplate::kNotAnIterator, iterator); } + { + Node* ret = CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context); + GotoIfException(ret, if_exception, exception); + Unreachable(); + } BIND(&get_next); Node* const next = GetProperty(context, iterator, factory()->next_string()); diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js index 6e20d684ff..86b6afd538 100644 --- a/test/mjsunit/es6/promises.js +++ b/test/mjsunit/es6/promises.js @@ -582,6 +582,15 @@ function assertAsyncDone(iteration) { testPromiseAllNonIterable(42); })(); +(function() { + Promise.all({[symbolIterator](){ return null; }}).then( + assertUnreachable, + function(r) { + assertAsync(r instanceof TypeError, 'all/non iterable'); + }); + assertAsyncRan(); +})(); + (function() { var deferred = defer(Promise); var p = deferred.promise;