Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
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 UBound = 0;
16 var BUGNUMBER = 204210;
17 var summary = "eval() is not a constructor, but don't crash on |new eval();|";
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
25 printBugNumber(BUGNUMBER);
26 printStatus(summary);
28 /*
29 * Just testing that we don't crash on any of these constructs -
30 */
33 /*
34 * global scope -
35 */
36 try
37 {
38 var x = new eval();
39 new eval();
40 }
41 catch(e)
42 {
43 }
46 /*
47 * function scope -
48 */
49 f();
50 function f()
51 {
52 try
53 {
54 var x = new eval();
55 new eval();
56 }
57 catch(e)
58 {
59 }
60 }
63 /*
64 * eval scope -
65 */
66 var s = '';
67 s += 'try';
68 s += '{';
69 s += ' var x = new eval();';
70 s += ' new eval();';
71 s += '}';
72 s += 'catch(e)';
73 s += '{';
74 s += '}';
75 eval(s);
78 /*
79 * some combinations of scope -
80 */
81 s = '';
82 s += 'function g()';
83 s += '{';
84 s += ' try';
85 s += ' {';
86 s += ' var x = new eval();';
87 s += ' new eval();';
88 s += ' }';
89 s += ' catch(e)';
90 s += ' {';
91 s += ' }';
92 s += '}';
93 s += 'g();';
94 eval(s);
97 function h()
98 {
99 var s = '';
100 s += 'function f()';
101 s += '{';
102 s += ' try';
103 s += ' {';
104 s += ' var x = new eval();';
105 s += ' new eval();';
106 s += ' }';
107 s += ' catch(e)';
108 s += ' {';
109 s += ' }';
110 s += '}';
111 s += 'f();';
112 eval(s);
113 }
114 h();
116 reportCompare('No Crash', 'No Crash', '');