chromium/third_party/blink/web_tests/http/tests/websocket/workers/worker-shutdown-race.html

<!DOCTYPE html>
<div id="result"></div>
<script>
// This is a regression test for crbug.com/341754
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

if (document.location.hash.match(/done/)) {
    document.getElementById("result").innerHTML = "Done.";
    testRunner.notifyDone();
} else {
    var w = new Worker("resources/worker-create-ws.js");
    var start = new Date() - 0;
    // Wait 300ms without allowing any tasks to run. This gives time for the
    // Worker to be created and post a task to create the WebSocket on the main
    // thread, without actually letting that task be executed.
    while (new Date() - start < 300) {}
    // Cause the Worker to be destroyed.
    location.hash = "done";
    location.reload();
}
</script>