Debian Codegraph @

js/src/tests/test262/built-ins/Map/iterator-close-failure-after-set-failure.js

raw
1 // Copyright (C) 2017 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-map-iterable
5 description: >
6 The correct error is thrown `Map.prototype.set` throws an error and
7 the IteratorClose throws an error.
8 features: [Symbol.iterator]
9 ---*/
10
11 var count = 0;
12 var iterable = {};
13 iterable[Symbol.iterator] = function() {
14 return {
15 next: function() {
16 return { value: [], done: false };
17 },
18 return: function() {
19 throw new TypeError('ignore');
20 }
21 };
22 };
23 Map.prototype.set = function() { throw new Test262Error(); }
24
25 assert.throws(Test262Error, function() {
26 new Map(iterable);
27 });
28
29 reportCompare(0, 0);