Bug 1557905 - C-C part: Adapt to array changes of nsIFontEnumerator.Enumerate{All}Fonts. r=jorgk
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 07 Jun 2019 22:05:00 +0200
changeset 35809 648f20570c30aee87d3746ad7319835d7974d5b8
parent 35808 d81765c682d0508cf305ed3cccd5c3a033cd46b2
child 35810 62dc416dcabffecc6be166b4aca777ed2d2ef533
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersjorgk
bugs1557905
Bug 1557905 - C-C part: Adapt to array changes of nsIFontEnumerator.Enumerate{All}Fonts. r=jorgk
editor/ui/composer/content/editor.js
mail/base/test/unit/test_windows_font_migration.js
mail/components/preferences/compose.js
suite/components/pref/content/pref-fonts.js
suite/mailnews/components/compose/content/prefs/pref-composing_messages.js
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -951,18 +951,17 @@ function initFontFaceMenu(menuPopup) {
 const kFixedFontFaceMenuItems = 8;
 
 function initLocalFontFaceMenu(menuPopup) {
   if (!gLocalFonts) {
     // Build list of all local fonts once per editor
     try {
       var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                          .getService(Ci.nsIFontEnumerator);
-      var localFontCount = { value: 0 };
-      gLocalFonts = enumerator.EnumerateAllFonts(localFontCount);
+      gLocalFonts = enumerator.EnumerateAllFonts();
     } catch (e) {}
   }
 
   // Don't use radios for menulists.
   let useRadioMenuitems = (menuPopup.parentNode.localName == "menu");
   menuPopup.setAttribute("useRadios", useRadioMenuitems);
   if (menuPopup.childNodes.length == kFixedFontFaceMenuItems) {
     if (gLocalFonts.length == 0) {
--- a/mail/base/test/unit/test_windows_font_migration.js
+++ b/mail/base/test/unit/test_windows_font_migration.js
@@ -37,17 +37,17 @@ function makeVerifier(aFonts) {
   function getFont(aFontType, aEncoding) {
     var font = Services.prefs.getCharPref("font.name." + aFontType + "." + aEncoding);
     if (font)
       return font;
 
     // Get the default.
     var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                        .createInstance(Ci.nsIFontEnumerator);
-    var fonts = enumerator.EnumerateFonts(aEncoding, aFontType, {});
+    var fonts = enumerator.EnumerateFonts(aEncoding, aFontType);
     var defaultFont = null;
     if (fonts.length > 0)
       defaultFont = enumerator.getDefaultFont(aEncoding, aFontType);
     return defaultFont;
   }
 
   function verifier(aEncoding, aNonDefaultFonts) {
     if (!aNonDefaultFonts)
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -215,18 +215,17 @@ var gComposePane = {
     languageMenuList.setInitialSelection();
   },
 
   populateFonts() {
     var fontsList = document.getElementById("FontSelect");
     try {
       var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                          .getService(Ci.nsIFontEnumerator);
-      var localFontCount = { value: 0 };
-      var localFonts = enumerator.EnumerateAllFonts(localFontCount);
+      var localFonts = enumerator.EnumerateAllFonts();
       for (let i = 0; i < localFonts.length; ++i) {
         // Remove Linux system generic fonts that collide with CSS generic fonts.
         if (localFonts[i] != "" && localFonts[i] != "serif" &&
             localFonts[i] != "sans-serif" && localFonts[i] != "monospace")
           fontsList.appendItem(localFonts[i], localFonts[i]);
       }
     } catch (e) { }
     // Choose the item after the list is completely generated.
--- a/suite/components/pref/content/pref-fonts.js
+++ b/suite/components/pref/content/pref-fonts.js
@@ -16,30 +16,30 @@ function GetFontEnumerator()
   }
   return gFontEnumerator;
 }
 
 function BuildFontList(aLanguage, aFontType, aMenuList, aPreference)
 {
   var defaultFont = null;
   // Load Font Lists
-  var fonts = GetFontEnumerator().EnumerateFonts(aLanguage, aFontType, {});
+  var fonts = GetFontEnumerator().EnumerateFonts(aLanguage, aFontType);
   if (fonts.length)
   {
     defaultFont = GetFontEnumerator().getDefaultFont(aLanguage, aFontType);
   }
   else
   {
-    fonts = GetFontEnumerator().EnumerateFonts(aLanguage, "", {});
+    fonts = GetFontEnumerator().EnumerateFonts(aLanguage, "");
     if (fonts.length)
       defaultFont = GetFontEnumerator().getDefaultFont(aLanguage, "");
   }
 
   if (!gAllFonts)
-    gAllFonts = GetFontEnumerator().EnumerateAllFonts({});
+    gAllFonts = GetFontEnumerator().EnumerateAllFonts();
 
   // Reset the list
   while (aMenuList.hasChildNodes())
     aMenuList.lastChild.remove();
 
   // Build the UI for the Default Font and Fonts for this CSS type.
   var popup = document.createElement("menupopup");
   var separator;
--- a/suite/mailnews/components/compose/content/prefs/pref-composing_messages.js
+++ b/suite/mailnews/components/compose/content/prefs/pref-composing_messages.js
@@ -12,18 +12,17 @@ function EnableMailComposeAutosaveInterv
   EnableElementById("autoSaveInterval", aValue, focus);
 }
 
 function PopulateFonts() {
   var fontsList = document.getElementById("fontSelect");
   try {
     var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                        .getService(Ci.nsIFontEnumerator);
-    var localFontCount = { value: 0 }
-    var localFonts = enumerator.EnumerateAllFonts(localFontCount);
+    var localFonts = enumerator.EnumerateAllFonts();
     for (let font of localFonts)
       if (font != "serif" && font != "sans-serif" && font != "monospace")
         fontsList.appendItem(font, font);
   } catch (ex) { }
 
   // Select the item after the list is completely generated.
   document.getElementById(fontsList.getAttribute("preference"))
           .setElementValue(fontsList);