Debian Codegraph @

testing/web-platform/tests/tools/third_party/websockets/experiments/authentication/cookie_iframe.js

raw
1 // receive token from the parent window, set cookie and notify parent
2 window.addEventListener("message", ({ origin, data }) => {
3 if (origin !== "http://localhost:8000") {
4 return;
5 }
6
7 document.cookie = `token=${data}; SameSite=Strict`;
8 window.parent.postMessage("", "http://localhost:8000");
9 });