forked from mirrors/gecko-dev
bug 1347642 - Fixed sanitizeDialog.js running in ESLint r=standard8
MozReview-Commit-ID: A7mVW5hbvya --HG-- extra : rebase_source : 409f0d9533a5e59ac6ba70c32ef917febba78d6b
This commit is contained in:
parent
b6e22d3c65
commit
dce1b0c3e6
2 changed files with 18 additions and 32 deletions
|
|
@ -55,7 +55,6 @@ b2g/locales/en-US/b2g-l10n.js
|
||||||
# browser/ exclusions
|
# browser/ exclusions
|
||||||
browser/app/**
|
browser/app/**
|
||||||
browser/branding/**/firefox-branding.js
|
browser/branding/**/firefox-branding.js
|
||||||
browser/base/content/sanitizeDialog.js
|
|
||||||
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
|
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
|
||||||
browser/base/content/test/urlbar/file_blank_but_not_blank.html
|
browser/base/content/test/urlbar/file_blank_but_not_blank.html
|
||||||
browser/base/content/newtab/**
|
browser/base/content/newtab/**
|
||||||
|
|
|
||||||
|
|
@ -11,21 +11,18 @@ var {Sanitizer} = Cu.import("resource:///modules/Sanitizer.jsm", {});
|
||||||
|
|
||||||
var gSanitizePromptDialog = {
|
var gSanitizePromptDialog = {
|
||||||
|
|
||||||
get bundleBrowser()
|
get bundleBrowser() {
|
||||||
{
|
|
||||||
if (!this._bundleBrowser)
|
if (!this._bundleBrowser)
|
||||||
this._bundleBrowser = document.getElementById("bundleBrowser");
|
this._bundleBrowser = document.getElementById("bundleBrowser");
|
||||||
return this._bundleBrowser;
|
return this._bundleBrowser;
|
||||||
},
|
},
|
||||||
|
|
||||||
get selectedTimespan()
|
get selectedTimespan() {
|
||||||
{
|
|
||||||
var durList = document.getElementById("sanitizeDurationChoice");
|
var durList = document.getElementById("sanitizeDurationChoice");
|
||||||
return parseInt(durList.value);
|
return parseInt(durList.value);
|
||||||
},
|
},
|
||||||
|
|
||||||
get sanitizePreferences()
|
get sanitizePreferences() {
|
||||||
{
|
|
||||||
if (!this._sanitizePreferences) {
|
if (!this._sanitizePreferences) {
|
||||||
this._sanitizePreferences =
|
this._sanitizePreferences =
|
||||||
document.getElementById("sanitizePreferences");
|
document.getElementById("sanitizePreferences");
|
||||||
|
|
@ -33,13 +30,11 @@ var gSanitizePromptDialog = {
|
||||||
return this._sanitizePreferences;
|
return this._sanitizePreferences;
|
||||||
},
|
},
|
||||||
|
|
||||||
get warningBox()
|
get warningBox() {
|
||||||
{
|
|
||||||
return document.getElementById("sanitizeEverythingWarningBox");
|
return document.getElementById("sanitizeEverythingWarningBox");
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ()
|
init() {
|
||||||
{
|
|
||||||
// This is used by selectByTimespan() to determine if the window has loaded.
|
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||||
this._inited = true;
|
this._inited = true;
|
||||||
|
|
||||||
|
|
@ -54,13 +49,11 @@ var gSanitizePromptDialog = {
|
||||||
this.warningBox.hidden = false;
|
this.warningBox.hidden = false;
|
||||||
document.title =
|
document.title =
|
||||||
this.bundleBrowser.getString("sanitizeDialog2.everything.title");
|
this.bundleBrowser.getString("sanitizeDialog2.everything.title");
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
this.warningBox.hidden = true;
|
this.warningBox.hidden = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectByTimespan: function ()
|
selectByTimespan() {
|
||||||
{
|
|
||||||
// This method is the onselect handler for the duration dropdown. As a
|
// This method is the onselect handler for the duration dropdown. As a
|
||||||
// result it's called a couple of times before onload calls init().
|
// result it's called a couple of times before onload calls init().
|
||||||
if (!this._inited)
|
if (!this._inited)
|
||||||
|
|
@ -89,8 +82,7 @@ var gSanitizePromptDialog = {
|
||||||
window.document.documentElement.getAttribute("noneverythingtitle");
|
window.document.documentElement.getAttribute("noneverythingtitle");
|
||||||
},
|
},
|
||||||
|
|
||||||
sanitize: function ()
|
sanitize() {
|
||||||
{
|
|
||||||
// Update pref values before handing off to the sanitizer (bug 453440)
|
// Update pref values before handing off to the sanitizer (bug 453440)
|
||||||
this.updatePrefs();
|
this.updatePrefs();
|
||||||
var s = new Sanitizer();
|
var s = new Sanitizer();
|
||||||
|
|
@ -114,6 +106,7 @@ var gSanitizePromptDialog = {
|
||||||
s.sanitize().then(null, Components.utils.reportError)
|
s.sanitize().then(null, Components.utils.reportError)
|
||||||
.then(() => window.close())
|
.then(() => window.close())
|
||||||
.then(null, Components.utils.reportError);
|
.then(null, Components.utils.reportError);
|
||||||
|
return false;
|
||||||
} catch (er) {
|
} catch (er) {
|
||||||
Components.utils.reportError("Exception during sanitize: " + er);
|
Components.utils.reportError("Exception during sanitize: " + er);
|
||||||
return true; // We *do* want to close immediately on error.
|
return true; // We *do* want to close immediately on error.
|
||||||
|
|
@ -128,7 +121,7 @@ var gSanitizePromptDialog = {
|
||||||
* True means the item list visibility status should not
|
* True means the item list visibility status should not
|
||||||
* be changed.
|
* be changed.
|
||||||
*/
|
*/
|
||||||
prepareWarning: function (aDontShowItemList) {
|
prepareWarning(aDontShowItemList) {
|
||||||
// If the date and time-aware locale warning string is ever used again,
|
// If the date and time-aware locale warning string is ever used again,
|
||||||
// initialize it here. Currently we use the no-visits warning string,
|
// initialize it here. Currently we use the no-visits warning string,
|
||||||
// which does not include date and time. See bug 480169 comment 48.
|
// which does not include date and time. See bug 480169 comment 48.
|
||||||
|
|
@ -138,8 +131,7 @@ var gSanitizePromptDialog = {
|
||||||
warningStringID = "sanitizeSelectedWarning";
|
warningStringID = "sanitizeSelectedWarning";
|
||||||
if (!aDontShowItemList)
|
if (!aDontShowItemList)
|
||||||
this.showItemList();
|
this.showItemList();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
warningStringID = "sanitizeEverythingWarning2";
|
warningStringID = "sanitizeEverythingWarning2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,8 +144,7 @@ var gSanitizePromptDialog = {
|
||||||
* Called when the value of a preference element is synced from the actual
|
* Called when the value of a preference element is synced from the actual
|
||||||
* pref. Enables or disables the OK button appropriately.
|
* pref. Enables or disables the OK button appropriately.
|
||||||
*/
|
*/
|
||||||
onReadGeneric: function ()
|
onReadGeneric() {
|
||||||
{
|
|
||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
// Find any other pref that's checked and enabled.
|
// Find any other pref that's checked and enabled.
|
||||||
|
|
@ -168,8 +159,7 @@ var gSanitizePromptDialog = {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
document.documentElement.getButton("accept").disabled = !found;
|
document.documentElement.getButton("accept").disabled = !found;
|
||||||
}
|
} catch (e) { }
|
||||||
catch (e) { }
|
|
||||||
|
|
||||||
// Update the warning prompt if needed
|
// Update the warning prompt if needed
|
||||||
this.prepareWarning(true);
|
this.prepareWarning(true);
|
||||||
|
|
@ -185,9 +175,7 @@ var gSanitizePromptDialog = {
|
||||||
* (i.e., Windows). We must therefore manually set the prefs from their
|
* (i.e., Windows). We must therefore manually set the prefs from their
|
||||||
* corresponding preference elements.
|
* corresponding preference elements.
|
||||||
*/
|
*/
|
||||||
updatePrefs : function ()
|
updatePrefs() {
|
||||||
{
|
|
||||||
var tsPref = document.getElementById("privacy.sanitize.timeSpan");
|
|
||||||
Sanitizer.prefs.setIntPref("timeSpan", this.selectedTimespan);
|
Sanitizer.prefs.setIntPref("timeSpan", this.selectedTimespan);
|
||||||
|
|
||||||
// Keep the pref for the download history in sync with the history pref.
|
// Keep the pref for the download history in sync with the history pref.
|
||||||
|
|
@ -206,7 +194,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
hasNonSelectedItems: function () {
|
hasNonSelectedItems() {
|
||||||
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"));
|
||||||
|
|
@ -219,7 +207,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Show the history items list.
|
* Show the history items list.
|
||||||
*/
|
*/
|
||||||
showItemList: function () {
|
showItemList() {
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
var expanderButton = document.getElementById("detailsExpander");
|
var expanderButton = document.getElementById("detailsExpander");
|
||||||
|
|
||||||
|
|
@ -234,7 +222,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Hide the history items list.
|
* Hide the history items list.
|
||||||
*/
|
*/
|
||||||
hideItemList: function () {
|
hideItemList() {
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
var expanderButton = document.getElementById("detailsExpander");
|
var expanderButton = document.getElementById("detailsExpander");
|
||||||
|
|
||||||
|
|
@ -248,8 +236,7 @@ var gSanitizePromptDialog = {
|
||||||
/**
|
/**
|
||||||
* Called by the item list expander button to toggle the list's visibility.
|
* Called by the item list expander button to toggle the list's visibility.
|
||||||
*/
|
*/
|
||||||
toggleItemList: function ()
|
toggleItemList() {
|
||||||
{
|
|
||||||
var itemList = document.getElementById("itemList");
|
var itemList = document.getElementById("itemList");
|
||||||
|
|
||||||
if (itemList.collapsed)
|
if (itemList.collapsed)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue