Bug 527820 - Checking all prefs except "Site Preferences" shows confusing UI; r=dao ui-r=beltzner a=blocking-firefox3.6+

--HG--
extra : rebase_source : 661c6a6c0d4a74e478cf8b476e65723a1654c54f
This commit is contained in:
Ehsan Akhgari 2009-11-17 14:49:59 -05:00
parent 0d37582e30
commit 40348234c6
2 changed files with 25 additions and 15 deletions

View File

@ -159,7 +159,7 @@ var gSanitizePromptDialog = {
// which does not include date and time. See bug 480169 comment 48. // which does not include date and time. See bug 480169 comment 48.
var warningStringID; var warningStringID;
if (this.hasCustomizedItemSelection()) { if (this.hasNonSelectedItems()) {
warningStringID = "sanitizeSelectedWarning"; warningStringID = "sanitizeSelectedWarning";
if (!aDontShowItemList) if (!aDontShowItemList)
this.showItemList(); this.showItemList();
@ -231,11 +231,11 @@ var gSanitizePromptDialog = {
/** /**
* Check if all of the history items have been selected like the default status. * Check if all of the history items have been selected like the default status.
*/ */
hasCustomizedItemSelection: function () { hasNonSelectedItems: function () {
let checkboxes = document.querySelectorAll("#itemList > [preference]"); let checkboxes = document.querySelectorAll("#itemList > [preference]");
for (let i = 0; i < checkboxes.length; ++i) { for (let i = 0; i < checkboxes.length; ++i) {
let pref = document.getElementById(checkboxes[i].getAttribute("preference")); let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
if (pref.value != pref.defaultValue) if (!pref.value)
return true; return true;
} }
return false; return false;

View File

@ -303,8 +303,8 @@ var gAllTests = [
function () { function () {
let wh = new WindowHelper(); let wh = new WindowHelper();
wh.onload = function () { wh.onload = function () {
// Reset the check boxes and select "Everything" // Check all items and select "Everything"
this.resetCheckboxes(); this.checkAllCheckboxes();
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING); this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
// Hide details // Hide details
@ -317,11 +317,10 @@ var gAllTests = [
function () { function () {
let wh = new WindowHelper(); let wh = new WindowHelper();
wh.onload = function () { wh.onload = function () {
// Details should remain closed because the items selection is the same // Details should remain closed because all items are checked.
// as the default state.
this.checkDetails(false); this.checkDetails(false);
// Modify the default items state // Uncheck history.
this.checkPrefCheckbox("history", false); this.checkPrefCheckbox("history", false);
this.acceptDialog(); this.acceptDialog();
}; };
@ -330,8 +329,20 @@ var gAllTests = [
function () { function () {
let wh = new WindowHelper(); let wh = new WindowHelper();
wh.onload = function () { wh.onload = function () {
// Details should be open because the items selection is not the same // Details should be open because not all items are checked.
// as the default state. this.checkDetails(true);
// Modify the Site Preferences item state (bug 527820)
this.checkAllCheckboxes();
this.checkPrefCheckbox("siteSettings", false);
this.acceptDialog();
};
wh.open();
},
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because not all items are checked.
this.checkDetails(true); this.checkDetails(true);
// Hide details // Hide details
@ -344,8 +355,7 @@ var gAllTests = [
function () { function () {
let wh = new WindowHelper(); let wh = new WindowHelper();
wh.onload = function () { wh.onload = function () {
// Details should be open because the items selection is not the same // Details should be open because not all items are checked.
// as the default state.
this.checkDetails(true); this.checkDetails(true);
// Select another duration // Select another duration
@ -469,14 +479,14 @@ WindowHelper.prototype = {
}, },
/** /**
* Resets the checkboxes to their default state. * Makes sure all the checkboxes are checked.
*/ */
resetCheckboxes: function () { checkAllCheckboxes: function () {
var cb = this.win.document.querySelectorAll("#itemList > [preference]"); var cb = this.win.document.querySelectorAll("#itemList > [preference]");
ok(cb.length > 1, "found checkboxes for preferences"); ok(cb.length > 1, "found checkboxes for preferences");
for (var i = 0; i < cb.length; ++i) { for (var i = 0; i < cb.length; ++i) {
var pref = this.win.document.getElementById(cb[i].getAttribute("preference")); var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
if (pref.value != pref.defaultValue) if (!pref.value)
cb[i].click(); cb[i].click();
} }
}, },