Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-291213.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-291213.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 291213;
9 var summary = 'Do not crash in args_resolve enumerating |arguments|';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13 var scriptCode = "var result = \"\" + arguments; " +
14 "for (i in arguments) " +
15 "result += \"\\\n \" + i + \" \" + arguments[i]; result;";
16 var scripts = {};
17
18 if (typeof Script == 'undefined')
19 {
20 print('Test skipped. Script not defined.');
21 }
22 else
23 {
24 scripts["A"] = new Script(scriptCode);
25
26 scripts["B"] = (function() {
27 return new Script(scriptCode);
28 })();
29
30 scripts["C"] = (function() {
31 function x() { "a"; }
32 return new Script(scriptCode);
33 })();
34
35 // any Object (window, document, new Array(), ...)
36 var anyObj = new Object();
37 scripts["D"] = (function() {
38 function x() { anyObj; }
39 return new Script(scriptCode);
40 })();
41
42 var result;
43 for (var i in scripts) {
44 try { result = scripts[i].exec(); }
45 catch (e) { result = e; }
46 printStatus(i + ") " + result);
47 }
48 }
49 reportCompare(expect, actual, summary);