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 { | 6 { |
6 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
7 testRunner.waitUntilDone(); | 8 testRunner.waitUntilDone(); |
8 } | 9 } |
9 | 10 |
10 function runTest() | 11 function runTest() |
11 { | 12 { |
12 style = document.createElement('style'); | 13 style = document.createElement('style'); |
13 style.textContent = '@media all { body { color: red } }'; | 14 style.textContent = '@media all { body { color: red } }'; |
14 document.head.appendChild(style); | 15 document.head.appendChild(style); |
15 | 16 |
16 ruleList = getMatchedCSSRules(document.body); | 17 ruleList = getMatchedCSSRules(document.body); |
17 | 18 |
18 document.styleSheets[0].cssRules[0].deleteRule(0); | 19 document.styleSheets[0].cssRules[0].deleteRule(0); |
19 document.head.removeChild(style); | 20 document.head.removeChild(style); |
20 | 21 |
21 gc(); | 22 gc(); |
22 | 23 |
23 if (!ruleList[0].parentStyleSheet) | 24 if (!ruleList[0].parentStyleSheet) |
24 document.getElementById('result').innerHTML = "PASS"; | 25 document.getElementById('result').innerHTML = "PASS"; |
25 if (window.testRunner) | 26 if (window.testRunner) |
26 testRunner.notifyDone(); | 27 testRunner.notifyDone(); |
27 } | 28 } |
28 | 29 |
29 function gc() | |
30 { | |
31 if (window.GCController) | |
32 return GCController.collect(); | |
33 | |
34 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires
about 9K allocations before a collect) | |
35 var s = new String("abc"); | |
36 } | |
37 } | |
38 </script> | 30 </script> |
39 </head> | 31 </head> |
40 <body onload="runTest()"> | 32 <body onload="runTest()"> |
41 <div id="result"></div> | 33 <div id="result"></div> |
42 </body> | 34 </body> |
43 </html> | 35 </html> |
44 | 36 |
OLD | NEW |