iter-adv-err.js (732B)
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 advancing iterator 6 info: | 7 [...] 8 6. If usingIterator is not undefined, then 9 [...] 10 g. Repeat 11 i. Let Pk be ToString(k). 12 ii. Let next be IteratorStep(iterator). 13 iii. ReturnIfAbrupt(next). 14 features: [Symbol.iterator] 15 ---*/ 16 17 var items = {}; 18 items[Symbol.iterator] = function() { 19 return { 20 next: function() { 21 throw new Test262Error(); 22 } 23 }; 24 }; 25 26 assert.throws(Test262Error, function() { 27 Array.from(items); 28 }, 'Array.from(items) throws a Test262Error exception'); 29 30 reportCompare(0, 0);