OLD | NEW |
| (Empty) |
1 <html> | |
2 <head id="head"> | |
3 <script type="text/javascript"> | |
4 function print(message, color) { | |
5 var paragraph = document.createElement("div"); | |
6 paragraph.appendChild(document.createTextNode(message)); | |
7 paragraph.style.fontFamily = "monospace"; | |
8 if (color) | |
9 paragraph.style.color = color; | |
10 document.getElementById("console").appendChild(paragraph); | |
11 } | |
12 | |
13 if (window.testRunner) { | |
14 testRunner.dumpAsText(); | |
15 } | |
16 | |
17 var results = [true, true, false, false]; | |
18 var description = ["remove src attribute of an <img> to see whether it g
ets loaded. (It should NOT be loaded.)", | |
19 "define an <img> with no src specified to see whether
it gets loaded. (It should NOT be loaded.)", | |
20 "define a <img> with src='' to see whether it gets lo
aded. (It should NOT be loaded, because the base URI is a local file.)", | |
21 "change the base URI to an http: URL and define a <im
g> with src='' to see whether it gets loaded. (It should NOT be loaded.)" ] | |
22 | |
23 function outputResults() { | |
24 for (index = 0; index < 4; index++) { | |
25 print("[" + index +"] " + description[index], "black"); | |
26 if (results[index]) | |
27 print("PASS", "green"); | |
28 else | |
29 print("FAIL", "red"); | |
30 } | |
31 } | |
32 </script> | |
33 </head> | |
34 <body onload="outputResults();"> | |
35 <p>This page tests loading image with empty src attribute.</p> | |
36 <hr> | |
37 <div id="console"></div> | |
38 <img id="image1" style="display:none" src="resources/test-load.jpg" onerror=
"results[0] = false;" /> | |
39 <img id="image2" style="display:none" onerror="results[1] = false;" /> | |
40 <img id="image3" style="display:none" src="" onerror="results[2] = true;" /> | |
41 <script type="text/javascript"> | |
42 var imgNode1 = document.getElementById("image1"); | |
43 imgNode1.removeAttribute("src"); | |
44 document.getElementById("head").appendChild(document.createElement("base
")).setAttribute("href", "http://127.0.0.1:8888/"); | |
45 </script> | |
46 <img id="image4" style="display:none" src="" onerror="results[3] = true;" /> | |
47 </body> | |
48 </html> | |
OLD | NEW |