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