add-routes.https.html (1051B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Service Worker: addRoutes() executes in installing</title> 4 <script src="/common/get-host-info.sub.js"></script> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="resources/test-helpers.sub.js"></script> 8 <script src="resources/static-router-helpers.sub.js"></script> 9 <script> 10 11 promise_test(async t => { 12 const script = 'resources/add-routes.js'; 13 const scope = 'resources/blank.html'; 14 const reg = await service_worker_unregister_and_register(t, script, scope); 15 t.add_cleanup(() => reg.unregister()); 16 await wait_for_state(t, reg.installing, 'activated'); 17 const sw = reg.active; 18 const addRoutesError = await get_info_from_worker(sw); 19 20 assert_equals(addRoutesError.install, null, 21 'addRoutes() should execute successfully in installing'); 22 assert_true(addRoutesError.activate instanceof Error, 23 'addRoutes() should throw outside of installing'); 24 25 }, 'addRoutes() will not be executed outside of installing'); 26 27 </script>