Backed out 12 changesets (bug 1843308, bug 1848406, bug 1888500, bug 1888504, bug...
[gecko.git] / toolkit / components / antitracking / bouncetrackingprotection / test / browser / browser_bouncetracking_stateful.js
blobe7fb4521a7cfa97aa6068039d8c0c3b9adc5a2af
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 let bounceTrackingProtection;
8 add_setup(async function () {
9   await SpecialPowers.pushPrefEnv({
10     set: [
11       ["privacy.bounceTrackingProtection.requireStatefulBounces", true],
12       ["privacy.bounceTrackingProtection.bounceTrackingGracePeriodSec", 0],
13     ],
14   });
15   bounceTrackingProtection = Cc[
16     "@mozilla.org/bounce-tracking-protection;1"
17   ].getService(Ci.nsIBounceTrackingProtection);
18 });
20 // Cookie tests.
22 add_task(async function test_bounce_stateful_cookies_client() {
23   info("Test client bounce with cookie.");
24   await runTestBounce({
25     bounceType: "client",
26     setState: "cookie-client",
27   });
28   info("Test client bounce without cookie.");
29   await runTestBounce({
30     bounceType: "client",
31     setState: null,
32     expectCandidate: false,
33     expectPurge: false,
34   });
35 });
37 add_task(async function test_bounce_stateful_cookies_server() {
38   info("Test server bounce with cookie.");
39   await runTestBounce({
40     bounceType: "server",
41     setState: "cookie-server",
42   });
43   info("Test server bounce without cookie.");
44   await runTestBounce({
45     bounceType: "server",
46     setState: null,
47     expectCandidate: false,
48     expectPurge: false,
49   });
50 });
52 // Storage tests.
54 // TODO: Bug 1848406: Implement stateful bounce detection for localStorage.
55 add_task(async function test_bounce_stateful_localStorage() {
56   info("TODO: client bounce with localStorage.");
57   await runTestBounce({
58     bounceType: "client",
59     setState: "localStorage",
60     expectCandidate: false,
61     expectPurge: false,
62   });
63 });