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.
var warningStringID;
if (this.hasCustomizedItemSelection()) {
if (this.hasNonSelectedItems()) {
warningStringID = "sanitizeSelectedWarning";
if (!aDontShowItemList)
this.showItemList();
@ -231,11 +231,11 @@ var gSanitizePromptDialog = {
/**
* Check if all of the history items have been selected like the default status.
*/
hasCustomizedItemSelection: function () {
hasNonSelectedItems: function () {
let checkboxes = document.querySelectorAll("#itemList > [preference]");
for (let i = 0; i < checkboxes.length; ++i) {
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
if (pref.value != pref.defaultValue)
if (!pref.value)
return true;
}
return false;

View File

@ -303,8 +303,8 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Reset the check boxes and select "Everything"
this.resetCheckboxes();
// Check all items and select "Everything"
this.checkAllCheckboxes();
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
// Hide details
@ -317,11 +317,10 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should remain closed because the items selection is the same
// as the default state.
// Details should remain closed because all items are checked.
this.checkDetails(false);
// Modify the default items state
// Uncheck history.
this.checkPrefCheckbox("history", false);
this.acceptDialog();
};
@ -330,8 +329,20 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because the items selection is not the same
// as the default state.
// Details should be open because not all items are checked.
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);
// Hide details
@ -344,8 +355,7 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because the items selection is not the same
// as the default state.
// Details should be open because not all items are checked.
this.checkDetails(true);
// 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]");
ok(cb.length > 1, "found checkboxes for preferences");
for (var i = 0; i < cb.length; ++i) {
var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
if (pref.value != pref.defaultValue)
if (!pref.value)
cb[i].click();
}
},