summaryrefslogtreecommitdiffstats
path: root/dom/security/test/general/closeWindow.sjs
blob: 996db36f6feaa2d059a49ef9d74edae1377ebc5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const BODY = `
  <script>
  opener.postMessage("ok!", "*");
  close();
  </script>`;

function handleRequest(request, response) {
  // avoid confusing cache behaviors
  response.setHeader("Cache-Control", "no-cache", false);

  if (request.queryString.includes("unset")) {
    response.setHeader("Set-Cookie", "test=wow", true);
  }

  if (request.queryString.includes("none")) {
    response.setHeader("Set-Cookie", "test2=wow2; samesite=none", true);
  }

  if (request.queryString.includes("lax")) {
    response.setHeader("Set-Cookie", "test3=wow3; samesite=lax", true);
  }

  response.write(BODY);
}