OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body onload="test()"> | 5 <body onload="test()"> |
6 <script> | 6 <script> |
7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
8 description("Test that CSS rules don't lose custom properties on GC when only re
achable through child rules."); | 8 description("Test that CSS rules don't lose custom properties on GC when only re
achable through child rules."); |
9 | 9 |
| 10 function createCSSStyleSheet() |
| 11 { |
| 12 style = document.createElement("style"); |
| 13 document.head.appendChild(style); |
| 14 shouldBeType("style.sheet", "CSSStyleSheet"); |
| 15 var sheet = style.sheet; |
| 16 document.head.removeChild(style); |
| 17 shouldBeNull("style.sheet"); |
| 18 return sheet; |
| 19 } |
| 20 |
10 function test() | 21 function test() |
11 { | 22 { |
12 var sheet = document.implementation.createCSSStyleSheet("title", "screen"); | 23 var sheet = createCSSStyleSheet(); |
13 sheet.insertRule("@media all { div { color:black } }", 0); | 24 sheet.insertRule("@media all { div { color:black } }", 0); |
14 rule = sheet.rules[0].cssRules[0]; | 25 rule = sheet.rules[0].cssRules[0]; |
15 rule.parentRule.foo = "bar"; | 26 rule.parentRule.foo = "bar"; |
16 sheet = null; | 27 sheet = null; |
17 | 28 |
18 gc(); | 29 gc(); |
19 setTimeout(function() { | 30 setTimeout(function() { |
20 gc(); | 31 gc(); |
21 shouldBe('rule.parentRule.foo', '"bar"'); | 32 shouldBe('rule.parentRule.foo', '"bar"'); |
22 finishJSTest(); | 33 finishJSTest(); |
23 }, 0); | 34 }, 0); |
24 } | 35 } |
25 </script> | 36 </script> |
26 <foo id="mystyle" style="display:none">.div { color: white; }</foo> | 37 <foo id="mystyle" style="display:none">.div { color: white; }</foo> |
27 </body> | 38 </body> |
28 </html> | 39 </html> |
OLD | NEW |