access-control-expose-headers-on-redirect.html (1011B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>XHR should respect access-control-expose-headers header on redirect</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/get-host-info.sub.js"></script> 8 </head> 9 <body> 10 <script type="text/javascript"> 11 async_test((test) => { 12 const xhr = new XMLHttpRequest; 13 14 xhr.onerror = test.unreached_func("Unexpected error."); 15 16 xhr.onload = test.step_func_done(() => { 17 assert_equals(xhr.status, 200); 18 assert_equals(xhr.getResponseHeader('foo'), 'bar'); 19 assert_equals(xhr.getResponseHeader('hoge'), null); 20 }); 21 22 const destination = get_host_info().HTTP_REMOTE_ORIGIN + 23 '/common/blank.html?pipe=header(access-control-allow-origin,*)|' + 24 'header(access-control-expose-headers,foo)|' + 25 'header(foo,bar)|header(hoge,fuga)'; 26 const url = 27 'resources/redirect.py?location=' + encodeURIComponent(destination); 28 xhr.open('GET', url); 29 xhr.send(); 30 }); 31 </script> 32 </body> 33 </html>