<html>
<head>
<script src="/js-test-resources/js-test-pre.js"></script>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function log(msg) {
    document.getElementById("log").innerHTML += msg;
}

function test() {
    var s = document.createElement("script");
    s.src = "resources/delayed-log.py?delay=1&msg=PASS&done=1";
    s.async = true;
    document.body.appendChild(s);

    // s should still execute.
    document.body.removeChild(s);
    setTimeout(gc, 1);
}
</script>
</head>
<body onload="test()">
<div>
<p>
Test that an asynchronous script tag is executed, even if it's removed from the
document before it was loaded.
</p>
<p>
This test passes if the word "PASS" is displayed below.
</p>
</div>
<div id="log"></div>
</body>
</html>
