iter-get-iter-err.js (734B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-array.from 5 description: Error creating iterator object 6 info: | 7 [...] 8 6. If usingIterator is not undefined, then 9 [...] 10 d. Let iterator be GetIterator(items, usingIterator). 11 e. ReturnIfAbrupt(iterator). 12 features: [Symbol.iterator] 13 ---*/ 14 15 var itemsPoisonedSymbolIterator = {}; 16 itemsPoisonedSymbolIterator[Symbol.iterator] = function() { 17 throw new Test262Error(); 18 }; 19 20 assert.throws(Test262Error, function() { 21 Array.from(itemsPoisonedSymbolIterator); 22 }, 'Array.from(itemsPoisonedSymbolIterator) throws a Test262Error exception'); 23 24 reportCompare(0, 0);