tor-browser

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

third-party-cookies-cross-site-popup-verify.html (1335B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <meta name="timeout" content="long">
      4 <title>Verifies heuristics enabled by popup</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/common/get-host-info.sub.js"></script>
      7 <script src="/cookies/resources/cookie-helper.sub.js"></script>
      8 <script src="/cookies/third-party-cookies/resources/test-helpers.js"></script>
      9 
     10 <body>
     11  <script>
     12 
     13    // Test that parent window passed its parameters in the URL correctly.
     14    test(() => {
     15      assert_true(window.location.search.includes("?desc="));
     16      assert_true(window.location.search.includes("&origin="));
     17 
     18      desc = decodeURIComponent(window.location.search.slice(
     19        window.location.search.indexOf("?desc=") + 6,
     20        window.location.search.indexOf("&origin=")));
     21      origin = decodeURIComponent(window.location.search.slice(
     22        window.location.search.indexOf("&origin=") + 8));
     23    }, "Cross-site verify opened correctly");
     24 
     25    // Cookies set by the parent window in a 1P context.
     26    const cookieNames = ["1P_http", "1P_dom"];
     27    if (window.cookieStore) {
     28      cookieNames.push("1P_cs");
     29    }
     30 
     31    // Third-party cookies are allowed after the popup heuristic grant.
     32    assertThirdPartyHttpCookies({
     33      desc,
     34      origin,
     35      cookieNames,
     36      expectsCookie: true,
     37    });
     38 
     39  </script>
     40 </body>