Bug 1378366 - If the default font is not found, use 'Default' as the name for an unchanged font preference. Previously this would show up as blank in this case. r?timdream
MozReview-Commit-ID: G1GEwWNtBMi
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -7,16 +7,17 @@
# LOCALIZATION NOTE: phishBefore uses %S to represent the name of the provider
# whose privacy policy must be accepted (for enabling
# check-every-page-as-I-load-it phishing protection).
phishBeforeText=Selecting this option will send the address of web pages you are viewing to %S. To continue, please review and accept the following terms of service.
#### Fonts
labelDefaultFont=Default (%S)
+labelDefaultFontUnnamed=Default
veryLargeMinimumFontTitle=Large minimum font size
veryLargeMinimumFontWarning=You have selected a very large minimum font size (more than 24 pixels). This may make it difficult or impossible to use some important configuration pages like this one.
acceptVeryLargeMinimumFont=Keep my changes anyway
#### Permissions Manager
trackingprotectionpermissionstext2=You have disabled Tracking Protection on these websites.
--- a/toolkit/mozapps/preferences/fontbuilder.js
+++ b/toolkit/mozapps/preferences/fontbuilder.js
@@ -34,27 +34,27 @@ var FontBuilder = {
if (!this._allFonts)
this._allFonts = await this.enumerator.EnumerateAllFontsAsync({});
// Build the UI for the Default Font and Fonts for this CSS type.
var popup = document.createElement("menupopup");
var separator;
if (fonts.length > 0) {
- if (defaultFont) {
- var bundlePreferences = document.getElementById("bundlePreferences");
- var label = bundlePreferences.getFormattedString("labelDefaultFont", [defaultFont]);
- var menuitem = document.createElement("menuitem");
- menuitem.setAttribute("label", label);
- menuitem.setAttribute("value", ""); // Default Font has a blank value
- popup.appendChild(menuitem);
+ var bundlePreferences = document.getElementById("bundlePreferences");
+ var defaultLabel = defaultFont ?
+ bundlePreferences.getFormattedString("labelDefaultFont", [defaultFont]) :
+ bundlePreferences.getString("labelDefaultFontUnnamed");
+ var menuitem = document.createElement("menuitem");
+ menuitem.setAttribute("label", defaultLabel);
+ menuitem.setAttribute("value", ""); // Default Font has a blank value
+ popup.appendChild(menuitem);
- separator = document.createElement("menuseparator");
- popup.appendChild(separator);
- }
+ separator = document.createElement("menuseparator");
+ popup.appendChild(separator);
for (var i = 0; i < fonts.length; ++i) {
menuitem = document.createElement("menuitem");
menuitem.setAttribute("value", fonts[i]);
menuitem.setAttribute("label", fonts[i]);
popup.appendChild(menuitem);
}
}