<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body onload="test()">
<script>
window.jsTestIsAsync = true;
description("Test that CSS stylesheets don't lose custom properties on GC when only reachable through child rules.");
function createCSSStyleSheet()
{
style = document.createElement("style");
document.head.appendChild(style);
shouldBeType("style.sheet", "CSSStyleSheet");
var sheet = style.sheet;
document.head.removeChild(style);
shouldBeNull("style.sheet");
return sheet;
}
function test()
{
var sheet = createCSSStyleSheet();
sheet.foo = "0";
sheet.insertRule("div { color:black }", 0);
rule = sheet.rules[0];
sheet = null;
gc();
setTimeout(function() {
gc();
shouldBe('rule.parentStyleSheet.foo', '"0"');
finishJSTest();
}, 0);
}
</script>
<foo id="mystyle" style="display:none">.div { color: white; }</foo>
</body>
</html>