--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -21,17 +21,17 @@ var gPrivacyPane = {
* Whether the prompt to restart Firefox should appear when changing the autostart pref.
*/
_shouldPromptForRestart: true,
/**
* Show the Tracking Protection UI depending on the
* privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link
*/
- _initTrackingProtection: function() {
+ _initTrackingProtection() {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
let link = document.getElementById("trackingProtectionLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
@@ -40,48 +40,48 @@ var gPrivacyPane = {
document.getElementById("trackingprotectionbox").hidden = false;
document.getElementById("trackingprotectionpbmbox").hidden = true;
},
/**
* Linkify the Learn More link of the Private Browsing Mode Tracking
* Protection UI.
*/
- _initTrackingProtectionPBM: function() {
+ _initTrackingProtectionPBM() {
let link = document.getElementById("trackingProtectionPBMLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
link.setAttribute("href", url);
},
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
- _initAutocomplete: function() {
+ _initAutocomplete() {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
},
/**
* Show the Containers UI depending on the privacy.userContext.ui.enabled pref.
*/
- _initBrowserContainers: function() {
+ _initBrowserContainers() {
if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) {
return;
}
let link = document.getElementById("browserContainersLearnMore");
link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "containers";
document.getElementById("browserContainersbox").hidden = false;
document.getElementById("browserContainersCheckbox").checked =
Services.prefs.getBoolPref("privacy.userContext.enabled");
},
- _checkBrowserContainers: function(event) {
+ _checkBrowserContainers(event) {
let checkbox = document.getElementById("browserContainersCheckbox");
if (checkbox.checked) {
Services.prefs.setBoolPref("privacy.userContext.enabled", true);
return;
}
let count = ContextualIdentityService.countContainerTabs();
if (count == 0) {
@@ -111,17 +111,17 @@ var gPrivacyPane = {
checkbox.checked = true;
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
- init: function()
+ init()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gPrivacyPane));
}
this._updateSanitizeSettingsButton();
@@ -266,28 +266,28 @@ var gPrivacyPane = {
/**
* Check whether preferences values are set to keep history
*
* @param aPrefs an array of pref names to check for
* @returns boolean true if all of the prefs are set to keep history,
* false otherwise
*/
- _checkHistoryValues: function(aPrefs) {
+ _checkHistoryValues(aPrefs) {
for (let pref of Object.keys(aPrefs)) {
if (document.getElementById(pref).value != aPrefs[pref])
return false;
}
return true;
},
/**
* Initialize the history mode menulist based on the privacy preferences
*/
- initializeHistoryMode: function PPP_initializeHistoryMode()
+ initializeHistoryMode()
{
let mode;
let getVal = aPref => document.getElementById(aPref).value;
if (getVal("privacy.history.custom"))
mode = "custom";
else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
if (getVal("browser.privatebrowsing.autostart"))
@@ -299,17 +299,17 @@ var gPrivacyPane = {
mode = "custom";
document.getElementById("historyMode").value = mode;
},
/**
* Update the selected pane based on the history mode menulist
*/
- updateHistoryModePane: function PPP_updateHistoryModePane()
+ updateHistoryModePane()
{
let selectedIndex = -1;
switch (document.getElementById("historyMode").value) {
case "remember":
selectedIndex = 0;
break;
case "dontremember":
selectedIndex = 1;
@@ -321,17 +321,17 @@ var gPrivacyPane = {
document.getElementById("historyPane").selectedIndex = selectedIndex;
document.getElementById("privacy.history.custom").value = selectedIndex == 2;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist
*/
- updateHistoryModePrefs: function PPP_updateHistoryModePrefs()
+ updateHistoryModePrefs()
{
let pref = document.getElementById("browser.privatebrowsing.autostart");
switch (document.getElementById("historyMode").value) {
case "remember":
if (pref.value)
pref.value = false;
// select the remember history option if needed
@@ -356,17 +356,17 @@ var gPrivacyPane = {
break;
}
},
/**
* Update the privacy micro-management controls based on the
* value of the private browsing auto-start checkbox.
*/
- updatePrivacyMicroControls: function PPP_updatePrivacyMicroControls()
+ updatePrivacyMicroControls()
{
if (document.getElementById("historyMode").value == "custom") {
let disabled = this._autoStartPrivateBrowsing =
document.getElementById("privateBrowsingAutoStart").checked;
this.dependentControls.forEach(function(aElement) {
let control = document.getElementById(aElement);
let preferenceId = control.getAttribute("preference");
if (!preferenceId) {
@@ -408,27 +408,27 @@ var gPrivacyPane = {
}
},
// PRIVATE BROWSING
/**
* Initialize the starting state for the auto-start private browsing mode pref reverter.
*/
- initAutoStartPrivateBrowsingReverter: function PPP_initAutoStartPrivateBrowsingReverter()
+ initAutoStartPrivateBrowsingReverter()
{
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute('checked');
},
_lastMode: null,
_lastCheckState: null,
- updateAutostart: function PPP_updateAutostart() {
+ updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
(mode.value == "remember" && !this._lastCheckState) ||
(mode.value == "dontremember" && this._lastCheckState)) {
// These are all no-op changes, so we don't need to prompt.
this._lastMode = mode.selectedIndex;
@@ -485,17 +485,17 @@ var gPrivacyPane = {
*/
showContainerSettings() {
gotoPref("containers");
},
/**
* Displays the available block lists for tracking protection.
*/
- showBlockLists: function()
+ showBlockLists()
{
var bundlePreferences = document.getElementById("bundlePreferences");
let brandName = document.getElementById("bundleBrand")
.getString("brandShortName");
var params = { brandShortName: brandName,
windowTitle: bundlePreferences.getString("blockliststitle"),
introText: bundlePreferences.getString("blockliststext") };
gSubDialog.open("chrome://browser/content/preferences/blocklists.xul",
@@ -540,17 +540,17 @@ var gPrivacyPane = {
* 2 means keep cookies until the browser is closed
*/
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
*/
- readAcceptCookies: function()
+ readAcceptCookies()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
var keepUntil = document.getElementById("keepUntil");
var menu = document.getElementById("keepCookiesUntil");
// enable the rest of the UI for anything other than "disable all cookies"
@@ -561,32 +561,32 @@ var gPrivacyPane = {
return acceptCookies;
},
/**
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
*/
- writeAcceptCookies: function()
+ writeAcceptCookies()
{
var accept = document.getElementById("acceptCookies");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
// if we're enabling cookies, automatically select 'accept third party always'
if (accept.checked)
acceptThirdPartyMenu.selectedIndex = 0;
return accept.checked ? 0 : 2;
},
/**
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
*/
- readAcceptThirdPartyCookies: function()
+ readAcceptThirdPartyCookies()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
switch (pref.value)
{
case 0:
return "always";
case 1:
return "never";
@@ -594,17 +594,17 @@ var gPrivacyPane = {
return "never";
case 3:
return "visited";
default:
return undefined;
}
},
- writeAcceptThirdPartyCookies: function()
+ writeAcceptThirdPartyCookies()
{
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
switch (accept.value)
{
case "always":
return 0;
case "visited":
return 3;
@@ -613,34 +613,34 @@ var gPrivacyPane = {
default:
return undefined;
}
},
/**
* Displays fine-grained, per-site preferences for cookies.
*/
- showCookieExceptions: function()
+ showCookieExceptions()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : true,
sessionVisible : true,
allowVisible : true,
prefilledHost : "",
permissionType : "cookie",
windowTitle : bundlePreferences.getString("cookiepermissionstitle"),
introText : bundlePreferences.getString("cookiepermissionstext") };
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Displays all the user's cookies in a dialog.
*/
- showCookies: function(aCategory)
+ showCookies(aCategory)
{
gSubDialog.open("chrome://browser/content/preferences/cookies.xul");
},
// CLEAR PRIVATE DATA
/*
* Preferences:
@@ -648,27 +648,27 @@ var gPrivacyPane = {
* privacy.sanitize.sanitizeOnShutdown
* - true if the user's private data is cleared on startup according to the
* Clear Private Data settings, false otherwise
*/
/**
* Displays the Clear Private Data settings dialog.
*/
- showClearPrivateDataSettings: function()
+ showClearPrivateDataSettings()
{
gSubDialog.open("chrome://browser/content/preferences/sanitize.xul", "resizable=no");
},
/**
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
- clearPrivateDataNow: function(aClearEverything) {
+ clearPrivateDataNow(aClearEverything) {
var ts = document.getElementById("privacy.sanitize.timeSpan");
var timeSpanOrig = ts.value;
if (aClearEverything) {
ts.value = 0;
}
gSubDialog.open("chrome://browser/content/sanitize.xul", "resizable=no", null, () => {
@@ -680,17 +680,17 @@ var gPrivacyPane = {
Services.obs.notifyObservers(null, "clear-private-data", null);
});
},
/**
* Enables or disables the "Settings..." button depending
* on the privacy.sanitize.sanitizeOnShutdown preference value
*/
- _updateSanitizeSettingsButton: function() {
+ _updateSanitizeSettingsButton() {
var settingsButton = document.getElementById("clearDataSettings");
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
settingsButton.disabled = !sanitizeOnShutdownPref.value;
},
// CONTAINERS
@@ -699,17 +699,17 @@ var gPrivacyPane = {
*
* privacy.userContext.enabled
* - true if containers is enabled
*/
/**
* Enables/disables the Settings button used to configure containers
*/
- readBrowserContainersCheckbox: function()
+ readBrowserContainersCheckbox()
{
var pref = document.getElementById("privacy.userContext.enabled");
var settings = document.getElementById("browserContainersSettings");
settings.disabled = !pref.value;
}
};