|
1 |
|
2 <!DOCTYPE HTML> |
|
3 <html> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=1020041 |
|
6 --> |
|
7 <head> |
|
8 <meta charset="utf-8"> |
|
9 <title>Test for Bug 1020041</title> |
|
10 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020041">Mozilla Bug 1020041</a> |
|
15 <p id="display"></p> |
|
16 <div id="content" style="display: none"> |
|
17 <iframe name="x" id="x"></iframe> |
|
18 <iframe name="y" id="y"></iframe> |
|
19 </div> |
|
20 <pre id="test"> |
|
21 </pre> |
|
22 <a id="link" href="http://www.example.com:8080">foobar</a> |
|
23 <area id="area" href="http://www.example.com:8080" /> |
|
24 <script type="application/javascript"> |
|
25 |
|
26 var tests = [ |
|
27 { host: '?', expected: 'www.example.com' }, |
|
28 { host: 'what?' , expected: 'what' }, |
|
29 { host: 'so what' , expected: 'www.example.com' }, |
|
30 { host: 'aa#bb' , expected: 'aa' }, |
|
31 { host: 'a/b' , expected: 'a' }, |
|
32 { host: 'a\\b', expected: 'a' }, |
|
33 { host: 'abcd#bla:10', expected: 'abcd'} |
|
34 ]; |
|
35 |
|
36 for (var i = 0; i < tests.length; ++i) { |
|
37 var url = new URL('http://www.example.com'); |
|
38 url.host = tests[i].host; |
|
39 is (url.host, tests[i].expected, "URL.host is: " + url.host); |
|
40 |
|
41 url = new URL('http://www.example.com'); |
|
42 url.hostname = tests[i].host; |
|
43 is (url.hostname, tests[i].expected, "URL.hostname is: " + url.host); |
|
44 } |
|
45 |
|
46 </script> |
|
47 </body> |
|
48 </html> |