OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. --> |
| 3 <html> |
| 4 <head> |
| 5 <title>Fetch messaging - same-origin Fetch 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="/referrer-policy/generic/common.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <h1>Fetch messaging - same-origin Fetch request</h1> |
| 13 <p>If you can read JSON encoded HTTP request headers of the Fetch below, |
| 14 the messaging works as expected.</p> |
| 15 |
| 16 <pre id="received_message">Running...</pre> |
| 17 |
| 18 <script> |
| 19 test(function() { |
| 20 assert_true(!!window.fetch, "Fetch is not supported by this browser."); |
| 21 }, "Fetch is supported by the browser."); |
| 22 |
| 23 (function() { |
| 24 if (!window.fetch) |
| 25 return; |
| 26 |
| 27 var fetch_test = async_test("Fetch is responding with HTTP headers"); |
| 28 var urlPath = '/referrer-policy/generic/subresource/xhr.py'; |
| 29 var url = location.protocol + "//" + location.hostname + ":" + |
| 30 location.port + urlPath; |
| 31 queryFetch(url, function(message) { |
| 32 var pre = document.getElementById('received_message') |
| 33 var headers = message.headers; |
| 34 pre.innerHTML = ""; |
| 35 pre.innerHTML += url + ":\n\n"; |
| 36 pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"; |
| 37 fetch_test.step(function() { |
| 38 assert_own_property(headers, "host") |
| 39 assert_own_property(headers, "connection") |
| 40 }); |
| 41 fetch_test.done(); |
| 42 }); |
| 43 })(); |
| 44 </script> |
| 45 |
| 46 <div id="log"></div> |
| 47 </body> |
| 48 </html> |
OLD | NEW |