location_assign.html (668B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>location_assign</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 </head> 8 <body> 9 <div id="log"></div> 10 <script> 11 test(function () { 12 var href = location.href; 13 location.assign('#x'); 14 15 assert_equals((href + "#x"), location.href, "location href"); 16 17 }, "location assign"); 18 19 test(function () { 20 var href = location.href; 21 assert_throws_dom('SYNTAX_ERR', function() { location.assign("http://:"); }); 22 assert_equals(location.href, href); 23 }, "URL that fails to parse"); 24 </script> 25 </body> 26 </html>