summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_stateful_storage.js
blob: ff9daabcdbf3c27e803b2d5368d80b6915fca0c9 (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
43
44
45
46
47
48
49
50
51
52
53
54
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

let bounceTrackingProtection;

add_setup(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [
      ["privacy.bounceTrackingProtection.requireStatefulBounces", true],
      ["privacy.bounceTrackingProtection.bounceTrackingGracePeriodSec", 0],
    ],
  });
  bounceTrackingProtection = Cc[
    "@mozilla.org/bounce-tracking-protection;1"
  ].getService(Ci.nsIBounceTrackingProtection);
});

// Storage tests.

add_task(async function test_bounce_stateful_localStorage() {
  info("Client bounce with localStorage.");
  await runTestBounce({
    bounceType: "client",
    setState: "localStorage",
  });
});

add_task(async function test_bounce_stateful_localStorage_sameSiteFrame() {
  info("Client bounce with localStorage set in same site frame.");
  await runTestBounce({
    bounceType: "client",
    setState: "localStorage",
    setStateSameSiteFrame: true,
  });
});

add_task(async function test_bounce_stateful_indexedDB() {
  info("Client bounce with indexedDB.");
  await runTestBounce({
    bounceType: "client",
    setState: "indexedDB",
  });
});

add_task(async function test_bounce_stateful_indexedDB_sameSiteFrame() {
  info("Client bounce with indexedDB populated in same site frame.");
  await runTestBounce({
    bounceType: "client",
    setState: "indexedDB",
    setStateSameSiteFrame: true,
  });
});