OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <script src="resources/test-helpers.js"></script> | 4 <script src="resources/test-helpers.sub.js"></script> |
5 <script> | 5 <script> |
6 var script1 = normalizeURL('resources/empty-worker.js'); | 6 var script1 = normalizeURL('resources/empty-worker.js'); |
7 var script2 = normalizeURL('resources/empty-worker.js?new'); | 7 var script2 = normalizeURL('resources/empty-worker.js?new'); |
8 | 8 |
9 async_test(function(t) { | 9 async_test(function(t) { |
10 var scope = 'resources/scope/register-new-script-concurrently'; | 10 var scope = 'resources/scope/register-new-script-concurrently'; |
11 var register_promise1; | 11 var register_promise1; |
12 var register_promise2; | 12 var register_promise2; |
13 | 13 |
14 service_worker_unregister(t, scope) | 14 service_worker_unregister(t, scope) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 assert_equals(registration.waiting, null, | 77 assert_equals(registration.waiting, null, |
78 'on second register, waiting should be null'); | 78 'on second register, waiting should be null'); |
79 assert_equals(registration.active.scriptURL, script1, | 79 assert_equals(registration.active.scriptURL, script1, |
80 'on second register, the first script should be ' + | 80 'on second register, the first script should be ' + |
81 'active'); | 81 'active'); |
82 return wait_for_state(t, registration.installing, 'installed'); | 82 return wait_for_state(t, registration.installing, 'installed'); |
83 }) | 83 }) |
84 .then(function() { | 84 .then(function() { |
85 assert_equals(registration.installing, null, | 85 assert_equals(registration.installing, null, |
86 'on installed, installing should be null'); | 86 'on installed, installing should be null'); |
87 assert_equals(registration.waiting.scriptURL, script2, | 87 // Since the registration is not controlling any document, the new |
88 'on installed, the second script should be waiting'); | 88 // worker can immediately transition to active. |
89 assert_equals(registration.active.scriptURL, script1, | 89 if (registration.waiting) { |
90 'on installed, the first script should be active'); | 90 assert_equals(registration.waiting.scriptURL, script2, |
| 91 'on installed, the second script may still be waiting'
); |
| 92 assert_equals(registration.active.scriptURL, script1, |
| 93 'on installed, the first script may be active'); |
| 94 } else { |
| 95 assert_equals(registration.active.scriptURL, script2, |
| 96 'on installed, the second script may be active'); |
| 97 } |
91 return registration.unregister(); | 98 return registration.unregister(); |
92 }) | 99 }) |
93 .then(function() { | 100 .then(function() { |
94 t.done(); | 101 t.done(); |
95 }) | 102 }) |
96 .catch(unreached_rejection(t)); | 103 .catch(unreached_rejection(t)); |
97 }, 'Register then register new script URL'); | 104 }, 'Register then register new script URL'); |
98 | 105 |
99 async_test(function(t) { | 106 async_test(function(t) { |
100 var scope = 'resources/scope/register-then-register-new-script-404'; | 107 var scope = 'resources/scope/register-then-register-new-script-404'; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 frame.remove(); | 231 frame.remove(); |
225 return registration.unregister(); | 232 return registration.unregister(); |
226 }) | 233 }) |
227 .then(function() { | 234 .then(function() { |
228 t.done(); | 235 t.done(); |
229 }) | 236 }) |
230 .catch(unreached_rejection(t)); | 237 .catch(unreached_rejection(t)); |
231 }, 'Register same-scope new script url effect on controller'); | 238 }, 'Register same-scope new script url effect on controller'); |
232 | 239 |
233 </script> | 240 </script> |
OLD | NEW |