| 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.sub.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'; |
| (...skipping 66 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 // Since the registration is not controlling any document, the new | 87 assert_equals(registration.waiting.scriptURL, script2, |
| 88 // worker can immediately transition to active. | 88 'on installed, the second script should be waiting'); |
| 89 if (registration.waiting) { | 89 assert_equals(registration.active.scriptURL, script1, |
| 90 assert_equals(registration.waiting.scriptURL, script2, | 90 'on installed, the first script should be active'); |
| 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 } | |
| 98 return registration.unregister(); | 91 return registration.unregister(); |
| 99 }) | 92 }) |
| 100 .then(function() { | 93 .then(function() { |
| 101 t.done(); | 94 t.done(); |
| 102 }) | 95 }) |
| 103 .catch(unreached_rejection(t)); | 96 .catch(unreached_rejection(t)); |
| 104 }, 'Register then register new script URL'); | 97 }, 'Register then register new script URL'); |
| 105 | 98 |
| 106 async_test(function(t) { | 99 async_test(function(t) { |
| 107 var scope = 'resources/scope/register-then-register-new-script-404'; | 100 var scope = 'resources/scope/register-then-register-new-script-404'; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 frame.remove(); | 224 frame.remove(); |
| 232 return registration.unregister(); | 225 return registration.unregister(); |
| 233 }) | 226 }) |
| 234 .then(function() { | 227 .then(function() { |
| 235 t.done(); | 228 t.done(); |
| 236 }) | 229 }) |
| 237 .catch(unreached_rejection(t)); | 230 .catch(unreached_rejection(t)); |
| 238 }, 'Register same-scope new script url effect on controller'); | 231 }, 'Register same-scope new script url effect on controller'); |
| 239 | 232 |
| 240 </script> | 233 </script> |
| OLD | NEW |