mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
MozReview-Commit-ID: DPLJT1adO1c --HG-- rename : browser/components/preferences/in-content-old/content.js => browser/components/preferences/in-content/content.js rename : browser/components/preferences/in-content-old/content.xul => browser/components/preferences/in-content/content.xul rename : browser/components/preferences/in-content-old/search.js => browser/components/preferences/in-content/search.js rename : browser/components/preferences/in-content-old/search.xul => browser/components/preferences/in-content/search.xul rename : browser/components/preferences/in-content-old/security.js => browser/components/preferences/in-content/security.js rename : browser/components/preferences/in-content-old/security.xul => browser/components/preferences/in-content/security.xul rename : browser/components/preferences/in-content-old/tests/browser_advanced_siteData.js => browser/components/preferences/in-content/tests/browser_advanced_siteData.js extra : rebase_source : 57611e32dba47a2238a5e0573c25478a96cfb8fd
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
"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 = doc.getElementById("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_task(function setup() {
|
|
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", undefined, {leaveOpen: true});
|
|
testPrefStateMatchesLockedState();
|
|
});
|
|
|
|
add_task(async function test_preference_disabled_when_locked() {
|
|
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
|
|
await openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
|
testPrefStateMatchesLockedState();
|
|
});
|