summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html
blob: f7e1a767b46c435e61d43609e39c0f1fd4a99bae (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
<html>
<body>
<script src="/common/get-host-info.sub.js"></script>
<script>

// This test checks if browser attaches the device-memory client hint in the
// HTTP request headers --- while requesting it from 3P context after
// settings feature policy to allow it; with Accept-CH coming from a sticky
// source.

// echo-client-hints-received.py sets the response headers depending on the set
// of client hints it receives in the request headers.

fetch(get_host_info()["HTTPS_REMOTE_ORIGIN"] + "/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py").then(r => {
  if(r.status == 200 && r.headers.has("device-memory-received") && r.headers.has("device-memory-deprecated-received")) {
    window.top.opener.postMessage('PASS', '*');
  }
  else {
    window.top.opener.postMessage('FAIL', '*');
  }
});

</script>
</body>
</html>