<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../../js-test-resources/js-test-pre.js"></script>
</head>
<body onload="test()">
This tests for proper execution order of scripts with the async attribute <a href="https://bugs.webkit.org/show_bug.cgi?id=20710">https://bugs.webkit.org/show_bug.cgi?id=20710</a>.<hr>
<div id="console"></div>
<script type="text/javascript">
var jsTestIsAsync = true;

function debug(msg)
{
    if (!window.status_)
        window.status_ = '';
    window.status_ += ' ' + msg + ' ';
}

document.addEventListener("DOMContentLoaded", function() {
    debug('DOMContentLoaded');
}, false);

function test()
{
    var expectedA = " async  external  inline  DOMContentLoaded  slowAsync ";
    var expectedB = " external  async  inline  DOMContentLoaded  slowAsync ";
    var expectedC = " external  inline  async  DOMContentLoaded  slowAsync ";
    var expectedD = " external  inline  DOMContentLoaded  async  slowAsync ";
    var results = "PASS";
    if (window.status_ != expectedA && window.status_ != expectedB && window.status_ != expectedC && window.status_ != expectedD)
        results = "FAIL: Expected one of '" + expectedA + "' || '" + expectedB + "' || '" + expectedC + "' || '" + expectedD + "', Actual='" + window.status_ + "'";
    document.getElementById("console").innerHTML = results;
    finishJSTest();
}

</script>
<script src="http://127.0.0.1:8000/misc/resources/slow-async-script.cgi" async="ASYNC"></script>
<script src="http://127.0.0.1:8000/misc/resources/async-script.js" async="ASYNC"></script>
<script src="http://127.0.0.1:8000/misc/resources/external-script.js"></script>
<script>
debug("inline");
</script>
<script src="../../js-test-resources/js-test-post.js"></script>
</body>
</html>


