blob: 9811ed62d1c6da3c944d4721aa163b740d0dc7c7 (
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
|
"use strict";
function switchToCustomHistoryMode(doc) {
// Select the last item in the menulist.
let menulist = doc.getElementById("historyMode");
menulist.focus();
EventUtils.sendKey("UP");
}
function testPrefStateMatchesLockedState() {
let win = gBrowser.contentWindow;
let doc = win.document;
switchToCustomHistoryMode(doc);
let checkbox = doc.getElementById("alwaysClear");
let preference = win.Preferences.get("privacy.sanitize.sanitizeOnShutdown");
is(
checkbox.disabled,
preference.locked,
"Always Clear checkbox should be enabled when preference is not locked."
);
Services.prefs.clearUserPref("privacy.history.custom");
gBrowser.removeCurrentTab();
}
add_setup(function() {
registerCleanupFunction(function resetPreferences() {
Services.prefs.unlockPref("privacy.sanitize.sanitizeOnShutdown");
Services.prefs.clearUserPref("privacy.history.custom");
});
});
add_task(async function test_preference_enabled_when_unlocked() {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
testPrefStateMatchesLockedState();
});
add_task(async function test_preference_disabled_when_locked() {
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
testPrefStateMatchesLockedState();
});
|