OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: the headers of FetchEvent shouldn't contain freshness hea
ders</title> | 2 <title>Service Worker: the headers of FetchEvent shouldn't contain freshness hea
ders</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?pipe=sub"></script> | 5 <script src="resources/test-helpers.js?pipe=sub"></script> |
6 <script> | 6 <script> |
7 async_test(function(t) { | 7 async_test(function(t) { |
8 var SCOPE = 'resources/fetch-request-no-freshness-headers-iframe.html'; | 8 var SCOPE = 'resources/fetch-request-no-freshness-headers-iframe.html'; |
9 var SCRIPT = 'resources/fetch-request-no-freshness-headers-worker.js'; | 9 var SCRIPT = 'resources/fetch-request-no-freshness-headers-worker.js'; |
10 var worker; | 10 var worker; |
11 service_worker_unregister_and_register(t, SCRIPT, SCOPE) | 11 service_worker_unregister_and_register(t, SCRIPT, SCOPE) |
12 .then(function(registration) { | 12 .then(function(registration) { |
13 return wait_for_update(t, registration); | 13 worker = registration.installing; |
14 }) | 14 return wait_for_state(t, worker, 'activated'); |
15 .then(function(sw) { | |
16 worker = sw; | |
17 return wait_for_state(t, sw, 'activated'); | |
18 }) | 15 }) |
19 .then(function() { return with_iframe(SCOPE); }) | 16 .then(function() { return with_iframe(SCOPE); }) |
20 .then(function(frame) { | 17 .then(function(frame) { |
21 return new Promise(function(resolve) { | 18 return new Promise(function(resolve) { |
22 frame.onload = function() { | 19 frame.onload = function() { |
23 resolve(frame); | 20 resolve(frame); |
24 }; | 21 }; |
25 frame.contentWindow.location.reload(); | 22 frame.contentWindow.location.reload(); |
26 }); | 23 }); |
27 }) | 24 }) |
(...skipping 19 matching lines...) Expand all Loading... |
47 !!freshness_headers[header[0]], | 44 !!freshness_headers[header[0]], |
48 header[0] + ' header must not be set in the ' + | 45 header[0] + ' header must not be set in the ' + |
49 'FetchEvent\'s request. (url = ' + request.url + ')'); | 46 'FetchEvent\'s request. (url = ' + request.url + ')'); |
50 })); | 47 })); |
51 })) | 48 })) |
52 service_worker_unregister_and_done(t, SCOPE); | 49 service_worker_unregister_and_done(t, SCOPE); |
53 }) | 50 }) |
54 .catch(unreached_rejection(t)); | 51 .catch(unreached_rejection(t)); |
55 }, 'The headers of FetchEvent shouldn\'t contain freshness headers.'); | 52 }, 'The headers of FetchEvent shouldn\'t contain freshness headers.'); |
56 </script> | 53 </script> |
OLD | NEW |