<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.layoutTestController) {
            layoutTestController.dumpAsText(); 
        }
        
        var results = [true, true, true, 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 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] = false;" />
    <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>
