getresponseheader-error-state.htm (1345B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: getResponseHeader() in error state (failing cross-origin test)</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-getresponseheader" data-tested-assertations="following::OL[1]/LI[2]" /> 8 </head> 9 <body> 10 <div id="log"></div> 11 <script> 12 var test = async_test() 13 test.step(function() { 14 15 var client = new XMLHttpRequest() 16 client.onreadystatechange = function() { 17 test.step(function() { 18 if(client.readyState == 1) { 19 assert_equals(client.getResponseHeader("x-custom-header"), null) 20 } 21 if(client.readyState > 1) { 22 assert_equals(client.getResponseHeader("x-custom-header"), null) 23 } 24 if(client.readyState == 4){ 25 assert_equals(client.getResponseHeader("x-custom-header"), null) 26 test.done() 27 } 28 }) 29 } 30 var url = location.protocol + "//" + 'www1.' + location.host + (location.pathname.replace(/getresponseheader-error-state\.htm/, 'resources/nocors/folder.txt')) 31 client.open("GET", url) 32 client.send(null) 33 }) 34 </script> 35 </body> 36 </html>