<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="../../resources/cookie-utilities.js"></script>
</head>
<body>
<script>
window.jsTestIsAsync = true;

description("Tests that Same-Site cookies for 127.0.0.1 are not sent with a request initiated from an iframe- and processed by a service worker- with a different origin.");

async function checkResult()
{
    setBaseURLWhenFetchingCookies("http://127.0.0.1:8000");

    debug("Cookies sent with HTTP request:");
    await shouldNotHaveCookie("strict");
    await shouldHaveCookieWithValue("implicit-strict", "10"); // Behaves like a non-SameSite cookie
    await shouldHaveCookieWithValue("strict-because-invalid-SameSite-value", "10"); // Behaves like a non-SameSite cookie
    await shouldNotHaveCookie("lax");

    debug("<br>Cookies visible in DOM:");
    shouldNotHaveDOMCookie("strict");
    shouldNotHaveDOMCookie("implicit-strict");
    shouldNotHaveDOMCookie("strict-because-invalid-SameSite-value");
    shouldNotHaveDOMCookie("lax");

    await resetCookies();
    finishJSTest();
}

checkResult();
</script>
</body>
</html>
