worker-dedicated-constructor.sub.html (3060B)
1 <!DOCTYPE html> 2 <!-- 3 This test was procedurally generated. Please do not modify it directly. 4 Sources: 5 - fetch/metadata/tools/fetch-metadata.conf.yml 6 - fetch/metadata/tools/templates/worker-dedicated-constructor.sub.html 7 --> 8 <html lang="en"> 9 <meta charset="utf-8"> 10 <title>HTTP headers on request for dedicated worker via the "Worker" constructor</title> 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <script src="/fetch/metadata/resources/helper.sub.js"></script> 14 <script type="module"> 15 'use strict'; 16 function induceRequest(url, options) { 17 return new Promise((resolve, reject) => { 18 const worker = new Worker(url, options); 19 worker.onmessage = resolve; 20 worker.onerror = reject; 21 }); 22 } 23 24 promise_test(() => { 25 const key = '{{uuid()}}'; 26 const url = makeRequestURL( 27 key, 28 ['httpOrigin'], 29 { mime: 'application/javascript', body: 'postMessage("")' } 30 ); 31 32 return induceRequest(url) 33 .then(() => retrieve(key)) 34 .then((headers) => { 35 assert_not_own_property(headers, 'sec-fetch-site'); 36 }); 37 }, 'sec-fetch-site - Not sent to non-trustworthy same-origin destination, no options'); 38 39 promise_test(() => { 40 const key = '{{uuid()}}'; 41 const url = makeRequestURL( 42 key, 43 ['httpOrigin'], 44 { mime: 'application/javascript', body: 'postMessage("")' } 45 ); 46 47 return induceRequest(url) 48 .then(() => retrieve(key)) 49 .then((headers) => { 50 assert_not_own_property(headers, 'sec-fetch-mode'); 51 }); 52 }, 'sec-fetch-mode - Not sent to non-trustworthy same-origin destination, no options'); 53 54 promise_test(() => { 55 const key = '{{uuid()}}'; 56 const url = makeRequestURL( 57 key, 58 ['httpOrigin'], 59 { mime: 'application/javascript', body: 'postMessage("")' } 60 ); 61 62 return induceRequest(url) 63 .then(() => retrieve(key)) 64 .then((headers) => { 65 assert_not_own_property(headers, 'sec-fetch-dest'); 66 }); 67 }, 'sec-fetch-dest - Not sent to non-trustworthy same-origin destination, no options'); 68 69 promise_test(() => { 70 const key = '{{uuid()}}'; 71 const url = makeRequestURL( 72 key, 73 ['httpOrigin'], 74 { mime: 'application/javascript', body: 'postMessage("")' } 75 ); 76 77 return induceRequest(url) 78 .then(() => retrieve(key)) 79 .then((headers) => { 80 assert_not_own_property(headers, 'sec-fetch-user'); 81 }); 82 }, 'sec-fetch-user - Not sent to non-trustworthy same-origin destination, no options'); 83 84 promise_test(() => { 85 const key = '{{uuid()}}'; 86 const url = makeRequestURL( 87 key, 88 ['httpOrigin'], 89 { mime: 'application/javascript', body: 'postMessage("")' } 90 ); 91 92 return induceRequest(url) 93 .then(() => retrieve(key)) 94 .then((headers) => { 95 assert_not_own_property(headers, 'sec-fetch-storage-access'); 96 }); 97 }, 'sec-fetch-storage-access - Not sent to non-trustworthy same-origin destination, no options'); 98 </script> 99 </html>