1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/test/test_url_malformedHost.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 + 1.5 +<!DOCTYPE HTML> 1.6 +<html> 1.7 +<!-- 1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=1020041 1.9 +--> 1.10 +<head> 1.11 + <meta charset="utf-8"> 1.12 + <title>Test for Bug 1020041</title> 1.13 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.15 +</head> 1.16 +<body> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020041">Mozilla Bug 1020041</a> 1.18 +<p id="display"></p> 1.19 +<div id="content" style="display: none"> 1.20 + <iframe name="x" id="x"></iframe> 1.21 + <iframe name="y" id="y"></iframe> 1.22 +</div> 1.23 +<pre id="test"> 1.24 +</pre> 1.25 + <a id="link" href="http://www.example.com:8080">foobar</a> 1.26 + <area id="area" href="http://www.example.com:8080" /> 1.27 + <script type="application/javascript"> 1.28 + 1.29 + var tests = [ 1.30 + { host: '?', expected: 'www.example.com' }, 1.31 + { host: 'what?' , expected: 'what' }, 1.32 + { host: 'so what' , expected: 'www.example.com' }, 1.33 + { host: 'aa#bb' , expected: 'aa' }, 1.34 + { host: 'a/b' , expected: 'a' }, 1.35 + { host: 'a\\b', expected: 'a' }, 1.36 + { host: 'abcd#bla:10', expected: 'abcd'} 1.37 + ]; 1.38 + 1.39 + for (var i = 0; i < tests.length; ++i) { 1.40 + var url = new URL('http://www.example.com'); 1.41 + url.host = tests[i].host; 1.42 + is (url.host, tests[i].expected, "URL.host is: " + url.host); 1.43 + 1.44 + url = new URL('http://www.example.com'); 1.45 + url.hostname = tests[i].host; 1.46 + is (url.hostname, tests[i].expected, "URL.hostname is: " + url.host); 1.47 + } 1.48 + 1.49 + </script> 1.50 +</body> 1.51 +</html>