2 <html class=
"reftest-wait">
4 <title>Delayed image reftest wrapper
</title>
7 <!-- non-empty alt to avoid the broken image icon -->
8 <img id=
"image1" alt=
" ">
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);
24 var img
= document
.images
[0];
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;
37 decodeComplete
= true;
42 function reftestInvalidateListener() {
43 gotReftestInvalidate
= true;
47 function maybeStartTimer() {
48 if (decodeComplete
&& gotReftestInvalidate
) {
53 function startTimer() {
55 setTimeout("document.documentElement.className = '';", delay
);