image-decoding.html (1523B)
1 <!DOCTYPE html> 2 <!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. --> 3 <html> 4 <head> 5 <title>Image decoding - cross-origin image request</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <!-- Common global functions for referrer-policy tests. --> 9 <script src="/common/security-features/resources/common.sub.js"></script> 10 </head> 11 <body> 12 <h1>Image decoding - cross-origin image request</h1> 13 <p>If you can read JSON encoded HTTP headers of the image below, 14 the decoding works as expected.</p> 15 16 <pre id="received_message">Running...</pre> 17 18 <script> 19 promise_test(function() { 20 var urlPath = '/common/security-features/subresource/image.py'; 21 var url = location.protocol + "//www1." + location.hostname + ":" + location.port + 22 urlPath + "?cache_destroyer=" + (new Date()).getTime(); 23 return requestViaImage(url, undefined, "always") 24 .then(function(message) { 25 var pre = document.getElementById('received_message') 26 var headers = message.headers; 27 pre.innerHTML = ""; 28 pre.innerHTML += url + ":\n\n"; 29 pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n" 30 assert_own_property(headers, "host") 31 assert_own_property(headers, "connection") 32 }); 33 }, "Image is encoding headers as JSON."); 34 </script> 35 36 <div id="log"></div> 37 </body> 38 </html>