summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testErrorInFinalizerCalledWhileUnwinding.js
blob: 140b75175a697cb2f3c6fcc7083957d4c91c95c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var finalizerRun = false;
var caught = false;

function foo(arr) {
  finalizerRun = true;
  return not_defined;
}

function* gen() {
  try {
    yield 1;
  } finally {
    foo();
  }
}

function test() {
  var i_have_locals;
  for (i of gen()) {
  }
}

try {
    test();
} catch(e) {
    caught = true;
    assertEq(''+e, "ReferenceError: not_defined is not defined");
}

assertEq(finalizerRun, true);
assertEq(caught, true);