blob: e20f6cc58d09b28e355b860a49cb5b572bbbfd8c [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="../resources/cookie-utilities.js"></script>
<body>
<script>
window.jsTestIsAsync = true;
description("Tests that Same-Site DOM cookies for 127.0.0.1 are visible from about:blank iframe.");
async function runTest()
{
await resetCookies();
await setCookie("strict", "13", {"SameSite": "Strict", "Max-Age": 100, "path": "/"});
await setCookie("implicit-strict", "13", {"SameSite": null, "Max-Age": 100, "path": "/"});
await setCookie("strict-because-invalid-SameSite-value", "13", {"SameSite": "invalid", "Max-Age": 100, "path": "/"});
await setCookie("lax", "13", {"SameSite": "Lax", "Max-Age": 100, "path": "/"});
let appendIframeAndWaitUntilLoadedPromise = new Promise((resolved) => {
let iframe = document.createElement("iframe");
iframe.onload = (e) => resolved(iframe);
iframe.src = "about:blank";
document.body.appendChild(iframe);
});
let iframe = await appendIframeAndWaitUntilLoadedPromise;
setBaseDocumentWhenFetchingDOMCookies(iframe.contentDocument);
debug("Cookies visible in DOM:");
shouldHaveDOMCookieWithValue("strict", "13");
shouldHaveDOMCookieWithValue("implicit-strict", "13");
shouldHaveDOMCookieWithValue("strict-because-invalid-SameSite-value", "13");
shouldHaveDOMCookieWithValue("lax", "13");
await resetCookies();
finishJSTest();
}
runTest();
</script>
</body>
</html>