js/src/tests/ecma_3/ExecutionContexts/10.6.1-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 //-----------------------------------------------------------------------------
michael@0 7 var BUGNUMBER = 290774;
michael@0 8 var summary = 'activation object never delegates to Object.prototype';
michael@0 9 var actual = '';
michael@0 10 var expect = '';
michael@0 11
michael@0 12 printBugNumber(BUGNUMBER);
michael@0 13 printStatus (summary);
michael@0 14
michael@0 15 var toStringResult;
michael@0 16 var evalResult;
michael@0 17 var watchResult;
michael@0 18 var parseIntResult;
michael@0 19
michael@0 20 var eval = 'fooEval';
michael@0 21 var watch = undefined;
michael@0 22 var parseInt = 'fooParseInt';
michael@0 23
michael@0 24
michael@0 25 function toString()
michael@0 26 {
michael@0 27 return 'fooString';
michael@0 28 }
michael@0 29
michael@0 30 function normal()
michael@0 31 {
michael@0 32 toStringResult = toString;
michael@0 33 evalResult = eval;
michael@0 34 watchResult = watch;
michael@0 35 parseIntResult = parseInt;
michael@0 36 }
michael@0 37
michael@0 38 function outerinnervar()
michael@0 39 {
michael@0 40 toStringResult = toString;
michael@0 41 evalResult = eval;
michael@0 42 watchResult = watch;
michael@0 43 parseIntResult = parseInt;
michael@0 44 function inner()
michael@0 45 {
michael@0 46 // addition of any statement
michael@0 47 // which accesses a variable
michael@0 48 // from the outer scope causes the bug
michael@0 49 printStatus(toString);
michael@0 50 }
michael@0 51 }
michael@0 52
michael@0 53 expect = true;
michael@0 54
michael@0 55 printStatus('normal');
michael@0 56 printStatus('======');
michael@0 57 normal();
michael@0 58
michael@0 59 printStatus('toStringResult ' + toStringResult);
michael@0 60 printStatus('toString ' + toString);
michael@0 61 actual = ((toStringResult + '') == (toString + ''));
michael@0 62 reportCompare(expect, actual, inSection(1));
michael@0 63
michael@0 64 printStatus('evalResult ' + evalResult);
michael@0 65 printStatus('eval ' + eval);
michael@0 66 actual = ((evalResult + '') == (eval + ''));
michael@0 67 reportCompare(expect, actual, inSection(2));
michael@0 68
michael@0 69 printStatus('watchResult ' + watchResult);
michael@0 70 printStatus('watch ' + watch);
michael@0 71 actual = ((watchResult + '') == (watch + ''));
michael@0 72 reportCompare(expect, actual, inSection(3));
michael@0 73
michael@0 74 printStatus('parseIntResult ' + parseIntResult);
michael@0 75 printStatus('parseInt ' + parseInt);
michael@0 76 actual = ((parseIntResult + '') == (parseInt + ''));
michael@0 77 reportCompare(expect, actual, inSection(4));
michael@0 78
michael@0 79 printStatus('outerinner');
michael@0 80 printStatus('==========');
michael@0 81
michael@0 82 outerinnervar();
michael@0 83
michael@0 84 printStatus('toStringResult ' + toStringResult);
michael@0 85 printStatus('toString ' + toString);
michael@0 86 actual = ((toStringResult + '') == (toString + ''));
michael@0 87 reportCompare(expect, actual, inSection(5));
michael@0 88
michael@0 89
michael@0 90 printStatus('evalResult ' + evalResult);
michael@0 91 printStatus('eval ' + eval);
michael@0 92 actual = ((evalResult + '') == (eval + ''));
michael@0 93 reportCompare(expect, actual, inSection(6));
michael@0 94
michael@0 95 printStatus('watchResult ' + watchResult);
michael@0 96 printStatus('watch ' + watch);
michael@0 97 actual = ((watchResult + '') == (watch + ''));
michael@0 98 reportCompare(expect, actual, inSection(7));
michael@0 99
michael@0 100 printStatus('parseIntResult ' + parseIntResult);
michael@0 101 printStatus('parseInt ' + parseInt);
michael@0 102 actual = ((parseIntResult + '') == (parseInt + ''));
michael@0 103 reportCompare(expect, actual, inSection(8));

mercurial