Debian Codegraph @

js/src/jit-test/tests/warp/try-finally-1.js

raw
1 let target = 3;
2 function throwOn(x) {
3 with ({}) {}
4 if (x == target) {
5 throw 3;
6 }
7 }
8
9 // Test try-finally without catch
10 function foo() {
11 var x = 0;
12 try {
13 throwOn(0);
14 x = 1;
15 throwOn(1);
16 x = 2;
17 throwOn(2);
18 x = 3;
19 } finally {
20 assertEq(x, target);
21 }
22 }
23
24 with ({}) {}
25 for (var i = 0; i < 1000; i++) {
26 try {
27 foo();
28 } catch {}
29 }
30
31 for (var i = 0; i < 4; i++) {
32 target = i;
33 try {
34 foo();
35 } catch {}
36 }