tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

partitioned-cookies-a-b-a-embed.tentative.https.html (1813B)


      1 <!doctype html>
      2 <head>
      3 <meta charset="utf-8"/>
      4 <meta name="timeout" content="long">
      5 <meta name="help" href="https://github.com/WICG/CHIPS#chips-cookies-having-independent-partitioned-state">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="/common/get-host-info.sub.js"></script>
      9 <script src="/cookies/resources/cookie-helper.sub.js"></script>
     10 <script src="/cookies/partitioned-cookies/resources/test-helpers.js"></script>
     11 <title>Test partitioned cookies consider ancestor chain</title>
     12 </head>
     13 <body>
     14 <script>
     15  // This test is sets up an A1->B->A2 frame tree, where the top-level site is embedded
     16  // in a cross-site embed. If the partitionKey of the cookie has a cross-site ancestor bit,
     17  // the cookie set on site A1 will not be accessible on site A2.
     18  promise_test(async() => {
     19    assert_equals(document.cookie, "");
     20 
     21    const partitionedCookie = "ancestor=chain";
     22    const partitionedCookieAttributes =
     23        "; Secure; Path=/; SameSite=None; Partitioned";
     24    const partitionedCookieLine =
     25        partitionedCookie + partitionedCookieAttributes;
     26    document.cookie = partitionedCookieLine;
     27 
     28    assert_true(document.cookie.includes(partitionedCookie));
     29 
     30    const iframe = document.createElement("iframe");
     31    const url = new URL(
     32      "/cookies/partitioned-cookies/resources/" +
     33          "ancestor-chain-cross-site-embed.html",
     34          get_host_info().HTTPS_NOTSAMESITE_ORIGIN + self.location.pathname);
     35 
     36    iframe.src = url.href;
     37    document.body.appendChild(iframe);
     38 
     39    await fetch_tests_from_window(iframe.contentWindow);
     40    erase_cookie_from_js("ancestor", "Secure; Path=/; SameSite=None; Partitioned");
     41  }, "Setting Partitioned cookie on top-level site and embedding a cross-site iframe");
     42 
     43 </script>
     44 </body>