|
1 // |reftest| skip-if(!xulRuntime.shell) -- bug xxx - fails to dismiss alert |
|
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 var BUGNUMBER = 341815; |
|
9 var summary = 'Close hook crash'; |
|
10 var actual = 'No Crash'; |
|
11 var expect = 'No Crash'; |
|
12 |
|
13 var ialert = 0; |
|
14 //----------------------------------------------------------------------------- |
|
15 //test(); |
|
16 //----------------------------------------------------------------------------- |
|
17 |
|
18 function test() |
|
19 { |
|
20 enterFunc ('test'); |
|
21 printBugNumber(BUGNUMBER); |
|
22 printStatus (summary); |
|
23 |
|
24 var globalToPokeGC = {}; |
|
25 |
|
26 function make_iterator() |
|
27 { |
|
28 function generator() { |
|
29 try { |
|
30 yield 0; |
|
31 } finally { |
|
32 make_iterator(); |
|
33 } |
|
34 } |
|
35 generator().next(); |
|
36 globalToPokeGC = {}; |
|
37 if (typeof alert != 'undefined') |
|
38 { |
|
39 alert(++ialert); |
|
40 } |
|
41 } |
|
42 |
|
43 make_iterator(); |
|
44 |
|
45 for (var i = 0; i != 50000; ++i) { |
|
46 var x = {}; |
|
47 } |
|
48 |
|
49 print('done'); |
|
50 |
|
51 setTimeout('checkTest()', 10000); |
|
52 |
|
53 exitFunc ('test'); |
|
54 } |
|
55 |
|
56 function init() |
|
57 { |
|
58 // give the dialog closer time to register |
|
59 setTimeout('test()', 5000); |
|
60 } |
|
61 |
|
62 var lastialert = 0; |
|
63 |
|
64 function checkTest() |
|
65 { |
|
66 // this function is used to check if there |
|
67 // additional alerts are still being fired |
|
68 // in order to prevent the test from completing |
|
69 // until all alerts have finished. |
|
70 |
|
71 if (ialert != lastialert) |
|
72 { |
|
73 lastialert = ialert; |
|
74 setTimeout('checkTest()', 10000); |
|
75 return; |
|
76 } |
|
77 |
|
78 reportCompare(expect, actual, summary); |
|
79 gDelayTestDriverEnd = false; |
|
80 jsTestDriverEnd(); |
|
81 } |
|
82 |
|
83 if (typeof window != 'undefined') |
|
84 { |
|
85 // delay test driver end |
|
86 gDelayTestDriverEnd = true; |
|
87 |
|
88 window.addEventListener("load", init, false); |
|
89 } |
|
90 else |
|
91 { |
|
92 reportCompare(expect, actual, summary); |
|
93 } |
|
94 |