|
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 //----------------------------------------------------------------------------- |
|
7 var BUGNUMBER = 291213; |
|
8 var summary = 'Do not crash in args_resolve enumerating |arguments|'; |
|
9 var actual = 'No Crash'; |
|
10 var expect = 'No Crash'; |
|
11 |
|
12 var scriptCode = "var result = \"\" + arguments; " + |
|
13 "for (i in arguments) " + |
|
14 "result += \"\\\n \" + i + \" \" + arguments[i]; result;"; |
|
15 var scripts = {}; |
|
16 |
|
17 if (typeof Script == 'undefined') |
|
18 { |
|
19 print('Test skipped. Script not defined.'); |
|
20 } |
|
21 else |
|
22 { |
|
23 scripts["A"] = new Script(scriptCode); |
|
24 |
|
25 scripts["B"] = (function() { |
|
26 return new Script(scriptCode); |
|
27 })(); |
|
28 |
|
29 scripts["C"] = (function() { |
|
30 function x() { "a"; } |
|
31 return new Script(scriptCode); |
|
32 })(); |
|
33 |
|
34 // any Object (window, document, new Array(), ...) |
|
35 var anyObj = new Object(); |
|
36 scripts["D"] = (function() { |
|
37 function x() { anyObj; } |
|
38 return new Script(scriptCode); |
|
39 })(); |
|
40 |
|
41 var result; |
|
42 for (var i in scripts) { |
|
43 try { result = scripts[i].exec(); } |
|
44 catch (e) { result = e; } |
|
45 printStatus(i + ") " + result); |
|
46 } |
|
47 } |
|
48 reportCompare(expect, actual, summary); |