worker-messaging.html (1499B)
1 <!DOCTYPE html> 2 <!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. --> 3 <html> 4 <head> 5 <title>Worker messaging - same-origin Worker 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>Worker messaging - same-origin Worker request</h1> 13 <p>If you can read JSON encoded HTTP request headers of the Worker below, 14 the messaging 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/worker.py'; 21 var url = location.protocol + "//" + location.hostname + ":" + 22 location.port + urlPath; 23 return requestViaDedicatedWorker(url, {}) 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 }, "Worker is responding with HTTP headers"); 34 </script> 35 36 <div id="log"></div> 37 </body> 38 </html>