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

<html>
<body>
<p>Test worker invalid url exceptions. Should print two "PASS" statements.</p>
<div id=result></div>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

try {
    new Worker("http://example.com/worker.js");
    log("FAIL: No exception thrown when accessing a worker from another domain.");
} catch (error) {
    if (error.code == 18)
        log("PASS: Got security error.");
    else
        log("FAIL: Got error code " + error.code + ". Expected error code 18.");
}

try {
    new Worker("http://invalid:123$");
    log("FAIL: No exception throw when accessing an invalid url.");
} catch (error) {
    if (error.code == 12)
        log("PASS: Got syntax error.");
    else
        log("FAIL: Got error code " + error.code + ". Expected error code 12.");
}
</script>
</body>
</html>