fetch-intercepted-by-service-worker.html (585B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/speculation-rules/prerender/resources/utils.js"></script> 5 <script> 6 7 const params = new URLSearchParams(location.search); 8 const uid = params.get('uid'); 9 10 async function startFetch() { 11 assert_true(document.prerendering); 12 13 const response = await fetch('cache.txt?should-intercept'); 14 const body = await response.text(); 15 16 const bc = new PrerenderChannel('prerender-channel', uid); 17 bc.postMessage(body); 18 bc.close(); 19 } 20 21 startFetch(); 22 </script>