summaryrefslogtreecommitdiffstats
path: root/devtools/client/storage/test/browser_storage_cookies_samesite.js
blob: dc58aaa9f65ef11d1f01eda898b5aab6f5579c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

// Test that the samesite cookie attribute is displayed correctly.

add_task(async function () {
  await openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies-samesite.html");

  const id1 = getCookieId(
    "test1",
    "test1.example.org",
    "/browser/devtools/client/storage/test"
  );
  const id2 = getCookieId(
    "test2",
    "test1.example.org",
    "/browser/devtools/client/storage/test"
  );
  const id3 = getCookieId(
    "test3",
    "test1.example.org",
    "/browser/devtools/client/storage/test"
  );

  await checkState([
    [
      ["cookies", "http://test1.example.org"],
      [id1, id2, id3],
    ],
  ]);

  const sameSite1 = getRowValues(id1).sameSite;
  const sameSite2 = getRowValues(id2).sameSite;
  const sameSite3 = getRowValues(id3).sameSite;

  is(sameSite1, "None", `sameSite1 is "None"`);
  is(sameSite2, "Lax", `sameSite2 is "Lax"`);
  is(sameSite3, "Strict", `sameSite3 is "Strict"`);
});