blob: c454454df638b8a4878e03a073eb75a08cc2d48b (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const httpsOnlyVisible = SpecialPowers.getBoolPref(
"browser.preferences.exposeHTTPSOnly"
);
function test() {
waitForExplicitFinish();
// Adding one fake site so that the SiteDataManager would run.
// Otherwise, without any site then it would just return so we would end up in not testing SiteDataManager.
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
"https://www.foo.com"
);
Services.perms.addFromPrincipal(
principal,
"persistent-storage",
Ci.nsIPermissionManager.ALLOW_ACTION
);
registerCleanupFunction(function() {
Services.perms.removeFromPrincipal(principal, "persistent-storage");
});
SpecialPowers.pushPrefEnv({
set: [["privacy.userContext.ui.enabled", true]],
}).then(() => open_preferences(runTest));
}
async function runTest(win) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let tab = win.document;
let elements = tab.getElementById("mainPrefPane").children;
// Test if privacy pane is opened correctly
await win.gotoPref("panePrivacy");
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "panePrivacy") {
// HTTPS-Only Mode is exposed depending on the preference.
if (element.id == "httpsOnlyBox") {
if (httpsOnlyVisible) {
is_element_visible(element, "HTTPSOnly should be visible");
} else {
is_element_hidden(element, "HTTPSOnly should not be visible");
}
continue;
}
is_element_visible(
element,
`Privacy element of id=${element.id} should be visible`
);
} else {
is_element_hidden(
element,
`Non-Privacy element of id=${element.id} should be hidden`
);
}
}
gBrowser.removeCurrentTab();
win.close();
finish();
}
|