OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-host"> | 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-host"> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 test(function() { | 7 test(function() { |
8 var url = new URL('https://www.mydomain.com:8080/path/'); | 8 var url = new URL('https://www.mydomain.com:8080/path/'); |
9 assert_equals(url.host, 'www.mydomain.com:8080'); | 9 assert_equals(url.host, 'www.mydomain.com:8080'); |
10 url.host = 'www.otherdomain.com:0'; | 10 url.host = 'www.otherdomain.com:0'; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 test(function() { | 101 test(function() { |
102 var url = new URL('http://abc.de/path/file?query#fragment'); | 102 var url = new URL('http://abc.de/path/file?query#fragment'); |
103 url.href = 'invalid'; | 103 url.href = 'invalid'; |
104 assert_equals(url.host, ''); | 104 assert_equals(url.host, ''); |
105 url.host = 'changed'; | 105 url.host = 'changed'; |
106 assert_equals(url.host, ''); | 106 assert_equals(url.host, ''); |
107 assert_equals(url.href, 'invalid'); | 107 assert_equals(url.href, 'invalid'); |
108 }, 'host property invalid URL'); | 108 }, 'host property invalid URL'); |
109 | 109 |
| 110 test(function() { |
| 111 var url = new URL('http://www.domain.com/'); |
| 112 assert_equals(url.host, 'www.domain.com'); |
| 113 |
| 114 url.host = 'www.bo\udc01\ud802gus.org'; |
| 115 assert_equals(url.host, ''); |
| 116 }, 'hostname with unmatched surrogates'); |
| 117 |
110 </script> | 118 </script> |
OLD | NEW |