chromium/third_party/blink/web_tests/http/tests/workers/worker-workerScriptNotThere.html

<html>
<body>
<p>Test worker file does not exist error. Should print two "PASS" statements followed by "DONE".</p>
<p>The order of the error events should be onerror and then error event, and this test should be improved to verify that when bug https://bugs.webkit.org/show_bug.cgi?id=62485 is fixed.</p>
<div id=result></div>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

function done()
{
    log("DONE");
    if (window.testRunner)
        testRunner.notifyDone();
}

var eventCount = 0;

function eventDone()
{
    eventCount++;
    if (eventCount == 2)
        done();
}

var worker;
try {
    worker = new Worker("this-file-does-should-not-exist.js");
} catch (error) {
    log("FAIL: Exception thrown.");
}

worker.addEventListener('error', function(error) {
    log("PASS: error event.");
    eventDone();
}, false);

worker.onerror =  function(error) {
    log("PASS: onerror called.");
    eventDone();
};

</script>
</body>
</html>