mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1064261 - Check if the preference is locked before making the related control enabled. r=Gijs
This commit is contained in:
parent
5ce4696fc6
commit
2a4bbe152d
@ -243,9 +243,20 @@ var gPrivacyPane = {
|
||||
if (document.getElementById("historyMode").value == "custom") {
|
||||
let disabled = this._autoStartPrivateBrowsing =
|
||||
document.getElementById("privateBrowsingAutoStart").checked;
|
||||
this.dependentControls
|
||||
.forEach(function (aElement)
|
||||
document.getElementById(aElement).disabled = disabled);
|
||||
this.dependentControls.forEach(function (aElement) {
|
||||
let control = document.getElementById(aElement);
|
||||
let preferenceId = control.getAttribute("preference");
|
||||
if (!preferenceId) {
|
||||
let dependentControlId = control.getAttribute("control");
|
||||
if (dependentControlId) {
|
||||
let dependentControl = document.getElementById(dependentControlId);
|
||||
preferenceId = dependentControl.getAttribute("preference");
|
||||
}
|
||||
}
|
||||
|
||||
let preference = preferenceId ? document.getElementById(preferenceId) : {};
|
||||
control.disabled = disabled || preference.locked;
|
||||
});
|
||||
|
||||
// adjust the cookie controls status
|
||||
this.readAcceptCookies();
|
||||
|
@ -24,6 +24,7 @@ skip-if = !healthreport || (os == 'linux' && debug)
|
||||
[browser_privacypane_5.js]
|
||||
[browser_privacypane_8.js]
|
||||
skip-if = e10s # Bug ?????? - "leaked until shutdown [nsGlobalWindow #99 about:preferences]"
|
||||
[browser_sanitizeOnShutdown_prefLocked.js]
|
||||
[browser_subdialogs.js]
|
||||
skip-if = e10s # Bug 1087114
|
||||
support-files = subdialog.xul
|
||||
|
@ -0,0 +1,39 @@
|
||||
"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.");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
add_task(function setup() {
|
||||
registerCleanupFunction(function resetPreferences() {
|
||||
Services.prefs.unlockPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
Services.prefs.clearUserPref("browser.preferences.inContent");
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.preferences.inContent", true);
|
||||
});
|
||||
|
||||
add_task(function test_preference_enabled_when_unlocked() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
||||
testPrefStateMatchesLockedState();
|
||||
});
|
||||
|
||||
add_task(function test_preference_disabled_when_locked() {
|
||||
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
||||
testPrefStateMatchesLockedState();
|
||||
});
|
@ -209,9 +209,20 @@ var gPrivacyPane = {
|
||||
if (document.getElementById("historyMode").value == "custom") {
|
||||
let disabled = this._autoStartPrivateBrowsing =
|
||||
document.getElementById("privateBrowsingAutoStart").checked;
|
||||
this.dependentControls
|
||||
.forEach(function (aElement)
|
||||
document.getElementById(aElement).disabled = disabled);
|
||||
this.dependentControls.forEach(function (aElement) {
|
||||
let control = document.getElementById(aElement);
|
||||
let preferenceId = control.getAttribute("preference");
|
||||
if (!preferenceId) {
|
||||
let dependentControlId = control.getAttribute("control");
|
||||
if (dependentControlId) {
|
||||
let dependentControl = document.getElementById(dependentControlId);
|
||||
preferenceId = dependentControl.getAttribute("preference");
|
||||
}
|
||||
}
|
||||
|
||||
let preference = preferenceId ? document.getElementById(preferenceId) : {};
|
||||
control.disabled = disabled || preference.locked;
|
||||
});
|
||||
|
||||
// adjust the cookie controls status
|
||||
this.readAcceptCookies();
|
||||
|
Loading…
Reference in New Issue
Block a user