blob: dea98b0d7104452de59e38ca08f20805cbc3cce1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that we do not crash when scrolling after a paused animated GIF's CachedImage gets destroyed.");
jsTestIsAsync = true;
onload = function() {
image = document.querySelector("img");
debug("Initially outside the viewport");
shouldBecomeEqual("internals.isImageAnimating(image)", "false", function() {
debug("Scrolling animation into view");
internals.scrollElementToRect(image, 0, 0, 300, 300);
shouldBecomeEqual("internals.isImageAnimating(image)", "true", function() {
debug("Scrolling animation out of view");
scroll(0, 0);
shouldBecomeEqual("internals.isImageAnimating(image)", "false", function() {
image.src = "resources/animated2.gif";
gc();
internals.clearMemoryCache();
setTimeout(function() {
gc();
debug("Scrolling back down after image removal");
scroll(500, 500);
setTimeout(finishJSTest, 30);
}, 0);
});
});
});
}
</script>
<div style="position: relative; width: 1600px; height: 2400px;">
<img src="resources/animated.gif" style="position:absolute; left: 600px; top: 800px;">
</div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>