<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Fetch in worker: ensuring that no crash happens</title>
    </head>
    <body>
        <p id="log">PASS if no crash... </p>
        <script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var numTerminated = 0;
var numWorker = 50;
for (var cptr = 0; cptr < numWorker; ++cptr) {
    let worker = new Worker('fetch-worker-crash.js');
    worker.onmessage = (event) => {
        if (event.data == "starting")
            worker.terminate();
        if (++numTerminated == numWorker) {
            document.getElementById('log').innerHTML += "DONE";
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }
}
        </script>
    </body>
</html>
