summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/browser_storageAccessScopeSameSiteWrite.js
blob: 1ef296c52c05b37a4be6dae870ef585cb2e28b08 (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
/* import-globals-from ../../../../../browser/modules/test/browser/head.js */
/* import-globals-from head.js */
/* import-globals-from storage_access_head.js */
Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/browser/modules/test/browser/head.js",
  this
);
Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/toolkit/components/antitracking/test/browser/storage_access_head.js",
  this
);

add_task(async function testInitialBlock() {
  await setPreferences();

  await openPageAndRunCode(
    TEST_TOP_PAGE_7,
    getExpectPopupAndClick("reject"),
    TEST_3RD_PARTY_PAGE,
    requestStorageAccessAndExpectFailure
  );

  await cleanUpData();
  await SpecialPowers.flushPrefEnv();
});

add_task(async function testSameSitePermissionReversed() {
  await setPreferences();

  await openPageAndRunCode(
    TEST_TOP_PAGE_8,
    getExpectPopupAndClick("accept"),
    TEST_3RD_PARTY_PAGE,
    requestStorageAccessAndExpectSuccess
  );

  await openPageAndRunCode(
    TEST_TOP_PAGE_7,
    expectNoPopup,
    TEST_3RD_PARTY_PAGE,
    requestStorageAccessAndExpectSuccess
  );

  await cleanUpData();
  await SpecialPowers.flushPrefEnv();
});