summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/websockets/experiments/authentication/cookie_iframe.js
blob: 2d2e692e8d252a1d296b1f3f862f69bdf340b863 (plain)
1
2
3
4
5
6
7
8
9
// receive token from the parent window, set cookie and notify parent
window.addEventListener("message", ({ origin, data }) => {
    if (origin !== "http://localhost:8000") {
        return;
    }

    document.cookie = `token=${data}; SameSite=Strict`;
    window.parent.postMessage("", "http://localhost:8000");
});