blob: 0c1445c080f551befe1283c499db2a4cb8a971c6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
description("Ensure that clearing the image decoder while decoding an animation doesn't crash.");
jsTestIsAsync = true;
internals.clearMemoryCache();
var image = new Image;
image.onload = imageLoaded;
image.src = "resources/animated-10color.gif";
function imageLoaded()
{
if (!window.internals)
return;
internals.setImageFrameDecodingDuration(image, 0.040);
internals.setClearDecoderAfterAsyncFrameRequestForTesting(image, true);
drawImage();
drawLoop();
}
function drawImage()
{
if (drawImage.count == undefined)
drawImage.count = 0;
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
return ++drawImage.count;
}
function drawLoop()
{
setTimeout(function() {
if (drawImage() == 10)
finishJSTest();
drawLoop();
}, 50);
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>