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 = 291213; michael@0: var summary = 'Do not crash in args_resolve enumerating |arguments|'; michael@0: var actual = 'No Crash'; michael@0: var expect = 'No Crash'; michael@0: michael@0: var scriptCode = "var result = \"\" + arguments; " + michael@0: "for (i in arguments) " + michael@0: "result += \"\\\n \" + i + \" \" + arguments[i]; result;"; michael@0: var scripts = {}; michael@0: michael@0: if (typeof Script == 'undefined') michael@0: { michael@0: print('Test skipped. Script not defined.'); michael@0: } michael@0: else michael@0: { michael@0: scripts["A"] = new Script(scriptCode); michael@0: michael@0: scripts["B"] = (function() { michael@0: return new Script(scriptCode); michael@0: })(); michael@0: michael@0: scripts["C"] = (function() { michael@0: function x() { "a"; } michael@0: return new Script(scriptCode); michael@0: })(); michael@0: michael@0: // any Object (window, document, new Array(), ...) michael@0: var anyObj = new Object(); michael@0: scripts["D"] = (function() { michael@0: function x() { anyObj; } michael@0: return new Script(scriptCode); michael@0: })(); michael@0: michael@0: var result; michael@0: for (var i in scripts) { michael@0: try { result = scripts[i].exec(); } michael@0: catch (e) { result = e; } michael@0: printStatus(i + ") " + result); michael@0: } michael@0: } michael@0: reportCompare(expect, actual, summary);