test_uri_scheme.html (1188B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 --> 5 <head> 6 <title>Test for URI Manipulation</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 10 <script type="text/javascript"> 11 function dotest1() 12 { 13 SimpleTest.waitForExplicitFinish(); 14 var o = new URL("http://localhost/"); 15 try { o.href = "foopy:bar:baz"; } catch(e) { } 16 o.protocol = "http:"; 17 o.hostname; 18 try { o.href = "http://localhost/"; } catch(e) { } 19 ok(o.protocol, "http:"); 20 dotest2(); 21 } 22 23 function dotest2() 24 { 25 var o = new URL("http://www.mozilla.org/"); 26 try { 27 o.href ="aaaaaaaaaaa:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 28 } catch(e) { } 29 o.hash = "#"; 30 o.pathname = "/"; 31 o.protocol = "http:"; 32 try { o.href = "http://localhost/"; } catch(e) { } 33 ok(o.protocol, "http:"); 34 dotest3(); 35 } 36 37 function dotest3() 38 { 39 is(new URL("resource://123/").href, "resource://123/"); 40 SimpleTest.finish(); 41 } 42 </script> 43 </head> 44 <body onload="dotest1();"> 45 <p id="display"></p> 46 <div id="content" style="display: none"></div> 47 <pre id="test"> 48 </pre> 49 </body> 50 </html>