| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 <title>service worker: activation</title> | 3 <title>service worker: activation</title> |
| 4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.js"></script> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 // Registers, waits for activation, then unregisters on a dummy scope. | 9 // Registers, waits for activation, then unregisters on a dummy scope. |
| 10 // | 10 // |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return with_iframe(scope); | 45 return with_iframe(scope); |
| 46 }) | 46 }) |
| 47 .then(f => { | 47 .then(f => { |
| 48 iframe = f; | 48 iframe = f; |
| 49 | 49 |
| 50 // Create an active worker. | 50 // Create an active worker. |
| 51 return navigator.serviceWorker.register(worker_url, { scope: scope }); | 51 return navigator.serviceWorker.register(worker_url, { scope: scope }); |
| 52 }) | 52 }) |
| 53 .then(r => { | 53 .then(r => { |
| 54 registration = r; | 54 registration = r; |
| 55 add_result_callback(() => registration.unregister); | 55 add_result_callback(() => registration.unregister()); |
| 56 | 56 |
| 57 return wait_for_state(t, r.installing, 'activated'); | 57 return wait_for_state(t, r.installing, 'activated'); |
| 58 }) | 58 }) |
| 59 .then(() => { | 59 .then(() => { |
| 60 // Check that the frame was claimed. | 60 // Check that the frame was claimed. |
| 61 assert_not_equals( | 61 assert_not_equals( |
| 62 iframe.contentWindow.navigator.serviceWorker.controller, null); | 62 iframe.contentWindow.navigator.serviceWorker.controller, null); |
| 63 | 63 |
| 64 // Create an in-flight request. | 64 // Create an in-flight request. |
| 65 registration.active.postMessage('wait'); | 65 registration.active.postMessage('wait'); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 new_worker = registration.waiting; | 156 new_worker = registration.waiting; |
| 157 var reached_active = wait_for_state(t, new_worker, 'activating'); | 157 var reached_active = wait_for_state(t, new_worker, 'activating'); |
| 158 registration.active.postMessage('go'); | 158 registration.active.postMessage('go'); |
| 159 return reached_active; | 159 return reached_active; |
| 160 }) | 160 }) |
| 161 .then(() => { | 161 .then(() => { |
| 162 assert_equals(registration.active, new_worker); | 162 assert_equals(registration.active, new_worker); |
| 163 }); | 163 }); |
| 164 }, 'skipWaiting bypasses no controllee requirement'); | 164 }, 'skipWaiting bypasses no controllee requirement'); |
| 165 </script> | 165 </script> |
| OLD | NEW |