Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-350312.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-350312.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 350312;
9 var summary = 'Accessing wrong stack slot with nested catch/finally';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var counter = 0;
25
26 function f(x,y) {
27
28 try
29 {
30 throw x;
31 }
32 catch(e)
33 {
34 if (y)
35 throw e;
36 }
37 finally
38 {
39 try
40 {
41 actual += 'finally,';
42 throw 42;
43 }
44 catch(e2)
45 {
46 actual += e2;
47 print(e2);
48 if (++counter > 10)
49 {
50 throw 'Infinite loop...';
51 }
52 }
53 }
54 return 'returned';
55 }
56
57 expect = 'finally,42';
58 actual = '';
59
60 try
61 {
62 print('test 1');
63 f(2, 1);
64 }
65 catch(ex)
66 {
67 }
68 reportCompare(expect, actual, summary);
69
70 actual = '';
71 try
72 {
73 print('test 2');
74 f(2, 0);
75 }
76 catch(ex)
77 {
78 }
79 reportCompare(expect, actual, summary);
80
81 exitFunc ('test');
82 }