OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
3 <title>Navigation Preload request headers</title> | 3 <title>Navigation Preload request headers</title> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="/resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="/resources/testharnessreport.js"></script> |
6 <script src="../resources/test-helpers.js"></script> | 6 <script src="../resources/test-helpers.sub.js"></script> |
7 <script> | 7 <script> |
8 promise_test(t => { | 8 promise_test(t => { |
9 var script = 'resources/request-headers-worker.js'; | 9 var script = 'resources/request-headers-worker.js'; |
10 var scope = 'resources/request-headers-scope.php'; | 10 var scope = 'resources/request-headers-scope.py'; |
11 return service_worker_unregister_and_register(t, script, scope) | 11 return service_worker_unregister_and_register(t, script, scope) |
12 .then(registration => { | 12 .then(registration => { |
13 add_completion_callback(_ => registration.unregister()); | 13 add_completion_callback(_ => registration.unregister()); |
14 var worker = registration.installing; | 14 var worker = registration.installing; |
15 return wait_for_state(t, worker, 'activated'); | 15 return wait_for_state(t, worker, 'activated'); |
16 }) | 16 }) |
17 .then(_ => with_iframe(scope)) | 17 .then(_ => with_iframe(scope)) |
18 .then(frame => { | 18 .then(frame => { |
19 var headers = JSON.parse(frame.contentDocument.body.textContent); | 19 var headers = JSON.parse(frame.contentDocument.body.textContent); |
20 assert_equals( | 20 assert_true( |
21 headers['HTTP_SERVICE_WORKER_NAVIGATION_PRELOAD'], | 21 'SERVICE-WORKER-NAVIGATION-PRELOAD' in headers, |
22 'hello', | 22 'The Navigation Preload request must specify exactly a ' + |
falken
2017/03/09 04:18:10
Should this description say "exactly one"? But the
mike3
2017/03/09 16:05:08
Yes, I went from "exactly one" to "exactly a", but
| |
23 '"Service-Worker-Navigation-Preload" header.'); | |
24 assert_array_equals( | |
25 headers['SERVICE-WORKER-NAVIGATION-PRELOAD'], | |
26 ['hello'], | |
23 'The header of Navigation Preload request must have correct ' + | 27 'The header of Navigation Preload request must have correct ' + |
24 '"Service-Worker-Navigation-Preload" header.'); | 28 '"Service-Worker-Navigation-Preload" header.'); |
25 assert_equals( | 29 assert_true( |
26 headers['HTTP_UPGRADE_INSECURE_REQUESTS'], | 30 'UPGRADE-INSECURE-REQUESTS' in headers, |
27 '1', | 31 'The Navigation Preload request must specify an ' + |
32 '"Upgrade-Insecure-Requests" header.'); | |
33 assert_array_equals( | |
34 headers['UPGRADE-INSECURE-REQUESTS'], | |
35 ['1'], | |
28 'The header of Navigation Preload request must have ' + | 36 'The header of Navigation Preload request must have ' + |
falken
2017/03/09 04:18:10
nit: This should probably say "correct" to match t
mike3
2017/03/09 16:05:08
Definitely. This message could use a little gramma
| |
29 '"Upgrade-Insecure-Requests" header.'); | 37 '"Upgrade-Insecure-Requests" header.'); |
30 }); | 38 }); |
31 }, 'Navigation Preload request headers.'); | 39 }, 'Navigation Preload request headers.'); |
32 | 40 |
33 </script> | 41 </script> |
OLD | NEW |