reload-service-worker-fetch-event.html (1152B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/get-host-info.sub.js"></script> 5 <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> 6 7 <!-- Keep an eye on https://github.com/whatwg/fetch/issues/1280 --> 8 9 <script> 10 const worker = "resources/fetch-event-test-worker.js"; 11 12 promise_test(async t => { 13 const scope = "resources/service-worker-page.html?reload-service-worker-fetch-event"; 14 15 const reg = await service_worker_unregister_and_register(t, worker, scope); 16 17 await wait_for_state(t, reg.installing, "activated"); 18 const frame = await with_iframe(scope); 19 assert_equals(frame.contentDocument.body.textContent, "method = GET, isReloadNavigation = false"); 20 21 frame.contentWindow.navigation.reload(); 22 await new Promise(resolve => frame.addEventListener("load", resolve, { once: true })); 23 assert_equals(frame.contentDocument.body.textContent, "method = GET, isReloadNavigation = true"); 24 25 frame.remove(); 26 await reg.unregister(); 27 }, "reload() appears as a reload to service worker fetch event handlers"); 28 </script>