Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / workers / worker-invalid-url.html
blobcb54a695b20f9f8f73d11d8a28c408743e58b911
1 <html>
2 <body>
3 <p>Test worker invalid url exceptions. Should print two "PASS" statements.</p>
4 <div id=result></div>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 function log(message)
11 document.getElementById("result").innerHTML += message + "<br>";
14 try {
15 new Worker("http://example.com/worker.js");
16 log("FAIL: No exception thrown when accessing a worker from another domain.");
17 } catch (error) {
18 if (error.code == 18)
19 log("PASS: Got security error.");
20 else
21 log("FAIL: Got error code " + error.code + ". Expected error code 18.");
24 try {
25 new Worker("http://invalid:123$");
26 log("FAIL: No exception throw when accessing an invalid url.");
27 } catch (error) {
28 if (error.code == 12)
29 log("PASS: Got syntax error.");
30 else
31 log("FAIL: Got error code " + error.code + ". Expected error code 12.");
33 </script>
34 </body>
35 </html>