chromium/third_party/blink/web_tests/fast/workers/shared-worker-load-error.html

<script src="../../resources/gc.js"></script>
<body>
<p>Test SharedWorker onerror functionality. Prints multiple SUCCESS lines, then DONE when complete.</p>
<div id=result></div>
<script>
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function testSimpleLoadError()
{
    var worker = new SharedWorker("file_does_not_exist.js", "name");
    worker.onerror = function(evt) {
        log("PASS: Received load error event: " + evt);
        testLoadErrorGC();
    }
}

function testLoadErrorGC()
{
    var worker = new SharedWorker("file_does_not_exist.js", "name");
    worker.onerror = handleError;
    worker = null;
    gc();
}

function handleError(evt) {
    log("PASS: Received error event after worker GC'd: " + evt);
    log("DONE");
    if (window.testRunner)
        testRunner.notifyDone();
}

testSimpleLoadError();
</script>
</body>