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 = 313938; michael@0: var summary = 'Root access in jsscript.c'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: if (typeof Script == 'undefined') michael@0: { michael@0: print('Test skipped. Script not defined.'); michael@0: reportCompare("Script not defined, Test skipped.", michael@0: "Script not defined, Test skipped.", michael@0: summary); michael@0: } michael@0: else michael@0: { michael@0: var str = " 2;".substring(1); michael@0: "1".substring(2); michael@0: expect = Script.prototype.compile(str).toSource(); michael@0: michael@0: var likeString = { michael@0: toString: function() { michael@0: var tmp = str; michael@0: str = null; michael@0: return tmp; michael@0: } michael@0: }; michael@0: michael@0: TWO = 2.0; michael@0: michael@0: var likeObject = { michael@0: valueOf: function() { michael@0: if (typeof gc == "function") michael@0: gc(); michael@0: for (var i = 0; i != 40000; ++i) { michael@0: var tmp = 1e100 * TWO; michael@0: } michael@0: return this; michael@0: } michael@0: } michael@0: michael@0: var s = Script.prototype.compile(likeString, likeObject); michael@0: var actual = s.toSource(); michael@0: printStatus(expect === actual); michael@0: michael@0: reportCompare(expect, actual, summary); michael@0: }