OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Service Worker: registration events</title> |
| 3 <script src="/resources/testharness.js"></script> |
| 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <script src="resources/test-helpers.sub.js"></script> |
| 6 <script> |
| 7 promise_test(function(t) { |
| 8 var script = 'resources/empty-worker.js'; |
| 9 var scope = 'resources/blank.html'; |
| 10 var registration; |
| 11 |
| 12 return service_worker_unregister_and_register(t, script, scope) |
| 13 .then(function(registration) { |
| 14 var sw = registration.installing; |
| 15 |
| 16 return new Promise(t.step_func(function(resolve) { |
| 17 sw.onstatechange = t.step_func(function() { |
| 18 if (sw.state === 'installed') { |
| 19 assert_equals(registration.active, null, |
| 20 'installed event should be fired before activating s
ervice worker'); |
| 21 resolve(); |
| 22 } |
| 23 }); |
| 24 })); |
| 25 }) |
| 26 .then(function() { |
| 27 return service_worker_unregister_and_done(t, scope); |
| 28 }) |
| 29 .catch(unreached_rejection(t)); |
| 30 }, 'installed event should be fired before activating service worker'); |
| 31 |
| 32 </script> |
OLD | NEW |