summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/loading/early-hints/resources/redirect-same-origin-between-early-hints.html
blob: 395f7f1752500c4e4ac15f5ff8e62f9a1eae1b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="early-hints-helpers.sub.js"></script>
<body>
<script>
promise_test(async (t) => {
    const params = new URLSearchParams(window.location.search);

    const preload_before_redirect = params.get("preload-before-redirect");
    await fetchScript(preload_before_redirect);
    assert_true(isPreloadedByEarlyHints(preload_before_redirect),
        "Early hints before redirect should preload.");

    const preload_after_redirect = params.get("preload-after-redirect");
    await fetchScript(preload_after_redirect);
    assert_false(isPreloadedByEarlyHints(preload_after_redirect),
        "Early hints after same origin redirect should be ignored.");
}, "Early hints -> same origin redirect -> early hints -> final response.");
</script>
</body>