chromium/third_party/blink/web_tests/fast/dom/HTMLScriptElement/script-load-events.html

<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_[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.testRunner)
        testRunner.notifyDone();
}

function test()
{
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.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>
<!-- 3 was a self-closing script tag, however that is covered by fast/parser/script-tag-with-trailing-slash.html -->
<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="https://bugs.webkit.org/show_bug.cgi?id=5812">https://bugs.webkit.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>