Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=512435 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 512435</title> |
michael@0 | 8 | <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="text/javascript" src="/tests/image/test/mochitest/imgutils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=512435">Mozilla Bug 512435</a> |
michael@0 | 15 | <img id="img_a"> |
michael@0 | 16 | <img id="img_b"> |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script type="application/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | // Boilerplate |
michael@0 | 22 | const Ci = SpecialPowers.Ci; |
michael@0 | 23 | const Cc = SpecialPowers.Cc; |
michael@0 | 24 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 25 | |
michael@0 | 26 | // We're relying on very particular behavior for certain images - clear the |
michael@0 | 27 | // image cache, _then_ set src |
michael@0 | 28 | clearImageCache(); |
michael@0 | 29 | document.getElementById("img_a").src = "damon.jpg"; |
michael@0 | 30 | document.getElementById("img_b").src = "shaver.png"; |
michael@0 | 31 | |
michael@0 | 32 | // Our handler |
michael@0 | 33 | function loadHandler() { |
michael@0 | 34 | |
michael@0 | 35 | // The two images should be decoded |
michael@0 | 36 | ok(isFrameDecoded("img_a"), "img_a should be decoded before onload fires"); |
michael@0 | 37 | ok(isFrameDecoded("img_b"), "img_b should be decoded before onload fires"); |
michael@0 | 38 | |
michael@0 | 39 | // All done |
michael@0 | 40 | SimpleTest.finish(); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | // Set our onload handler |
michael@0 | 44 | window.onload = loadHandler; |
michael@0 | 45 | |
michael@0 | 46 | </script> |
michael@0 | 47 | </pre> |
michael@0 | 48 | </body> |
michael@0 | 49 | </html> |