summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/redirects.html
blob: ba69907a5f6e46a3e8a79041da17039d14d20feb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing: resources fetched through same-origin redirects</title>
<link rel="author" title="Google" href="http://www.google.com/" />
<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming"/>
<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>