tor-browser

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

third-party-cookie-heuristics.tentative.https.html (1870B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <meta name="timeout" content="long">
      4 <title>Test third-party cookie heuristics</title>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/common/get-host-info.sub.js"></script>
     10 <script src="/cookies/resources/cookie-helper.sub.js"></script>
     11 <script src="/cookies/third-party-cookies/resources/test-helpers.js"></script>
     12 
     13 <body>
     14  <script>
     15    document.body.onload = async () => {
     16      // Set SameSite=None cookie in a 1P context using HTTP.
     17      const attributes = "Secure;Path=/;SameSite=None";
     18      const httpCookieName = "1P_http";
     19      await credFetch(
     20        `${self.origin}/cookies/resources/set.py?${httpCookieName}=foobar;${attributes}`);
     21 
     22      // Set another cookie using document.cookie.
     23      const domCookieName = "1P_dom";
     24      document.cookie = `${domCookieName}=foobar;${attributes}`;
     25 
     26      const cookieNames = [httpCookieName, domCookieName];
     27 
     28      // Set another cookie using the CookieStore API, if supported.
     29      if (window.cookieStore) {
     30        const cookieStoreCookieName = "1P_cs";
     31        await cookieStore.set({
     32          name: cookieStoreCookieName,
     33          value: "foobar",
     34          path: "/",
     35          sameSite: "none",
     36        });
     37        cookieNames.push(cookieStoreCookieName);
     38      }
     39 
     40      // Open a cross-site window which will open a popup with the current origin.
     41      const crossSiteUrl = new URL(
     42        `./resources/third-party-cookies-cross-site-popup-opener.html?origin=${encodeURIComponent(self.origin)}`,
     43        get_host_info().HTTPS_NOTSAMESITE_ORIGIN + self.location.pathname);
     44      const popup = window.open(crossSiteUrl);
     45      fetch_tests_from_window(popup);
     46    };
     47 
     48  </script>
     49 </body>