OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Service Worker: Registration update() served from cache</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 promise_test(function(t) { |
| 8 var scope = 'resources/scope/update-served-from-cache'; |
| 9 var worker_url = 'resources/update-served-from-cache-worker.php'; |
| 10 var registration; |
| 11 |
| 12 return service_worker_unregister_and_register(t, worker_url, scope) |
| 13 .then(function(r) { |
| 14 // The script resource for this register() having a non-zero max-age |
| 15 // value was cached. |
| 16 registration = r; |
| 17 return wait_for_state(t, registration.installing, 'activated'); |
| 18 }) |
| 19 .then(function() { |
| 20 // update() should consult the cache. The returned promise should |
| 21 // resolve when the script is retrieved from the cache. |
| 22 return registration.update(); |
| 23 }) |
| 24 .then(function() { |
| 25 // installing should be null as update() does not trigger install. |
| 26 assert_equals( |
| 27 registration.installing, |
| 28 null, |
| 29 'installing should be null as the script was served from cache.'); |
| 30 return service_worker_unregister_and_done(t, scope); |
| 31 }); |
| 32 }, 'Update a registration served from cache.'); |
| 33 </script> |
OLD | NEW |