blob: c94c4248a4acddd008bc66a17338bb84b7dd020f [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/gc.js"></script>
<p>This tests that StyleSheetList of a shadow root does not get collected as long as the shadow root is alive.</p>
<pre><script>
if (window.testRunner)
testRunner.dumpAsText();
function createShadow() {
const host = document.createElement('div');
const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.styleSheets.alive = true;
return shadowRoot;
}
for (let i = 0; i < 10; i++) {
const shadowRoot = createShadow();
gc();
document.write(shadowRoot.styleSheets.alive ? 'PASS' : 'FAIL - styleSheets got collected');
document.write('<br>');
}
</script></pre>
</body>
</html>