michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 290774; michael@0: var summary = 'activation object never delegates to Object.prototype'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: var toStringResult; michael@0: var evalResult; michael@0: var watchResult; michael@0: var parseIntResult; michael@0: michael@0: var eval = 'fooEval'; michael@0: var watch = undefined; michael@0: var parseInt = 'fooParseInt'; michael@0: michael@0: michael@0: function toString() michael@0: { michael@0: return 'fooString'; michael@0: } michael@0: michael@0: function normal() michael@0: { michael@0: toStringResult = toString; michael@0: evalResult = eval; michael@0: watchResult = watch; michael@0: parseIntResult = parseInt; michael@0: } michael@0: michael@0: function outerinnervar() michael@0: { michael@0: toStringResult = toString; michael@0: evalResult = eval; michael@0: watchResult = watch; michael@0: parseIntResult = parseInt; michael@0: function inner() michael@0: { michael@0: // addition of any statement michael@0: // which accesses a variable michael@0: // from the outer scope causes the bug michael@0: printStatus(toString); michael@0: } michael@0: } michael@0: michael@0: expect = true; michael@0: michael@0: printStatus('normal'); michael@0: printStatus('======'); michael@0: normal(); michael@0: michael@0: printStatus('toStringResult ' + toStringResult); michael@0: printStatus('toString ' + toString); michael@0: actual = ((toStringResult + '') == (toString + '')); michael@0: reportCompare(expect, actual, inSection(1)); michael@0: michael@0: printStatus('evalResult ' + evalResult); michael@0: printStatus('eval ' + eval); michael@0: actual = ((evalResult + '') == (eval + '')); michael@0: reportCompare(expect, actual, inSection(2)); michael@0: michael@0: printStatus('watchResult ' + watchResult); michael@0: printStatus('watch ' + watch); michael@0: actual = ((watchResult + '') == (watch + '')); michael@0: reportCompare(expect, actual, inSection(3)); michael@0: michael@0: printStatus('parseIntResult ' + parseIntResult); michael@0: printStatus('parseInt ' + parseInt); michael@0: actual = ((parseIntResult + '') == (parseInt + '')); michael@0: reportCompare(expect, actual, inSection(4)); michael@0: michael@0: printStatus('outerinner'); michael@0: printStatus('=========='); michael@0: michael@0: outerinnervar(); michael@0: michael@0: printStatus('toStringResult ' + toStringResult); michael@0: printStatus('toString ' + toString); michael@0: actual = ((toStringResult + '') == (toString + '')); michael@0: reportCompare(expect, actual, inSection(5)); michael@0: michael@0: michael@0: printStatus('evalResult ' + evalResult); michael@0: printStatus('eval ' + eval); michael@0: actual = ((evalResult + '') == (eval + '')); michael@0: reportCompare(expect, actual, inSection(6)); michael@0: michael@0: printStatus('watchResult ' + watchResult); michael@0: printStatus('watch ' + watch); michael@0: actual = ((watchResult + '') == (watch + '')); michael@0: reportCompare(expect, actual, inSection(7)); michael@0: michael@0: printStatus('parseIntResult ' + parseIntResult); michael@0: printStatus('parseInt ' + parseInt); michael@0: actual = ((parseIntResult + '') == (parseInt + '')); michael@0: reportCompare(expect, actual, inSection(8));