| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>ServiceWorkerGlobalScope: unregister</title> |
| 3 <script src='../../resources/testharness.js'></script> |
| 4 <script src='../../resources/testharnessreport.js'></script> |
| 5 <script src='../resources/test-helpers.js'></script> |
| 6 <script> |
| 7 |
| 8 promise_test(function(t) { |
| 9 var script = 'resources/unregister-on-script-evaluation-worker.js'; |
| 10 var scope = 'resources/scope/unregister-on-script-evaluation'; |
| 11 var worker; |
| 12 var state_transition = []; |
| 13 |
| 14 return service_worker_unregister_and_register(t, script, scope) |
| 15 .then(function(registration) { |
| 16 worker = registration.installing; |
| 17 return new Promise(t.step_func(function(resolve) { |
| 18 worker.addEventListener('statechange', function() { |
| 19 state_transition.push(worker.state); |
| 20 if (worker.state === 'redundant') |
| 21 resolve(worker.state); |
| 22 }); |
| 23 })) |
| 24 }) |
| 25 .then(function() { |
| 26 var expected_state_transition = [ |
| 27 'installed', 'activating', 'redundant' |
| 28 ]; |
| 29 assert_equals( |
| 30 expected_state_transition.toString(), |
| 31 state_transition.toString(), |
| 32 'unregister() should be processed after register() finished'); |
| 33 return service_worker_unregister_and_done(t, scope); |
| 34 }); |
| 35 }, 'Unregister on script evaluation'); |
| 36 |
| 37 </script> |
| OLD | NEW |