OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
| 3 <script src="../../resources/gc.js"></script> |
3 <script> | 4 <script> |
4 if (window.testRunner) { | 5 if (window.testRunner) { |
5 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
6 testRunner.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
7 } | 8 } |
8 | 9 |
9 function gc() | |
10 { | |
11 if (window.GCController) | |
12 return GCController.collect(); | |
13 | |
14 for (var i = 0; i < 10000; i++) { // force garbage collection (F
F requires about 9K allocations before a collect). | |
15 var s = new String("abc"); | |
16 } | |
17 } | |
18 | |
19 function runTest() | 10 function runTest() |
20 { | 11 { |
21 aElement = document.createElement('a'); | 12 aElement = document.createElement('a'); |
22 divElement = document.createElement('div'); | 13 divElement = document.createElement('div'); |
23 document.body.appendChild(divElement); | 14 document.body.appendChild(divElement); |
24 nodeIterator = win.document.createNodeIterator(aElement); | 15 nodeIterator = win.document.createNodeIterator(aElement); |
25 win.document.body.appendChild(aElement); | 16 win.document.body.appendChild(aElement); |
26 | 17 |
27 delete nodeIterator; | 18 delete nodeIterator; |
28 gc(); | 19 gc(); |
29 document.body.removeChild(divElement); | 20 document.body.removeChild(divElement); |
30 gc(); | 21 gc(); |
31 | 22 |
32 if (window.testRunner) | 23 if (window.testRunner) |
33 testRunner.notifyDone(); | 24 testRunner.notifyDone(); |
34 } | 25 } |
35 </script> | 26 </script> |
36 </head> | 27 </head> |
37 <body> | 28 <body> |
38 <iframe onload="this.onload = null; win = this.contentWindow; runTest();
"></iframe> | 29 <iframe onload="this.onload = null; win = this.contentWindow; runTest();
"></iframe> |
39 Test passes if it does not crash. | 30 Test passes if it does not crash. |
40 </body> | 31 </body> |
41 </html> | 32 </html> |
42 | 33 |
OLD | NEW |