| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>Service Worker: Unregistration on detached iframe context</title> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../../resources/testharness-helpers.js"></script> |
| 7 <script src="../resources/test-helpers.js"></script> |
| 8 <script> |
| 9 promise_test(function(t) { |
| 10 var url = './resources/blank.html'; |
| 11 var scope_for_iframe = './unregister-on-detached-iframe' |
| 12 var scope_for_main = './resources/' + scope_for_iframe; |
| 13 var script = './resources/empty-worker.js'; |
| 14 var frame; |
| 15 |
| 16 return service_worker_unregister(t, scope_for_main) |
| 17 .then(function() { |
| 18 return with_iframe(url); |
| 19 }) |
| 20 .then(function(f) { |
| 21 frame = f; |
| 22 return navigator.serviceWorker.register(script, |
| 23 {scope: scope_for_main}); |
| 24 }) |
| 25 .then(function(r) { |
| 26 add_completion_callback(function() { r.unregister(); } ); |
| 27 return frame.contentWindow.navigator.serviceWorker.getRegistration( |
| 28 scope_for_iframe); |
| 29 }) |
| 30 .then(function(r) { |
| 31 frame.remove(); |
| 32 return promise_rejects(t, 'InvalidStateError', r.unregister()); |
| 33 }); |
| 34 }, 'Unregistration on a detached iframe should fail and throw ' + |
| 35 'InvalidStateError exception'); |
| 36 </script> |
| OLD | NEW |