Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Array/from/iter-get-iter-val-err.js

raw
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 es6id: 22.1.2.1
6 description: Error retrieving value of iterator result
7 info: |
8 [...]
9 6. If usingIterator is not undefined, then
10 [...]
11 g. Repeat
12 [...]
13 v. Let nextValue be IteratorValue(next).
14 vi. ReturnIfAbrupt(nextValue).
15 features: [Symbol.iterator]
16 ---*/
17
18 var items = {};
19 var poisonedValue = {};
20 Object.defineProperty(poisonedValue, 'value', {
21 get: function() {
22 throw new Test262Error();
23 }
24 });
25 items[Symbol.iterator] = function() {
26 return {
27 next: function() {
28 return poisonedValue;
29 }
30 };
31 };
32
33 assert.throws(Test262Error, function() {
34 Array.from(items);
35 });