blob: efc97e390f5efcb3e5a31724cd0c92b77222e751 [file] [log] [blame]
<html>
<head>
<script src="../../../resources/js-test-pre.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()
{
const style = document.createElement("style");
document.head.appendChild(style);
const sheet = style.sheet;
document.head.removeChild(style);
return sheet;
}
function test()
{
sheet = createCSSStyleSheet();
shouldBe("sheet.__proto__", "CSSStyleSheet.prototype");
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>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>