Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / StyleSheet / gc-parent-stylesheet.html
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 </head>
5 <body onload="test()">
6 <script>
7 window.jsTestIsAsync = true;
8 description("Test that CSS stylesheets don't lose custom properties on GC when only reachable through child rules.");
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
21 function test()
22 {
23     var sheet = createCSSStyleSheet();
24     sheet.foo = "0";
25     sheet.insertRule("div { color:black }", 0);
26     rule = sheet.rules[0];
27     sheet = null;
28
29     gc();
30     setTimeout(function() {
31         gc();
32         shouldBe('rule.parentStyleSheet.foo', '"0"');
33         finishJSTest();
34     }, 0);
35 }
36 </script>
37 <foo id="mystyle" style="display:none">.div { color: white; }</foo>
38 </body>
39 </html>