1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_3/ExecutionContexts/10.6.1-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 290774; 1.11 +var summary = 'activation object never delegates to Object.prototype'; 1.12 +var actual = ''; 1.13 +var expect = ''; 1.14 + 1.15 +printBugNumber(BUGNUMBER); 1.16 +printStatus (summary); 1.17 + 1.18 +var toStringResult; 1.19 +var evalResult; 1.20 +var watchResult; 1.21 +var parseIntResult; 1.22 + 1.23 +var eval = 'fooEval'; 1.24 +var watch = undefined; 1.25 +var parseInt = 'fooParseInt'; 1.26 + 1.27 + 1.28 +function toString() 1.29 +{ 1.30 + return 'fooString'; 1.31 +} 1.32 + 1.33 +function normal() 1.34 +{ 1.35 + toStringResult = toString; 1.36 + evalResult = eval; 1.37 + watchResult = watch; 1.38 + parseIntResult = parseInt; 1.39 +} 1.40 + 1.41 +function outerinnervar() 1.42 +{ 1.43 + toStringResult = toString; 1.44 + evalResult = eval; 1.45 + watchResult = watch; 1.46 + parseIntResult = parseInt; 1.47 + function inner() 1.48 + { 1.49 + // addition of any statement 1.50 + // which accesses a variable 1.51 + // from the outer scope causes the bug 1.52 + printStatus(toString); 1.53 + } 1.54 +} 1.55 + 1.56 +expect = true; 1.57 + 1.58 +printStatus('normal'); 1.59 +printStatus('======'); 1.60 +normal(); 1.61 + 1.62 +printStatus('toStringResult ' + toStringResult); 1.63 +printStatus('toString ' + toString); 1.64 +actual = ((toStringResult + '') == (toString + '')); 1.65 +reportCompare(expect, actual, inSection(1)); 1.66 + 1.67 +printStatus('evalResult ' + evalResult); 1.68 +printStatus('eval ' + eval); 1.69 +actual = ((evalResult + '') == (eval + '')); 1.70 +reportCompare(expect, actual, inSection(2)); 1.71 + 1.72 +printStatus('watchResult ' + watchResult); 1.73 +printStatus('watch ' + watch); 1.74 +actual = ((watchResult + '') == (watch + '')); 1.75 +reportCompare(expect, actual, inSection(3)); 1.76 + 1.77 +printStatus('parseIntResult ' + parseIntResult); 1.78 +printStatus('parseInt ' + parseInt); 1.79 +actual = ((parseIntResult + '') == (parseInt + '')); 1.80 +reportCompare(expect, actual, inSection(4)); 1.81 + 1.82 +printStatus('outerinner'); 1.83 +printStatus('=========='); 1.84 + 1.85 +outerinnervar(); 1.86 + 1.87 +printStatus('toStringResult ' + toStringResult); 1.88 +printStatus('toString ' + toString); 1.89 +actual = ((toStringResult + '') == (toString + '')); 1.90 +reportCompare(expect, actual, inSection(5)); 1.91 + 1.92 + 1.93 +printStatus('evalResult ' + evalResult); 1.94 +printStatus('eval ' + eval); 1.95 +actual = ((evalResult + '') == (eval + '')); 1.96 +reportCompare(expect, actual, inSection(6)); 1.97 + 1.98 +printStatus('watchResult ' + watchResult); 1.99 +printStatus('watch ' + watch); 1.100 +actual = ((watchResult + '') == (watch + '')); 1.101 +reportCompare(expect, actual, inSection(7)); 1.102 + 1.103 +printStatus('parseIntResult ' + parseIntResult); 1.104 +printStatus('parseInt ' + parseInt); 1.105 +actual = ((parseIntResult + '') == (parseInt + '')); 1.106 +reportCompare(expect, actual, inSection(8));