chromium/third_party/blink/web_tests/fast/dom/HTMLImageElement/image-load-cross-document.html

<head>
<script>

var isDocumentLoaded = false;
var isFrameLoaded = false;

function everythingLoaded()
{
    var otherDocument = document.getElementById("frame").contentDocument;
    var imageURL = document.URL.replace("image-load-cross-document.html", "resources/blue_rect.jpg");
    otherDocument.body.innerHTML = "<p id='container'><img src='" + imageURL + "'></p>";
    var container = otherDocument.getElementById("container");
    document.adoptNode(container);
    document.body.appendChild(container);
    container.innerHTML = "";

    document.getElementById("result").innerHTML = "PASS: Test complete and passed unless a subsequent test crashes.";

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

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

    isDocumentLoaded = true;

    if (isFrameLoaded)
        everythingLoaded();
}

function frameLoaded()
{
    isFrameLoaded = true;

    if (isDocumentLoaded)
        everythingLoaded();
}

</script>
</head>
<body onload="documentLoaded()">
<p>This tests the case where an image is loaded in one document and then moved to another before the load event fires.</p>
<p id="result">TEST NOT COMPLETE YET</p>
<iframe id="frame" src="resources/image-load-subframe.html" onload="frameLoaded()"></iframe>
</body>