Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-204210.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 /*
7 *
8 * Date: 29 April 2003
9 * SUMMARY: eval() is not a constructor, but don't crash on |new eval();|
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=204210
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-204210.js';
16 var UBound = 0;
17 var BUGNUMBER = 204210;
18 var summary = "eval() is not a constructor, but don't crash on |new eval();|";
19 var status = '';
20 var statusitems = [];
21 var actual = '';
22 var actualvalues = [];
23 var expect= '';
24 var expectedvalues = [];
25
26 printBugNumber(BUGNUMBER);
27 printStatus(summary);
28
29 /*
30 * Just testing that we don't crash on any of these constructs -
31 */
32
33
34 /*
35 * global scope -
36 */
37 try
38 {
39 var x = new eval();
40 new eval();
41 }
42 catch(e)
43 {
44 }
45
46
47 /*
48 * function scope -
49 */
50 f();
51 function f()
52 {
53 try
54 {
55 var x = new eval();
56 new eval();
57 }
58 catch(e)
59 {
60 }
61 }
62
63
64 /*
65 * eval scope -
66 */
67 var s = '';
68 s += 'try';
69 s += '{';
70 s += ' var x = new eval();';
71 s += ' new eval();';
72 s += '}';
73 s += 'catch(e)';
74 s += '{';
75 s += '}';
76 eval(s);
77
78
79 /*
80 * some combinations of scope -
81 */
82 s = '';
83 s += 'function g()';
84 s += '{';
85 s += ' try';
86 s += ' {';
87 s += ' var x = new eval();';
88 s += ' new eval();';
89 s += ' }';
90 s += ' catch(e)';
91 s += ' {';
92 s += ' }';
93 s += '}';
94 s += 'g();';
95 eval(s);
96
97
98 function h()
99 {
100 var s = '';
101 s += 'function f()';
102 s += '{';
103 s += ' try';
104 s += ' {';
105 s += ' var x = new eval();';
106 s += ' new eval();';
107 s += ' }';
108 s += ' catch(e)';
109 s += ' {';
110 s += ' }';
111 s += '}';
112 s += 'f();';
113 eval(s);
114 }
115 h();
116
117 reportCompare('No Crash', 'No Crash', '');