Debian Codegraph @

rhino/testsrc/tests/ecma_3/ExecutionContexts/10.6.1-01.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 = '10.6.1-01.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 290774;
9 var summary = 'activation object never delegates to Object.prototype';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var toStringResult;
17 var evalResult;
18 var watchResult;
19 var parseIntResult;
20
21 var eval = 'fooEval';
22 var watch = undefined;
23 var parseInt = 'fooParseInt';
24
25
26 function toString()
27 {
28 return 'fooString';
29 }
30
31 function normal()
32 {
33 toStringResult = toString;
34 evalResult = eval;
35 watchResult = watch;
36 parseIntResult = parseInt;
37 }
38
39 function outerinnervar()
40 {
41 toStringResult = toString;
42 evalResult = eval;
43 watchResult = watch;
44 parseIntResult = parseInt;
45 function inner()
46 {
47 // addition of any statement
48 // which accesses a variable
49 // from the outer scope causes the bug
50 printStatus(toString);
51 }
52 }
53
54 expect = true;
55
56 printStatus('normal');
57 printStatus('======');
58 normal();
59
60 printStatus('toStringResult ' + toStringResult);
61 printStatus('toString ' + toString);
62 actual = ((toStringResult + '') == (toString + ''));
63 reportCompare(expect, actual, inSection(1));
64
65 printStatus('evalResult ' + evalResult);
66 printStatus('eval ' + eval);
67 actual = ((evalResult + '') == (eval + ''));
68 reportCompare(expect, actual, inSection(2));
69
70 printStatus('watchResult ' + watchResult);
71 printStatus('watch ' + watch);
72 actual = ((watchResult + '') == (watch + ''));
73 reportCompare(expect, actual, inSection(3));
74
75 printStatus('parseIntResult ' + parseIntResult);
76 printStatus('parseInt ' + parseInt);
77 actual = ((parseIntResult + '') == (parseInt + ''));
78 reportCompare(expect, actual, inSection(4));
79
80 printStatus('outerinner');
81 printStatus('==========');
82
83 outerinnervar();
84
85 printStatus('toStringResult ' + toStringResult);
86 printStatus('toString ' + toString);
87 actual = ((toStringResult + '') == (toString + ''));
88 reportCompare(expect, actual, inSection(5));
89
90
91 printStatus('evalResult ' + evalResult);
92 printStatus('eval ' + eval);
93 actual = ((evalResult + '') == (eval + ''));
94 reportCompare(expect, actual, inSection(6));
95
96 printStatus('watchResult ' + watchResult);
97 printStatus('watch ' + watch);
98 actual = ((watchResult + '') == (watch + ''));
99 reportCompare(expect, actual, inSection(7));
100
101 printStatus('parseIntResult ' + parseIntResult);
102 printStatus('parseInt ' + parseInt);
103 actual = ((parseIntResult + '') == (parseInt + ''));
104 reportCompare(expect, actual, inSection(8));