// Custom *.sjs file specifically for the needs of Bug 1711453 "use strict"; // small red image const IMG_BYTES = atob( "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12" + "P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" ); const IFRAME_INC = ``; // Sets an image sends cookie and location after loading const SET_COOKIE_IMG = `
`; // Load blank frame navigation sends cookie and location after loading const LOAD_BLANK_FRAME_NAV = ` `; // Load frame navigation sends cookie and location after loading const LOAD_FRAME_NAV = ` `; // blank frame sends cookie and location after loading const LOAD_BLANK_FRAME = ` `; // frame sends cookie and location after loading const LOAD_FRAME = ` `; const RESPONSE_UNEXPECTED = ` send message, error `; function setCookie(name, query) { let cookie = name + "="; if (query.includes("0")) { cookie += "0;Domain=.example.com;sameSite=none"; return cookie; } if (query.includes("1")) { cookie += "1;Domain=.example.com;sameSite=strict"; return cookie; } if (query.includes("2")) { cookie += "2;Domain=.example.com;sameSite=none;secure"; return cookie; } if (query.includes("3")) { cookie += "3;Domain=.example.com;sameSite=strict;secure"; return cookie; } return cookie + "error"; } function handleRequest(request, response) { // avoid confusing cache behaviors response.setHeader("Cache-Control", "no-cache", false); let query = request.queryString; if (query.includes("setImage")) { response.write(SET_COOKIE_IMG); return; } // using startsWith and discard the math random if (query.includes("setSameSiteCookie")) { response.setHeader("Set-Cookie", setCookie("setImage", query), true); response.setHeader("Content-Type", "image/png"); response.write(IMG_BYTES); return; } // navigation tests if (query.includes("loadNavBlank")) { response.setHeader("Set-Cookie", setCookie("loadNavBlank", query), true); response.write(LOAD_BLANK_FRAME_NAV); return; } if (request.queryString === "loadblankframeNav") { let FRAME = `