fetch-topics-header-not-visible-in-service-worker.tentative.https.html (1396B)
1 <!doctype html> 2 <body> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> 6 <script> 7 promise_test(async t => { 8 let url = 'resources/fetch-topics-header-not-visible-in-service-worker-helper.tentative.https.html'; 9 10 let r = await service_worker_unregister_and_register(t, 11 'resources/intercept-request.js', url); 12 await wait_for_state(t, r.installing, 'activated'); 13 14 var popup_window = window.open("/common/blank.html"); 15 16 t.add_cleanup(async _=>{ 17 popup_window.close(); 18 await r.unregister(); 19 }); 20 21 // The current page isn't yet controlled by the service worker. Thus, 22 // execute the actual test in a new page and let it post its result back 23 // to this page. 24 test_helper_popup_page_result = new Promise((resolve, reject) => { 25 window.addEventListener('message', t.step_func((e) => { 26 assert_equals(e.data.testResult, 27 'Service worker intercepted no topics header'); 28 resolve(); 29 })); 30 }); 31 32 popup_window.location = url; 33 await test_helper_popup_page_result; 34 }, 'test that the topics header for fetch(<url>, {browsingTopics: true}) is not visible in a service worker context'); 35 </script> 36 </body>