summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/WeakMap-constructor-generator-exception.js
blob: eb8beaf9a7ecaf3f69834b93a177d558416e6a3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Iterating over the argument to WeakMap can throw. The exception is
// propagated.

load(libdir + "asserts.js");

function data() {
    yield [{}, "XR22/Z"];
    yield [{}, "23D-BN"];
    throw "oops";
}

var it = data();
assertThrowsValue(() => new WeakMap(it), "oops");

function* data2() {
    yield [{}, "XR22/Z"];
    yield [{}, "23D-BN"];
    throw "oops";
}

var it2 = data2();
assertThrowsValue(() => new WeakMap(it2), "oops");