Chromium Code Reviews| 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 var scope = 'resources/simple.html?headers'; | |
| 11 service_worker_unregister_and_register(t, worker, scope) | |
| 12 .then(function(reg) { | |
| 13 return wait_for_state(t, reg.installing, 'activated'); | |
| 14 }) | |
| 15 .then(function() { return with_iframe(scope); }) | |
| 16 .then(function(frame) { | |
| 17 // We have this test to prevent unexpected exposure of headers to a | |
| 18 // ServiceWorker. Feel free to rebaseline this expectation if it | |
| 19 // looks good. | |
| 20 var headers = JSON.parse(frame.contentDocument.body.textContent); | |
| 21 var header_names = []; | |
| 22 for (var i in headers) { | |
|
yhirano
2016/07/19 07:28:40
Can we use the destructuring syntax?
for (const [
tyoshino (SeeGerritForStatus)
2016/07/19 08:50:31
Done.
| |
| 23 header_names.push(headers[i][0]); | |
| 24 } | |
| 25 header_names.sort(); | |
| 26 assert_array_equals( | |
| 27 header_names, | |
| 28 ["accept", "upgrade-insecure-requests", "user-agent"], | |
|
Mike West
2016/07/19 07:22:13
This is a navigational request, right? If so, LGTM
tyoshino (SeeGerritForStatus)
2016/07/19 07:26:08
Right. It's listing what the request for loading t
| |
| 29 'event.request has the expected headers.'); | |
| 30 | |
| 31 frame.remove(); | |
| 32 return service_worker_unregister_and_done(t, scope); | |
| 33 }) | |
| 34 .catch(unreached_rejection(t)); | |
| 35 }, 'Service Worker headers in the request of a fetch event'); | |
| 36 | |
| 37 async_test(function(t) { | |
| 10 var scope = 'resources/simple.html?string'; | 38 var scope = 'resources/simple.html?string'; |
| 11 service_worker_unregister_and_register(t, worker, scope) | 39 service_worker_unregister_and_register(t, worker, scope) |
| 12 .then(function(reg) { | 40 .then(function(reg) { |
| 13 return wait_for_state(t, reg.installing, 'activated'); | 41 return wait_for_state(t, reg.installing, 'activated'); |
| 14 }) | 42 }) |
| 15 .then(function() { return with_iframe(scope); }) | 43 .then(function() { return with_iframe(scope); }) |
| 16 .then(function(frame) { | 44 .then(function(frame) { |
| 17 assert_equals( | 45 assert_equals( |
| 18 frame.contentDocument.body.textContent, | 46 frame.contentDocument.body.textContent, |
| 19 'Test string', | 47 'Test string', |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 'event.respondWith must set the used flag.'); | 276 'event.respondWith must set the used flag.'); |
| 249 first_frame.remove(); | 277 first_frame.remove(); |
| 250 frame.remove(); | 278 frame.remove(); |
| 251 return service_worker_unregister_and_done(t, scope); | 279 return service_worker_unregister_and_done(t, scope); |
| 252 }) | 280 }) |
| 253 .catch(unreached_rejection(t)); | 281 .catch(unreached_rejection(t)); |
| 254 }, 'Service Worker event.respondWith must set the used flag'); | 282 }, 'Service Worker event.respondWith must set the used flag'); |
| 255 | 283 |
| 256 </script> | 284 </script> |
| 257 </body> | 285 </body> |
| OLD | NEW |