| 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.js"></script> | 4 <script src="resources/test-helpers.js"></script> |
| 5 <body> | 5 <body> |
| 6 <script> | 6 <script> |
| 7 var worker = 'resources/fetch-event-test-worker.js'; | 7 var worker = 'resources/fetch-event-test-worker.js'; |
| 8 | 8 |
| 9 async_test(function(t) { | 9 async_test(function(t) { |
| 10 const scope = 'resources/simple.html?headers'; | 10 const scope = 'resources/simple.html?headers'; |
| 11 service_worker_unregister_and_register(t, worker, scope) | 11 service_worker_unregister_and_register(t, worker, scope) |
| 12 .then(function(reg) { | 12 .then(function(reg) { |
| 13 return wait_for_state(t, reg.installing, 'activated'); | 13 return wait_for_state(t, reg.installing, 'activated'); |
| 14 }) | 14 }) |
| 15 .then(function() { return with_iframe(scope); }) | 15 .then(function() { return with_iframe(scope); }) |
| 16 .then(function(frame) { | 16 .then(function(frame) { |
| 17 // We have this test to prevent unexpected exposure of headers to a | 17 // We have this test to prevent unexpected exposure of headers to a |
| 18 // ServiceWorker. Feel free to rebaseline this expectation if it | 18 // ServiceWorker. Feel free to rebaseline this expectation if it |
| 19 // looks good. | 19 // looks good. |
| 20 const headers = JSON.parse(frame.contentDocument.body.textContent); | 20 const headers = JSON.parse(frame.contentDocument.body.textContent); |
| 21 const header_names = []; | 21 const header_names = []; |
| 22 for (const [name, value] of headers) { | 22 for (const [name, value] of headers) { |
| 23 header_names.push(name); | 23 header_names.push(name); |
| 24 } | 24 } |
| 25 header_names.sort(); | 25 header_names.sort(); |
| 26 assert_array_equals( | 26 assert_array_equals( |
| 27 header_names, | 27 header_names, |
| 28 ["accept", "upgrade-insecure-requests", "user-agent"], | 28 ["accept", "upgrade-insecure-requests"], |
| 29 'event.request has the expected headers.'); | 29 'event.request has the expected headers.'); |
| 30 | 30 |
| 31 frame.remove(); | 31 frame.remove(); |
| 32 return service_worker_unregister_and_done(t, scope); | 32 return service_worker_unregister_and_done(t, scope); |
| 33 }) | 33 }) |
| 34 .catch(unreached_rejection(t)); | 34 .catch(unreached_rejection(t)); |
| 35 }, 'Service Worker headers in the request of a fetch event'); | 35 }, 'Service Worker headers in the request of a fetch event'); |
| 36 | 36 |
| 37 async_test(function(t) { | 37 async_test(function(t) { |
| 38 var scope = 'resources/simple.html?string'; | 38 var scope = 'resources/simple.html?string'; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 'event.respondWith must set the used flag.'); | 276 'event.respondWith must set the used flag.'); |
| 277 first_frame.remove(); | 277 first_frame.remove(); |
| 278 frame.remove(); | 278 frame.remove(); |
| 279 return service_worker_unregister_and_done(t, scope); | 279 return service_worker_unregister_and_done(t, scope); |
| 280 }) | 280 }) |
| 281 .catch(unreached_rejection(t)); | 281 .catch(unreached_rejection(t)); |
| 282 }, 'Service Worker event.respondWith must set the used flag'); | 282 }, 'Service Worker event.respondWith must set the used flag'); |
| 283 | 283 |
| 284 </script> | 284 </script> |
| 285 </body> | 285 </body> |
| OLD | NEW |