1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/image/test/crashtests/delaytest.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html class="reftest-wait"> 1.6 +<head> 1.7 +<title>Delayed image reftest wrapper</title> 1.8 +</head> 1.9 +<body> 1.10 +<img id="image1"> 1.11 +<script> 1.12 +// This loads a externally specified image, forces a draw (in case of 1.13 +// decode-on-draw), waits 350ms, and then triggers the reftest snapshot. 1.14 +// This allows the animation on the page to complete. 1.15 +// 1.16 +// Use as "delaytest.html?animation.png" 1.17 +// 1.18 + 1.19 +// Get the image URL from our URL 1.20 +var imgURL = document.location.search.substr(1); 1.21 + 1.22 +// Load the image 1.23 +var img = document.images[0]; 1.24 +img.src = imgURL; 1.25 +img.onload = forceDecode; 1.26 +img.onerror = forceDecode; 1.27 + 1.28 +function forceDecode() { 1.29 + 1.30 + try { 1.31 + // We need to force drawing of the image in an invisible context 1.32 + var canvas = document.createElement("canvas"); 1.33 + var ctx = canvas.getContext("2d"); 1.34 + ctx.drawImage(img, 0, 0); 1.35 + } catch(e) {} 1.36 + 1.37 + // We've force the decode. start the timer to trigger the reftest 1.38 + startTimer(); 1.39 +} 1.40 + 1.41 +function startTimer() { 1.42 + const delay = 350; 1.43 + setTimeout("document.documentElement.className = '';", delay); 1.44 +} 1.45 +</script> 1.46 +</body> 1.47 +</html>