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