iter-assigned-symbol-reject.js (976B)
1 // |reftest| async 2 // Copyright (C) 2018 Rick Waldron. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-promise.all 7 description: > 8 Reject when argument's Symbol.iterator property has the value Symbol() 9 info: | 10 ... 11 Let iteratorRecord be GetIterator(iterable). 12 IfAbruptRejectPromise(iteratorRecord, promiseCapability). 13 ... 14 15 #sec-getiterator 16 GetIterator ( obj [ , hint [ , method ] ] ) 17 18 ... 19 Let iterator be ? Call(method, obj). 20 If Type(iterator) is not Object, throw a TypeError exception. 21 ... 22 features: [Symbol.iterator] 23 flags: [async] 24 ---*/ 25 26 try { 27 Promise.all({ 28 [Symbol.iterator]: Symbol() 29 }).then(function() { 30 $DONE('The promise should be rejected, but was resolved'); 31 }, function(error) { 32 assert(error instanceof TypeError); 33 }).then($DONE, $DONE); 34 } catch (error) { 35 $DONE(`The promise should be rejected, but threw an exception: ${error.message}`); 36 }