Bug 1325464 - Use ES6 method syntax for content.js. r=mattn
MozReview-Commit-ID: JzgfdVQFHGW
--- a/browser/components/preferences/in-content/content.js
+++ b/browser/components/preferences/in-content/content.js
@@ -11,17 +11,17 @@ XPCOMUtils.defineLazyGetter(this, "Alert
alertsService.manualDoNotDisturb;
return alertsService;
} catch (ex) {
return undefined;
}
});
var gContentPane = {
- init: function()
+ init()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gContentPane));
}
// Initializes the fonts dropdowns displayed in this pane.
@@ -94,17 +94,17 @@ var gContentPane = {
},
// UTILITY FUNCTIONS
/**
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
- updateButtons: function(aButtonID, aPreferenceID)
+ updateButtons(aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
button.disabled = preference.value != true;
return undefined;
},
// BEGIN UI CODE
@@ -140,49 +140,49 @@ var gContentPane = {
// POP-UPS
/**
* Displays the popup exceptions dialog where specific site popup preferences
* can be set.
*/
- showPopupExceptions: function()
+ showPopupExceptions()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "popup" }
params.windowTitle = bundlePreferences.getString("popuppermissionstitle");
params.introText = bundlePreferences.getString("popuppermissionstext");
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
"resizable=yes", params);
},
// FONTS
/**
* Populates the default font list in UI.
*/
- _rebuildFonts: function()
+ _rebuildFonts()
{
var preferences = document.getElementById("contentPreferences");
// Ensure preferences are "visible" to ensure bindings work.
preferences.hidden = false;
// Force flush:
preferences.clientHeight;
var langGroupPref = document.getElementById("font.language.group");
this._selectDefaultLanguageGroup(langGroupPref.value,
this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
},
/**
*
*/
- _selectDefaultLanguageGroup: function(aLanguageGroup, aIsSerif)
+ _selectDefaultLanguageGroup(aLanguageGroup, aIsSerif)
{
const kFontNameFmtSerif = "font.name.serif.%LANG%";
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
const kFontSizeFmtVariable = "font.size.variable.%LANG%";
var preferences = document.getElementById("contentPreferences");
@@ -223,17 +223,17 @@ var gContentPane = {
}
}
},
/**
* Returns the type of the current default font for the language denoted by
* aLanguageGroup.
*/
- _readDefaultFontTypeForLanguage: function(aLanguageGroup)
+ _readDefaultFontTypeForLanguage(aLanguageGroup)
{
const kDefaultFontType = "font.default.%LANG%";
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
var preference = document.getElementById(defaultFontTypePref);
if (!preference) {
preference = document.createElement("preference");
preference.id = defaultFontTypePref;
preference.setAttribute("name", defaultFontTypePref);
@@ -243,52 +243,52 @@ var gContentPane = {
}
return preference.value;
},
/**
* Displays the fonts dialog, where web page font names and sizes can be
* configured.
*/
- configureFonts: function()
+ configureFonts()
{
gSubDialog.open("chrome://browser/content/preferences/fonts.xul", "resizable=no");
},
/**
* Displays the colors dialog, where default web page/link/etc. colors can be
* configured.
*/
- configureColors: function()
+ configureColors()
{
gSubDialog.open("chrome://browser/content/preferences/colors.xul", "resizable=no");
},
// LANGUAGES
/**
* Shows a dialog in which the preferred language for web content may be set.
*/
- showLanguages: function()
+ showLanguages()
{
gSubDialog.open("chrome://browser/content/preferences/languages.xul");
},
/**
* Displays the translation exceptions dialog where specific site and language
* translation preferences can be set.
*/
- showTranslationExceptions: function()
+ showTranslationExceptions()
{
gSubDialog.open("chrome://browser/content/preferences/translation.xul");
},
- openTranslationProviderAttribution: function()
+ openTranslationProviderAttribution()
{
Components.utils.import("resource:///modules/translation/Translation.jsm");
Translation.openProviderAttribution();
},
- toggleDoNotDisturbNotifications: function(event)
+ toggleDoNotDisturbNotifications(event)
{
AlertsServiceDND.manualDoNotDisturb = event.target.checked;
},
};