OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: claim client not using registration</title> | 2 <title>Service Worker: claim client not using registration</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharness-helpers.js"></script> | 4 <script src="../resources/testharness-helpers.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 <body> | 7 <body> |
8 <script> | 8 <script> |
9 | 9 |
10 promise_test(function(t) { | 10 promise_test(function(t) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 }) | 71 }) |
72 .then(function() { | 72 .then(function() { |
73 return service_worker_unregister_and_done(t, init_scope); | 73 return service_worker_unregister_and_done(t, init_scope); |
74 }); | 74 }); |
75 }, 'Test claim client which is not using registration'); | 75 }, 'Test claim client which is not using registration'); |
76 | 76 |
77 promise_test(function(t) { | 77 promise_test(function(t) { |
78 var scope = 'resources/blank.html?longer-matched'; | 78 var scope = 'resources/blank.html?longer-matched'; |
79 var claim_scope = 'resources/blank.html?longer'; | 79 var claim_scope = 'resources/blank.html?longer'; |
80 var claim_worker_url = 'resources/claim-worker.js'; | 80 var claim_worker_url = 'resources/claim-worker.js'; |
81 var installing_worker_url = 'resources/wait-forever-in-install-worker.js'; | 81 var installing_worker_url = 'resources/empty-worker.js'; |
82 var frame, claim_worker; | 82 var frame, claim_worker; |
83 return with_iframe(scope) | 83 return with_iframe(scope) |
84 .then(function(f) { | 84 .then(function(f) { |
85 frame = f; | 85 frame = f; |
86 return navigator.serviceWorker.register( | 86 return navigator.serviceWorker.register( |
87 claim_worker_url, {scope: claim_scope}); | 87 claim_worker_url, {scope: claim_scope}); |
88 }) | 88 }) |
89 .then(function(registration) { | 89 .then(function(registration) { |
90 claim_worker = registration.installing; | 90 claim_worker = registration.installing; |
91 return wait_for_state(t, registration.installing, 'activated'); | 91 return wait_for_state(t, registration.installing, 'activated'); |
(...skipping 13 matching lines...) Expand all Loading... |
105 }); | 105 }); |
106 claim_worker.postMessage({port: channel.port2}, [channel.port2]); | 106 claim_worker.postMessage({port: channel.port2}, [channel.port2]); |
107 return saw_message; | 107 return saw_message; |
108 }) | 108 }) |
109 .then(function() { | 109 .then(function() { |
110 assert_equals( | 110 assert_equals( |
111 frame.contentWindow.navigator.serviceWorker.controller, null, | 111 frame.contentWindow.navigator.serviceWorker.controller, null, |
112 'Frame should not be claimed when a longer-matched ' + | 112 'Frame should not be claimed when a longer-matched ' + |
113 'registration exists'); | 113 'registration exists'); |
114 frame.remove(); | 114 frame.remove(); |
115 return service_worker_unregister_and_done(t, claim_scope); | 115 return service_worker_unregister(t, claim_scope); |
| 116 }) |
| 117 .then(function() { |
| 118 return service_worker_unregister_and_done(t, scope); |
116 }); | 119 }); |
117 }, 'Test claim client when there\'s a longer-matched registration not ' + | 120 }, 'Test claim client when there\'s a longer-matched registration not ' + |
118 'already used by the page'); | 121 'already used by the page'); |
119 | 122 |
120 </script> | 123 </script> |
OLD | NEW |