49 lines
2.2 KiB
HTML
49 lines
2.2 KiB
HTML
<html>
|
|
<head id="head">
|
|
<script type="text/javascript">
|
|
function print(message, color) {
|
|
var paragraph = document.createElement("div");
|
|
paragraph.appendChild(document.createTextNode(message));
|
|
paragraph.style.fontFamily = "monospace";
|
|
if (color)
|
|
paragraph.style.color = color;
|
|
document.getElementById("console").appendChild(paragraph);
|
|
}
|
|
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
}
|
|
|
|
var results = [true, true, false, false];
|
|
var description = ["remove src attribute of an <img> to see whether it gets loaded. (It should NOT be loaded.)",
|
|
"define an <img> with no src specified to see whether it gets loaded. (It should NOT be loaded.)",
|
|
"define a <img> with src='' to see whether it gets loaded. (It should NOT be loaded, because the base URI is a local file.)",
|
|
"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.)" ]
|
|
|
|
function outputResults() {
|
|
for (index = 0; index < 4; index++) {
|
|
print("[" + index +"] " + description[index], "black");
|
|
if (results[index])
|
|
print("PASS", "green");
|
|
else
|
|
print("FAIL", "red");
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="outputResults();">
|
|
<p>This page tests loading image with empty src attribute.</p>
|
|
<hr>
|
|
<div id="console"></div>
|
|
<img id="image1" style="display:none" src="resources/test-load.jpg" onerror="results[0] = false;" />
|
|
<img id="image2" style="display:none" onerror="results[1] = false;" />
|
|
<img id="image3" style="display:none" src="" onerror="results[2] = true;" />
|
|
<script type="text/javascript">
|
|
var imgNode1 = document.getElementById("image1");
|
|
imgNode1.removeAttribute("src");
|
|
document.getElementById("head").appendChild(document.createElement("base")).setAttribute("href", "http://127.0.0.1:8888/");
|
|
</script>
|
|
<img id="image4" style="display:none" src="" onerror="results[3] = true;" />
|
|
</body>
|
|
</html>
|