Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8" />
<title>Resource Timing connection reuse</title>
<link rel="author" title="Google" href="" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/entry-invariants.js"></script>
<script src="resources/connection-reuse-test.js"></script>
const {HTTPS_ORIGIN} = get_host_info();
// Fetches the given subresource a couple times with the same connection.
const http_path = "resources/";
'on_200': invariants.assert_tao_pass_no_redirect_http,
'on_304': invariants.assert_tao_pass_304_not_modified_http,
}, "Reuse HTTP connection");
// Like above, but the subresource is fetched over HTTPS while this page is
// fetched over HTTP.
const https_url = `${HTTPS_ORIGIN}/resource-timing/${http_path}`;
'on_200': invariants.assert_tao_pass_no_redirect_https,
'on_304': invariants.assert_tao_pass_304_not_modified_https,
}, "Reuse HTTPS connection from HTTP page");
// Like the above mixed-content test but the final resource is behind an HTTP
// redirect response.
const redirect_path = (() => {
// The resource behind the redirect is the same handler
// on the HTTPS origin. Pass it through encodeURIComponent so that it can
// be passed through a query-parameter.
const redirect_url = encodeURIComponent(https_url)
// The request is made to the HTTPS origin with a query parameter that will
// cause a 302 response.
return `${https_url}?redirect=${redirect_url}`;
'on_200': invariants.assert_tao_enabled_cross_origin_redirected_resource,
'on_304': invariants.assert_tao_enabled_cross_origin_redirected_resource,
}, "Reuse HTTPS connection with redirects from an HTTP page");
<p>See <a href="resources/connection-reuse-test.js">the included test