Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html class="reftest-wait"> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Delayed image reftest wrapper</title> |
michael@0 | 5 | </head> |
michael@0 | 6 | <body> |
michael@0 | 7 | <img id="image1"> |
michael@0 | 8 | <script> |
michael@0 | 9 | // This loads a externally specified image, forces a draw (in case of |
michael@0 | 10 | // decode-on-draw), waits 350ms, and then triggers the reftest snapshot. |
michael@0 | 11 | // This allows the animation on the page to complete. |
michael@0 | 12 | // |
michael@0 | 13 | // Use as "delaytest.html?animation.png" |
michael@0 | 14 | // |
michael@0 | 15 | |
michael@0 | 16 | // Get the image URL from our URL |
michael@0 | 17 | var imgURL = document.location.search.substr(1); |
michael@0 | 18 | |
michael@0 | 19 | // Load the image |
michael@0 | 20 | var img = document.images[0]; |
michael@0 | 21 | img.src = imgURL; |
michael@0 | 22 | img.onload = forceDecode; |
michael@0 | 23 | img.onerror = forceDecode; |
michael@0 | 24 | |
michael@0 | 25 | function forceDecode() { |
michael@0 | 26 | |
michael@0 | 27 | try { |
michael@0 | 28 | // We need to force drawing of the image in an invisible context |
michael@0 | 29 | var canvas = document.createElement("canvas"); |
michael@0 | 30 | var ctx = canvas.getContext("2d"); |
michael@0 | 31 | ctx.drawImage(img, 0, 0); |
michael@0 | 32 | } catch(e) {} |
michael@0 | 33 | |
michael@0 | 34 | // We've force the decode. start the timer to trigger the reftest |
michael@0 | 35 | startTimer(); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function startTimer() { |
michael@0 | 39 | const delay = 350; |
michael@0 | 40 | setTimeout("document.documentElement.className = '';", delay); |
michael@0 | 41 | } |
michael@0 | 42 | </script> |
michael@0 | 43 | </body> |
michael@0 | 44 | </html> |