|
1 // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 /* |
|
8 * |
|
9 * Date: 30 October 2001 |
|
10 * SUMMARY: Regression test for bug 108440 |
|
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=108440 |
|
12 * |
|
13 * We shouldn't crash trying to add an array as an element of itself (!) |
|
14 * |
|
15 * Brendan: "...it appears that Array.prototype.toString is unsafe, |
|
16 * and what's more, ECMA-262 Edition 3 has no helpful words about |
|
17 * avoiding recursive death on a cycle." |
|
18 */ |
|
19 //----------------------------------------------------------------------------- |
|
20 var BUGNUMBER = 108440; |
|
21 var summary = "Shouldn't crash trying to add an array as an element of itself"; |
|
22 var self = this; |
|
23 var temp = ''; |
|
24 |
|
25 printBugNumber(BUGNUMBER); |
|
26 printStatus(summary); |
|
27 |
|
28 /* |
|
29 * Explicit test: |
|
30 */ |
|
31 var a=[]; |
|
32 temp = (a[a.length]=a); |
|
33 |
|
34 /* |
|
35 * Implicit test (one of the properties of |self| is |a|) |
|
36 */ |
|
37 a=[]; |
|
38 for(var prop in self) |
|
39 { |
|
40 temp = prop; |
|
41 temp = (a[a.length] = self[prop]); |
|
42 } |
|
43 |
|
44 /* |
|
45 * Stressful explicit test |
|
46 */ |
|
47 a=[]; |
|
48 for (var i=0; i<10; i++) |
|
49 { |
|
50 a[a.length] = a; |
|
51 } |
|
52 |
|
53 /* |
|
54 * Test toString() |
|
55 */ |
|
56 a=[]; |
|
57 for (var i=0; i<10; i++) |
|
58 { |
|
59 a[a.length] = a.toString(); |
|
60 } |
|
61 |
|
62 /* |
|
63 * Test toSource() - but Rhino doesn't have this, so try...catch it |
|
64 */ |
|
65 a=[]; |
|
66 try |
|
67 { |
|
68 for (var i=0; i<10; i++) |
|
69 { |
|
70 a[a.length] = a.toSource(); |
|
71 } |
|
72 } |
|
73 catch(e) |
|
74 { |
|
75 } |
|
76 |
|
77 reportCompare('No Crash', 'No Crash', ''); |