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 ruleList = getMatchedCSSRules(document.body); | 16 ruleList = getMatchedCSSRules(document.body); |
17 | 17 |
18 document.styleSheets[0].cssRules[0].deleteRule(0); | 18 document.styleSheets[0].cssRules[0].deleteRule(0); |
19 document.head.removeChild(style); | 19 document.head.removeChild(style); |
20 | 20 |
21 gc(); | 21 gc(); |
22 | 22 |
23 if (!ruleList[0].parentStyleSheet) | 23 if (!ruleList[0].parentStyleSheet) |
24 document.getElementById('result').innerHTML = "PASS"; | 24 document.getElementById('result').innerHTML = "PASS"; |
25 if (window.testRunner) | 25 if (window.testRunner) |
26 testRunner.notifyDone(); | 26 testRunner.notifyDone(); |
27 } | 27 } |
28 | 28 |
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> | 29 </script> |
39 </head> | 30 </head> |
40 <body onload="runTest()"> | 31 <body onload="runTest()"> |
41 <div id="result"></div> | 32 <div id="result"></div> |
42 </body> | 33 </body> |
43 </html> | 34 </html> |
44 | 35 |
OLD | NEW |