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