Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /resource-timing/redirects.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing: resources fetched through same-origin redirects</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/resource-loaders.js"></script>
<script src="resources/entry-invariants.js"></script>
<script>
const {HTTPS_NOTSAMESITE_ORIGIN} = get_host_info();
const redirect_url = `/common/redirect.py`;
const url_prefix = `${redirect_url}?location=/resource-timing/resources/`;
const https_url_prefix = `${redirect_url}?location=${HTTPS_NOTSAMESITE_ORIGIN}/resource-timing/resources/`;
attribute_test(
load.stylesheet, url_prefix + "resource_timing_test0.css",
invariants.assert_same_origin_redirected_resource,
"Verify attributes of a redirected stylesheet's PerformanceResourceTiming");
attribute_test(
load.image, url_prefix + "blue.png",
invariants.assert_same_origin_redirected_resource,
"Verify attributes of a redirected image's PerformanceResourceTiming");
attribute_test(
load.iframe, url_prefix + "green.html",
invariants.assert_same_origin_redirected_resource,
"Verify attributes of a redirected iframe's PerformanceResourceTiming");
attribute_test(
load.script, url_prefix + "empty_script.js",
invariants.assert_same_origin_redirected_resource,
"Verify attributes of a redirected script's PerformanceResourceTiming");
attribute_test(
load.xhr_sync, url_prefix + "green.html?id=xhr",
invariants.assert_same_origin_redirected_resource,
"Verify attributes of a redirected synchronous XMLHttpRequest's " +
"PerformanceResourceTiming");
attribute_test(
load.xhr_sync, https_url_prefix + "green.html?id=xhr",
invariants.assert_cross_origin_redirected_resource,
"Verify attributes of a synchronous XMLHttpRequest's " +
"PerformanceResourceTiming where the initial HTTP request is redirected " +
"to a cross-origin HTTPS resource."
);
</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates that, when a fetching resources that encounter
same-origin redirects, attributes of the PerformanceResourceTiming entry
conform to the specification.</p>
</body>
</html>