| 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 |
es6id: 23.1.1.1 |
| 5 |
description: > |
| 6 |
The iterator is closed when iterable `next` value throws an error. |
| 7 |
info: | |
| 8 |
Map ( [ iterable ] ) |
| 9 |
|
| 10 |
... |
| 11 |
9. Repeat |
| 12 |
... |
| 13 |
d. Let nextItem be IteratorValue(next). |
| 14 |
e. ReturnIfAbrupt(nextItem). |
| 15 |
features: [Symbol.iterator] |
| 16 |
---*/ |
| 17 |
|
| 18 |
var iterable = {}; |
| 19 |
iterable[Symbol.iterator] = function() { |
| 20 |
return { |
| 21 |
next: function() { |
| 22 |
return { |
| 23 |
get value() { |
| 24 |
throw new Test262Error(); |
| 25 |
}, |
| 26 |
done: false |
| 27 |
}; |
| 28 |
} |
| 29 |
}; |
| 30 |
}; |
| 31 |
|
| 32 |
assert.throws(Test262Error, function() { |
| 33 |
new Map(iterable); |
| 34 |
}); |