OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: force-refresh registration test</title> | 2 <title>Service Worker: force-refresh registration test</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="../resources/test-helpers.js"></script> | 5 <script src="../resources/test-helpers.js"></script> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 async_test(function(t) { | 9 async_test(function(t) { |
10 var scope = base_path() + '../resources/force-refresh-register'; | 10 var scope = base_path() + '../resources/force-refresh-register'; |
11 with_iframe('../resources/blank.html') | 11 with_iframe('../resources/blank.html') |
12 .then(t.step_func(function(frame) { | 12 .then(t.step_func(function(frame) { |
13 var p = new Promise(function(resolve) { | 13 var p = new Promise(function(resolve) { |
14 // Override onload handler assigned by with_iframe. | 14 // Override onload handler assigned by with_iframe. |
15 frame.onload = t.step_func(function() { | 15 frame.onload = t.step_func(function() { |
16 resolve(frame.contentWindow.navigator.serviceWorker.register( | 16 resolve(frame.contentWindow.navigator.serviceWorker.register( |
17 'empty-worker.js', | 17 '../resources/empty-worker.js', |
18 {scope: scope})); | 18 {scope: scope})); |
19 }); | 19 }); |
20 }); | 20 }); |
21 frame.contentWindow.internals.forceReload(true); | 21 frame.contentWindow.internals.forceReload(true); |
22 return p; | 22 return p; |
23 })) | 23 })) |
24 .then(t.step_func(function() { | 24 .then(t.step_func(function() { |
25 service_worker_unregister_and_done(t, scope); | 25 service_worker_unregister_and_done(t, scope); |
26 })) | 26 })) |
27 .catch(unreached_rejection(t)); | 27 .catch(unreached_rejection(t)); |
28 }, 'Registering script from force-refreshed frame'); | 28 }, 'Registering script from force-refreshed frame'); |
29 | 29 |
30 </script> | 30 </script> |
OLD | NEW |