|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=733553 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 733553</title> |
|
8 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body onload="initializeOnload()"> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=733553">Mozilla Bug 733553</a> |
|
14 <p id="display"></p> |
|
15 <pre id="test"> |
|
16 <script type="application/javascript"> |
|
17 |
|
18 SimpleTest.waitForExplicitFinish(); |
|
19 |
|
20 var testIndex = -1; |
|
21 var testParts = [ |
|
22 [1, "red.png"], |
|
23 [40, "animated-gif2.gif"], |
|
24 [1, "red.png"], |
|
25 [100, "lime100x100.svg"], |
|
26 [100, "lime100x100.svg"], |
|
27 [40, "animated-gif2.gif"], |
|
28 [1, "red.png"], |
|
29 // Note a failure of the next 'red.png' may indicate failure of resniffing on |
|
30 // this part ('shaver.png'); see bug 907575. |
|
31 [177, "shaver.png"], |
|
32 [1, "red.png"], |
|
33 [80, "damon.jpg"], |
|
34 [80, "damon.jpg"], |
|
35 [80, "damon.jpg"], |
|
36 // An invalid image (from bug 787899) that is further delivered with a |
|
37 // "special" bad MIME type that indicates that the necko |
|
38 // multipart/x-mixed-replace parser wasn't able to parse it. |
|
39 [0, "rillybad.jpg"], |
|
40 [80, "damon.jpg"], |
|
41 [0, "bad.jpg"], |
|
42 [1, "red.png"], |
|
43 [0, "invalid.jpg"], |
|
44 [40, "animated-gif2.gif"] |
|
45 ]; |
|
46 |
|
47 // We'll append the part number to this, and tell the informant |
|
48 const BASE_URL = "bug733553-informant.sjs?"; |
|
49 |
|
50 function initializeOnload() { |
|
51 var firstimg = document.createElement('img'); |
|
52 firstimg.addEventListener("load", imageLoad, false); |
|
53 firstimg.addEventListener("error", imageLoad, false); |
|
54 firstimg.alt = ""; |
|
55 firstimg.src = "bug733553.sjs"; |
|
56 document.getElementById('content').appendChild(firstimg); |
|
57 |
|
58 // Really ready for first, but who's counting |
|
59 readyForNext(); |
|
60 } |
|
61 |
|
62 function readyForNext() { |
|
63 var loader = document.getElementById("loader"); |
|
64 loader.src = BASE_URL + ++testIndex; |
|
65 } |
|
66 |
|
67 function imageLoad(aEvent) { |
|
68 var [width, fileName] = testParts[testIndex]; |
|
69 is(aEvent.target.width, width, |
|
70 "Test " + testIndex + " " + fileName + " width correct"); |
|
71 |
|
72 // Always call readyForNext here, as it's the closest we have to a cleanup |
|
73 readyForNext(); |
|
74 if (testParts.length == testIndex) { |
|
75 var firstimg = document.getElementsByTagName('img')[0]; |
|
76 firstimg.removeEventListener("load", imageLoad, false); |
|
77 firstimg.removeEventListener("error", imageLoad, false); |
|
78 SimpleTest.finish(); |
|
79 } |
|
80 } |
|
81 |
|
82 </script> |
|
83 </pre> |
|
84 <div id="content"> <!-- style="display: none" --> |
|
85 <iframe id="loader"></iframe> |
|
86 </div> |
|
87 </body> |
|
88 </html> |