summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/WeakMap-constructor-arraylike-exception.js
blob: bbb1b43bdd1cdace6fb19285c2b2dcaf36e80596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// WeakMap constructor should propagate exception while getting key and value.

load(libdir + "asserts.js");

var k1 = {};
var v1 = 42;

var error_thrower_0 = {
  get 0() {
    throw new Error;
  },
  1: v1
};
assertThrowsInstanceOf(() => new WeakMap([error_thrower_0]), Error);

var error_thrower_1 = {
  0: k1,
  get 1() {
    throw new Error;
  }
};
assertThrowsInstanceOf(() => new WeakMap([error_thrower_1]), Error);