Bug 1610775 [wpt PR 21336] - Update urllib3 to 1.25.8, a=testonly
[gecko.git] / dom / url / tests / test_urlExceptions.html
blobd80c57ae7133e07263f7f8df08cdcd20fef42533
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=926890
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 926890</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=926890">Mozilla Bug 926890</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 <iframe name="x" id="x"></iframe>
17 <iframe name="y" id="y"></iframe>
18 </div>
19 <pre id="test">
20 </pre>
21 <script type="application/javascript">
23 // URL.href throws
24 var url = new URL("http://www.example.com");
25 ok(url, "URL created");
27 try {
28 url.href = "42";
29 ok(false, "url.href = 42 should throw");
30 } catch (e) {
31 ok(true, "url.href = 42 should throw");
32 ok(e instanceof TypeError, "error type typeError");
35 url.href = "http://www.example.org";
36 ok(true, "url.href should not throw");
38 try {
39 new URL("42");
40 ok(false, "new URL(42) should throw");
41 } catch (e) {
42 ok(true, "new URL(42) should throw");
43 ok(e instanceof TypeError, "error type typeError");
46 try {
47 new URL("http://www.example.com", "42");
48 ok(false, "new URL(something, 42) should throw");
49 } catch (e) {
50 ok(true, "new URL(something, 42) should throw");
51 ok(e instanceof TypeError, "error type typeError");
54 </script>
55 </body>
56 </html>