summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-response-code.html
blob: c3a680bba841294f7204d22897cca5cfcc03d4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<head>
<script src="/common/utils.js"></script>
<script src="./utils.js"></script>
<script>
    const search = new URLSearchParams(location.search);
    const uid = search.get('uid');
    const uid1 = token();
    const uid2 = token();
    const bc = new BroadcastChannel(uid);

    window.onload = async () => {
        bc.addEventListener('message', ({data}) => {
            if (data === 'close')
                window.close();
            else if (data === 'activate')
                location.href = url;
        })

        startPrerendering(`/speculation-rules/prerender/resources/dual-exec.html?uid1=${uid1}&uid2=${uid2}`);
    };
</script>
</head>