chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded.html

<html>
    <head>
        <title>Safari Issue: Not Rendering Images Imported from XHTML Document</title>
    </head>
    <body>
        <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=17897"> bug 17897 </a>:  Not Rendering Images Imported from XHTML Document </p>
        <p> You should see PASSED once. </p>
        <div id='console'>FAILED (did not load the image)</div>
        <div id='image' style="display: none"> </div>
        <script type="text/javascript">

        function logSuccessOrFailure()
        {
            var console = document.getElementById('console');
            // If the image was loaded correctly, then height
            // and width are not zero.
            if (icon.height && icon.width)
                console.innerHTML = "PASSED";
            else
                console.innerHTML = "FAILED";

            if (window.testRunner)
                testRunner.notifyDone();
        }

        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'resources/load-icon.xhtml');
        xhr.onreadystatechange = function(){
            if(xhr.readyState == 4 && xhr.status == 200) {
                var div = xhr.responseXML.getElementsByTagName('div')[0];
                try {
                    document.adoptNode(div);
                }
                catch(e){}

                var icon = div.getElementsByTagName('img')[0];
                icon.addEventListener("load", logSuccessOrFailure, true);

                document.getElementById('image').appendChild(div);
            }
        };
        xhr.send(null);
        </script>
    </body>
</html>