OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- This test requires browser to treat all registrations are older than 24 hou
rs. |
| 3 Preference 'dom.serviceWorkers.testUpdateOverOneDay' should be enabled duri
ng |
| 4 the execution of the test --> |
| 5 <title>Service Worker: Functional events should trigger update if last update ti
me is over 24 hours</title> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="resources/test-helpers.sub.js"></script> |
| 9 <script> |
| 10 |
| 11 promise_test(function(t) { |
| 12 var script = 'resources/update-nocookie-worker.py'; |
| 13 var scope = 'resources/update/update-after-oneday.https.html'; |
| 14 var expected_url = normalizeURL(script); |
| 15 var registration; |
| 16 var frame; |
| 17 |
| 18 return service_worker_unregister_and_register(t, expected_url, scope) |
| 19 .then(function(r) { |
| 20 registration = r; |
| 21 return wait_for_state(t, registration.installing, 'activated'); |
| 22 }) |
| 23 .then(function() { return with_iframe(scope); }) |
| 24 .then(function(f) { |
| 25 frame = f; |
| 26 return wait_for_update(t, registration); |
| 27 }) |
| 28 .then(function() { |
| 29 assert_equals(registration.installing.scriptURL, expected_url, |
| 30 'new installing should be set after update resolves.'); |
| 31 assert_equals(registration.waiting, null, |
| 32 'waiting should still be null after update resolves.'); |
| 33 assert_equals(registration.active.scriptURL, expected_url, |
| 34 'active should still exist after update found.'); |
| 35 return wait_for_state(t, registration.installing, 'installed'); |
| 36 }) |
| 37 .then(function() { |
| 38 // Trigger a non-navigation fetch event |
| 39 frame.contentWindow.load_image(normalizeURL('resources/update/dummy'))
; |
| 40 return wait_for_update(t, registration); |
| 41 }) |
| 42 .then(function() { |
| 43 frame.remove(); |
| 44 return service_worker_unregister_and_done(t, scope); |
| 45 }) |
| 46 }, 'Update should be triggered after a functional event when last update time
is over 24 hours'); |
| 47 |
| 48 </script> |
| 49 |
| 50 |
OLD | NEW |