Bug 1792334 - Decom nsIXPConnect and friends. r=mccr8
[gecko.git] / image / test / crashtests / delaytest.html
blobfb368c1e908a0a136729b8b21b3c2eafc139c65e
1 <!DOCTYPE HTML>
2 <html class="reftest-wait">
3 <head>
4 <title>Delayed image reftest wrapper</title>
5 </head>
6 <body>
7 <!-- non-empty alt to avoid the broken image icon -->
8 <img id="image1" alt=" ">
9 <script>
11 window.addEventListener("MozReftestInvalidate", reftestInvalidateListener);
13 // This loads a externally specified image, forces a draw (in case of
14 // decode-on-draw), waits 350ms, and then triggers the reftest snapshot.
15 // This allows the animation on the page to complete.
17 // Use as "delaytest.html?animation.png"
20 // Get the image URL from our URL
21 var imgURL = document.location.search.substr(1);
23 // Load the image
24 var img = document.images[0];
25 img.src = imgURL;
26 img.onload = forceDecode;
27 img.onerror = forceDecode;
29 let decodeComplete = false;
30 let gotReftestInvalidate = false;
32 function forceDecode() {
33 img.decode().then(function() {
34 decodeComplete = true;
35 maybeStartTimer();
36 }, function() {
37 decodeComplete = true;
38 maybeStartTimer();
39 });
42 function reftestInvalidateListener() {
43 gotReftestInvalidate = true;
44 maybeStartTimer();
47 function maybeStartTimer() {
48 if (decodeComplete && gotReftestInvalidate) {
49 startTimer();
53 function startTimer() {
54 const delay = 350;
55 setTimeout("document.documentElement.className = '';", delay);
57 </script>
58 </body>
59 </html>