<html>
<head>
<title>&lt;SCRIPT&gt; load and error events</title>
<script type="text/javascript">
var status_ = new Array();

function loaded(i)
{
    status_[i] = "L";
}

function erred(i)
{
    status_[i] = "E";
}

function endTest()
{
    var failures = "";
    if (status_[0] != "E")
        failures += "0 ";
    if (status_[1] != "E")
        failures += "1 ";

    if (status_[2] != "L")
        failures += "2 ";
    if (status_[3] != "L")
        failures += "3 ";
    if (status_[4] != "L")
        failures += "4 ";
    if (status_[5] != "L")
        failures += "5 ";

    var results = document.getElementById("results");
    if (failures)
        results.innerHTML = "FAIL: The following tests failed: " + failures;
    else
        results.innerHTML = "PASS";

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

function test()
{
    if (window.layoutTestController) {
        layoutTestController.dumpAsText();
        layoutTestController.waitUntilDone();
    }

    var e = document.createElement("script");
    e.type = "text/javascript";
    e.src = 'resources/script-load.js';
    e.onload = function() {
        loaded(5);
        endTest();
    };
    document.getElementsByTagName("head")[0].appendChild( e ); 
}
</script>
</head>
<body onload="test()">
<script type="text/javascript" onload="loaded(0)" onerror="erred(0)" src="resources/certainlydoesnotexist.js"></script>
<script type="text/javascript" onload="loaded(1)" onerror="erred(1)" src="resources/certainlydoesnotexist.js"></script>
<script type="text/javascript" onload="loaded(2)" onerror="erred(2)" src="resources/script-load.js"></script>
<script type="text/javascript" onload="loaded(3)" onerror="erred(3)" src="resources/script-load.js"/>
<script type="text/javascript">
    document.write('<script type="text/javascript" onload="loaded(4)" onerror="erred(4)" src="resources/script-load.js"></script'+'>');
</script>
This tests for regressions against <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=5812">http://bugzilla.opendarwin.org/show_bug.cgi?id=5812</a>
Generate load events for &lt;script&gt; elements</i>.
<hr>
<p id="results">FAIL: Test never finished.</p>
</body>
</html>
