summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/referrer-policy/generic/iframe-upgrade-request-to-same-origin.sub.https.html
blob: f9163bec546c2ff1b440b1b27ee945c150caf67c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<link rel="author" title="Dominic Farolino" href="dom@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<iframe id="iframe"></iframe>
<script>
async_test(t => {
  const iframe = document.querySelector('iframe');
  const insecure_origin = new URL(location.href).origin.replace("https", "http");
  iframe.src = insecure_origin + '/referrer-policy/generic/resources/referrer.py';

  addEventListener('message', t.step_func_done(msg => {
    const referrer = msg.data;
    assert_equals(referrer, location.href,
      "The referrer header sent for the iframe request should not be redacted");
  }));
}, "If an insecure iframe request is upgraded to https to be same-origin, " +
   "referrer policies that consider same-origin-ness should be applied correctly");
</script>
</body>