tor-browser

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

browser_storage_cookies_samesite.js (1368B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 // Test that the samesite cookie attribute is displayed correctly.
      8 
      9 add_task(async function () {
     10  await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies-samesite.html");
     11 
     12  const id1 = getCookieId(
     13    "test1",
     14    "test1.example.org",
     15    "/browser/devtools/client/storage/test"
     16  );
     17  const id2 = getCookieId(
     18    "test2",
     19    "test1.example.org",
     20    "/browser/devtools/client/storage/test"
     21  );
     22  const id3 = getCookieId(
     23    "test3",
     24    "test1.example.org",
     25    "/browser/devtools/client/storage/test"
     26  );
     27  const id4 = getCookieId(
     28    "test4",
     29    "test1.example.org",
     30    "/browser/devtools/client/storage/test"
     31  );
     32 
     33  await checkState([
     34    [
     35      ["cookies", "http://test1.example.org"],
     36      [id1, id2, id3, id4],
     37    ],
     38  ]);
     39 
     40  const sameSite1 = getRowValues(id1).sameSite;
     41  const sameSite2 = getRowValues(id2).sameSite;
     42  const sameSite3 = getRowValues(id3).sameSite;
     43  const sameSite4 = getRowValues(id4).sameSite;
     44 
     45  is(sameSite1, "", `sameSite1 is "" because unset`);
     46  is(sameSite2, "Lax", `sameSite2 is "Lax"`);
     47  is(sameSite3, "Strict", `sameSite3 is "Strict"`);
     48  is(sameSite4, "None", `sameSite4 is "None"`);
     49 });