connection-reuse.html (2292B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Resource Timing connection reuse</title> 6 <link rel="author" title="Google" href="http://www.google.com/" /> 7 <link rel="help" href="https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming"/> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/common/get-host-info.sub.js"></script> 11 <script src="resources/entry-invariants.js"></script> 12 <script src="resources/connection-reuse-test.js"></script> 13 <script> 14 const {HTTPS_ORIGIN} = get_host_info(); 15 16 // Fetches the given subresource a couple times with the same connection. 17 const http_path = "resources/fake_responses.py"; 18 connection_reuse_test(http_path, 19 { 20 'on_200': invariants.assert_tao_pass_no_redirect_http, 21 'on_304': invariants.assert_tao_pass_304_not_modified_http, 22 }, "Reuse HTTP connection"); 23 24 // Like above, but the subresource is fetched over HTTPS while this page is 25 // fetched over HTTP. 26 const https_url = `${HTTPS_ORIGIN}/resource-timing/${http_path}`; 27 connection_reuse_test(https_url, 28 { 29 'on_200': invariants.assert_tao_pass_no_redirect_https, 30 'on_304': invariants.assert_tao_pass_304_not_modified_https, 31 }, "Reuse HTTPS connection from HTTP page"); 32 33 // Like the above mixed-content test but the final resource is behind an HTTP 34 // redirect response. 35 const redirect_path = (() => { 36 // The resource behind the redirect is the same fake_responses.py handler 37 // on the HTTPS origin. Pass it through encodeURIComponent so that it can 38 // be passed through a query-parameter. 39 const redirect_url = encodeURIComponent(https_url) 40 // The request is made to the HTTPS origin with a query parameter that will 41 // cause a 302 response. 42 return `${https_url}?redirect=${redirect_url}`; 43 })(); 44 connection_reuse_test(redirect_path, 45 { 46 'on_200': invariants.assert_tao_enabled_cross_origin_redirected_resource, 47 'on_304': invariants.assert_tao_enabled_cross_origin_redirected_resource, 48 }, "Reuse HTTPS connection with redirects from an HTTP page"); 49 </script> 50 </head> 51 <body> 52 <h1>Description</h1> 53 <p>See <a href="resources/connection-reuse-test.js">the included test 54 script</a></p> 55 </body> 56 </html>