blob: 891d3d9676f0316a5c55ce2f066a1dcec7550ab8 [file] [log] [blame]
darin@apple.comebecba82008-03-17 16:43:49 +00001<html>
mitz@apple.comef1d58db2008-06-28 17:49:23 +00002<head id="head">
darin@apple.comebecba82008-03-17 16:43:49 +00003 <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
rniwa@webkit.org06ad32a2012-06-22 08:52:23 +000013 if (window.testRunner) {
14 testRunner.dumpAsText();
darin@apple.comebecba82008-03-17 16:43:49 +000015 }
16
japhet@chromium.org59e6e212011-08-31 19:01:08 +000017 var results = [true, true, false, false];
darin@apple.comebecba82008-03-17 16:43:49 +000018 var description = ["remove src attribute of an <img> to see whether it gets 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.)",
mitz@apple.comef1d58db2008-06-28 17:49:23 +000020 "define a <img> with src='' to see whether it gets loaded. (It should NOT be loaded, because the base URI is a local file.)",
japhet@chromium.org59e6e212011-08-31 19:01:08 +000021 "change the base URI to an http: URL and define a <img> with src='' to see whether it gets loaded. (It should NOT be loaded.)" ]
darin@apple.comebecba82008-03-17 16:43:49 +000022
23 function outputResults() {
mitz@apple.comef1d58db2008-06-28 17:49:23 +000024 for (index = 0; index < 4; index++) {
darin@apple.comebecba82008-03-17 16:43:49 +000025 print("[" + index +"] " + description[index], "black");
mitz@apple.comac9ca1f2008-06-28 07:17:54 +000026 if (results[index])
darin@apple.comebecba82008-03-17 16:43:49 +000027 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>
mitz@apple.comac9ca1f2008-06-28 07:17:54 +000038 <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;" />
japhet@chromium.org59e6e212011-08-31 19:01:08 +000040 <img id="image3" style="display:none" src="" onerror="results[2] = true;" />
darin@apple.comebecba82008-03-17 16:43:49 +000041 <script type="text/javascript">
42 var imgNode1 = document.getElementById("image1");
43 imgNode1.removeAttribute("src");
mitz@apple.comef1d58db2008-06-28 17:49:23 +000044 document.getElementById("head").appendChild(document.createElement("base")).setAttribute("href", "http://127.0.0.1:8888/");
darin@apple.comebecba82008-03-17 16:43:49 +000045 </script>
mitz@apple.comef1d58db2008-06-28 17:49:23 +000046 <img id="image4" style="display:none" src="" onerror="results[3] = true;" />
darin@apple.comebecba82008-03-17 16:43:49 +000047</body>
48</html>