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
|
// This test works by setting up an exception for the private window allow list
// manually, and it then expects to see some blocking notifications (note the
// document.cookie setter in the blocking callback.)
// If the exception lists aren't handled separately, we'd get confused and put
// the pages loaded under this test in the allow list, which would result in
// the test not passing because no blocking notifications would be observed.
// Testing the reverse case would also be interesting, but unfortunately there
// isn't a super easy way to do that with our antitracking test framework since
// private windows wouldn't send any blocking notifications as they don't have
// storage access in the first place.
"use strict";
add_task(async _ => {
let uri = Services.io.newURI("https://example.net");
PermissionTestUtils.add(
uri,
"trackingprotection-pb",
Services.perms.ALLOW_ACTION
);
registerCleanupFunction(_ => {
Services.perms.removeAll();
});
});
AntiTracking.runTest(
"Test that we don't honour a private allow list exception in a normal window",
// Blocking callback
async _ => {
document.cookie = "name=value";
},
// Non blocking callback
async _ => {
// Nothing to do here.
},
// Cleanup callback
async _ => {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()
);
});
},
null, // no extra prefs
false, // run the window.open() test
false, // run the user interaction test
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, // expect blocking notifications
false
); // run in a normal window
|