get-iterator-method-throws.js (876B)
1 // |reftest| shell-option(--enable-iterator-sequencing) skip-if(!Iterator.concat||!xulRuntime.shell) -- iterator-sequencing is not enabled unconditionally, requires shell-options 2 // Copyright (C) 2024 André Bargull. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-iterator.concat 7 description: > 8 Error thrown when retrieving the iterator method. 9 info: | 10 Iterator.concat ( ...items ) 11 12 1. Let iterables be a new empty List. 13 2. For each element item of items, do 14 a. If item is not an Object, throw a TypeError exception. 15 b. Let method be ? GetMethod(item, %Symbol.iterator%). 16 ... 17 features: [iterator-sequencing] 18 ---*/ 19 20 var iterable = { 21 get [Symbol.iterator]() { 22 throw new Test262Error(); 23 } 24 }; 25 26 assert.throws(Test262Error, function() { 27 Iterator.concat(iterable); 28 }); 29 30 reportCompare(0, 0);