Bug 1451024 - Cookie settings should be disabled when the related prefs are locked r=jaws

MozReview-Commit-ID: DR0e8fFBNDj

--HG--
extra : rebase_source : a1a440b674ec6b3089357fe6048407440182045e
This commit is contained in:
Kirk Steuber 2018-04-05 13:17:17 -07:00
Родитель c71f32b200
Коммит 5088bda067
1 изменённых файлов: 17 добавлений и 10 удалений

Просмотреть файл

@ -839,23 +839,30 @@ var gPrivacyPane = {
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
* disables parts of the cookie UI if appropriate.
*
* Returns "0" if cookies are accepted and "2" if they are entirely disabled.
*/
readAcceptCookies() {
var pref = Preferences.get("network.cookie.cookieBehavior");
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
var keepUntil = document.getElementById("keepUntil");
var menu = document.getElementById("keepCookiesUntil");
let pref = Preferences.get("network.cookie.cookieBehavior");
let acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
let acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
let keepUntilLabel = document.getElementById("keepUntil");
let keepUntilMenu = document.getElementById("keepCookiesUntil");
// enable the rest of the UI for anything other than "disable all cookies"
var acceptCookies = (pref.value != 2);
let acceptCookies = (pref.value != 2);
acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled = !acceptCookies;
if (!acceptThirdPartyMenu.disabled) {
acceptThirdPartyMenu.disabled = !acceptCookies;
}
acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled;
let privateBrowsing = Preferences.get("browser.privatebrowsing.autostart").value;
keepUntil.disabled = menu.disabled = privateBrowsing || !acceptCookies;
if (!keepUntilMenu.disabled) {
keepUntilMenu.disabled = privateBrowsing || !acceptCookies;
}
keepUntilLabel.disabled = keepUntilMenu.disabled;
// Our top-level setting is a radiogroup that only sets "enable all"
// and "disable all", so convert the pref value accordingly.