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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
"use strict";
registerCleanupFunction(() => {
UrlClassifierTestUtils.cleanupTestTrackers();
Services.prefs.clearUserPref(TRACKING_PREF);
});
add_setup(async function () {
await UrlClassifierTestUtils.addTestTrackers();
});
add_task(async function test_shim_disabled_by_own_pref() {
// Test that a shim will not apply if disabled in about:config
Services.prefs.setBoolPref(DISABLE_SHIM1_PREF, true);
Services.prefs.setBoolPref(TRACKING_PREF, true);
await testShimDoesNotRun();
Services.prefs.clearUserPref(DISABLE_SHIM1_PREF);
Services.prefs.clearUserPref(TRACKING_PREF);
});
add_task(async function test_shim_disabled_by_global_pref() {
// Test that a shim will not apply if disabled in about:config
Services.prefs.setBoolPref(GLOBAL_PREF, false);
Services.prefs.setBoolPref(DISABLE_SHIM1_PREF, false);
Services.prefs.setBoolPref(TRACKING_PREF, true);
await testShimDoesNotRun();
Services.prefs.clearUserPref(GLOBAL_PREF);
Services.prefs.clearUserPref(DISABLE_SHIM1_PREF);
Services.prefs.clearUserPref(TRACKING_PREF);
});
add_task(async function test_shim_disabled_hosts_notHosts() {
Services.prefs.setBoolPref(TRACKING_PREF, true);
await testShimDoesNotRun(false, SHIMMABLE_TEST_PAGE_3);
Services.prefs.clearUserPref(TRACKING_PREF);
});
add_task(async function test_shim_disabled_overridden_by_pref() {
Services.prefs.setBoolPref(TRACKING_PREF, true);
await testShimDoesNotRun(false, SHIMMABLE_TEST_PAGE_2);
Services.prefs.setBoolPref(DISABLE_SHIM2_PREF, false);
await testShimRuns(SHIMMABLE_TEST_PAGE_2);
Services.prefs.clearUserPref(TRACKING_PREF);
Services.prefs.clearUserPref(DISABLE_SHIM2_PREF);
});
add_task(async function test_shim() {
// Test that a shim which only runs in strict mode works, and that it
// is permitted to opt into showing normally-blocked tracking content.
Services.prefs.setBoolPref(TRACKING_PREF, true);
await testShimRuns(SHIMMABLE_TEST_PAGE);
// test that if the user opts in on one domain, they will still have to opt
// in on another domain which embeds an iframe to the first one.
await testShimRuns(EMBEDDING_TEST_PAGE, 0, false, false);
Services.prefs.clearUserPref(TRACKING_PREF);
});
|