summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/browser_partitionedDOMCache.js
blob: ff6c8b9b751e8c352f755ff8458a5731219dd128 (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
/* import-globals-from partitionedstorage_head.js */

PartitionedStorageHelper.runTest(
  "DOMCache",
  async (win3rdParty, win1stParty, allowed) => {
    // DOM Cache is not supported. Always blocked.
    await win3rdParty.caches.open("wow").then(
      _ => {
        ok(allowed, "DOM Cache cannot be used!");
      },
      _ => {
        ok(!allowed, "DOM Cache cannot be used!");
      }
    );

    await win1stParty.caches.open("wow").then(
      _ => {
        ok(true, "DOM Cache should be available");
      },
      _ => {
        ok(false, "DOM Cache should be available");
      }
    );
  },

  async _ => {
    await new Promise(resolve => {
      Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
        resolve()
      );
    });
  },

  [["dom.caches.testing.enabled", true]]
);