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 draft
authorJared Wein <jwein@mozilla.com>
Thu, 26 Oct 2017 12:25:12 -0400
changeset 687543 60e483484fcfeace416ae01370c5fee99923b168
parent 686801 0d1e55d87931fe70ec1d007e886bcd58015ff770
child 687544 c95ef136415678f93bd5afeac26858770030ec80
push id86529
push userbmo:jaws@mozilla.com
push dateFri, 27 Oct 2017 10:52:01 +0000
reviewerstimdream
bugs1378366
milestone58.0a1
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
browser/locales/en-US/chrome/browser/preferences/preferences.properties
toolkit/mozapps/preferences/fontbuilder.js
--- 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);
       }
     }