send-redirect-bogus.htm (1396B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: send() - Redirects (bogus Location header)</title> 5 <meta name=timeout content=long> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2] following::dl[1]/dd[2]/ol/li[1] following::dl[1]/dd[2]/ol/li[3]" /> 9 </head> 10 <body> 11 <div id="log"></div> 12 <script> 13 function redirect(code, location) { 14 var test = async_test(document.title + " (" + code + ": " + location + ")"); 15 test.step(function() { 16 var client = new XMLHttpRequest() 17 client.onreadystatechange = function() { 18 test.step(function() { 19 if(client.readyState == 4) { 20 assert_equals(client.status, 0) 21 assert_equals(client.statusText, "") 22 test.done() 23 } 24 }) 25 } 26 client.open("GET", "resources/redirect.py?location=" + location + "&code=" + code) 27 client.send(null) 28 }) 29 } 30 redirect("302", "http://example.not") 31 redirect("302", "mailto:someone@example.org") 32 redirect("303", "http://example.not") 33 redirect("303", "foobar:someone@example.org") 34 </script> 35 </body> 36 </html>