skip-waiting-without-using-registration.https.html (1685B)
1 <!DOCTYPE html> 2 <title>Service Worker: Skip waiting without using registration</title> 3 <meta name="timeout" content="long"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="resources/test-helpers.sub.js"></script> 7 <script> 8 'use strict'; 9 10 promise_test(function(t) { 11 var scope = 'resources/blank.html?skip-waiting-without-using-registration'; 12 var url = 'resources/skip-waiting-worker.js'; 13 var frame_sw, sw_registration; 14 15 return service_worker_unregister(t, scope) 16 .then(function() { 17 return with_iframe(scope); 18 }) 19 .then(function(f) { 20 t.add_cleanup(function() { 21 f.remove(); 22 }); 23 frame_sw = f.contentWindow.navigator.serviceWorker; 24 assert_equals(frame_sw.controller, null, 25 'Document controller should be null'); 26 return navigator.serviceWorker.register(url, {scope: scope}); 27 }) 28 .then(function(registration) { 29 sw_registration = registration; 30 t.add_cleanup(function() { 31 return registration.unregister(); 32 }); 33 return wait_for_state(t, registration.installing, 'activated'); 34 }) 35 .then(function() { 36 assert_equals(frame_sw.controller, null, 37 'Document controller should still be null'); 38 assert_not_equals(sw_registration.active, null, 39 'Registration active worker should not be null'); 40 return fetch_tests_from_worker(sw_registration.active); 41 }); 42 }, 'Test skipWaiting while a client is not being controlled'); 43 44 </script>