background-sync.https.html (1140B)
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 src="/speculation-rules/prerender/resources/deferred-promise-utils.js"></script> 6 <script> 7 8 // The main test page (restriction-background-sync.https.html) 9 // loads the initiator page, then the initiator page will prerender itself 10 // with the `prerendering` parameter. 11 const params = new URLSearchParams(location.search); 12 const isPrerendering = params.has('prerendering'); 13 14 if (!isPrerendering) { 15 const rule_extras = {'target_hint': getTargetHint()}; 16 loadInitiatorPage(rule_extras); 17 } else { 18 async function loadPrerenderPage() { 19 const prerenderEventCollector = new PrerenderEventCollector(); 20 const scope = `resources/`; 21 const registration = await navigator.serviceWorker.getRegistration(scope); 22 const register_promise = registration.periodicSync.register( 23 'periodic', { minInterval: 1000 }); 24 prerenderEventCollector.start(register_promise, 'periodicSync.register'); 25 } 26 loadPrerenderPage(); 27 } 28 29 </script>