| <body onload="runTest()"> |
| <script src="../resources/js-test.js"></script> |
| description("This test asserts that a CSSAnimation doesn't leak after it was removed declaratively and the document was replaced."); |
| var frame = document.body.appendChild(document.createElement("iframe")); |
| frame.addEventListener("load", async () => { |
| if (frame.src === 'about:blank') |
| const animationId = "leak-css-animation"; |
| return new Promise(resolve => { |
| const animation = element.getAnimations()[0]; |
| testFailed("The expected CSS animation was not created."); |
| animation.id = animationId; |
| if (!internals.animationWithIdExists(animationId)) { |
| testFailed("The expected CSS animation with the provided ID was not initially found."); |
| requestAnimationFrame(() => { |
| element.style.animation = "none"; |
| })(frame.contentDocument.querySelector("div")); |
| requestAnimationFrame(() => { |
| const handle = setInterval(() => { |
| if (!internals.animationWithIdExists(animationId)) { |
| testPassed("The CSS animation was destroyed."); |
| testFailed("The CSS animation was leaked."); |
| frame.src = 'resources/css-animation-leak-iframe.html'; |