| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>ServiceWorker: navigator.serviceWorker.active</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="resources/test-helpers.js"></script> | |
| 6 <body> | |
| 7 <script> | |
| 8 // "active" is set | |
| 9 async_test(function(t) { | |
| 10 var step = t.step_func.bind(t); | |
| 11 var url = 'resources/empty-worker.js'; | |
| 12 var scope = 'resources/blank.html'; | |
| 13 var frame; | |
| 14 var registration; | |
| 15 | |
| 16 service_worker_unregister(t, scope) | |
| 17 .then(step(function() { return with_iframe(scope); })) | |
| 18 .then(step(function(f) { | |
| 19 frame = f; | |
| 20 return navigator.serviceWorker.register(url, {scope: scope}); | |
| 21 })) | |
| 22 .then(step(function(r) { | |
| 23 registration = r; | |
| 24 return wait_for_state(t, r.installing, 'activating'); | |
| 25 })) | |
| 26 .then(step(function() { | |
| 27 var container = frame.contentWindow.navigator.serviceWorker; | |
| 28 assert_equals( | |
| 29 container.controller, | |
| 30 null, | |
| 31 'On activating state a document should not have a controller'); | |
| 32 assert_equals( | |
| 33 registration.active.scriptURL, | |
| 34 normalizeURL(url), | |
| 35 'On activating state a document should have an active worker '); | |
| 36 assert_equals( | |
| 37 registration.waiting, | |
| 38 null, | |
| 39 'On activating state a document should not have a waiting worker'); | |
| 40 assert_equals( | |
| 41 registration.installing, | |
| 42 null, | |
| 43 'On activating state a document should not have an installing ' + | |
| 44 'worker'); | |
| 45 | |
| 46 // FIXME: Add a test for a frame created after installation. | |
| 47 // Should the existing frame ("frame") block activation? | |
| 48 })) | |
| 49 .then(step(function() { | |
| 50 frame.remove(); | |
| 51 return service_worker_unregister_and_done(t, scope); | |
| 52 })) | |
| 53 .catch(unreached_rejection(t)); | |
| 54 }, 'active is set'); | |
| 55 </script> | |
| OLD | NEW |