Bug 423366: remove unused code, and non-obvious dependency on fontbuilder.js from preferences.xml, r=mconnor/masayuki, a=beltzner
authorgavin@gavinsharp.com
Tue, 18 Mar 2008 11:32:23 -0700
changeset 13242 d9398327d7dbb077651c928ef849be01bc8284ba
parent 13241 a6bdfd0ce42d0a636c55b7fd13cd2efbe3a722e3
child 13243 85d136c46a3f4ec11beec876c0b3dd8b62faaf89
push idunknown
push userunknown
push dateunknown
reviewersmconnor, masayuki, beltzner
bugs423366
milestone1.9b5pre
Bug 423366: remove unused code, and non-obvious dependency on fontbuilder.js from preferences.xml, r=mconnor/masayuki, a=beltzner
toolkit/content/widgets/preferences.xml
toolkit/mozapps/preferences/fontbuilder.js
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -292,17 +292,19 @@
             case "unichar":
               return this._branch
                          .getComplexValue(this.name, Components.interfaces.nsISupportsString)
                          .data;
             case "fontname":
               var family = this._branch
                                .getComplexValue(this.name, Components.interfaces.nsISupportsString)
                                .data;
-              return FontBuilder.enumerator.getStandardFamilyName(family);
+              var fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
+                                             .createInstance(Components.interfaces.nsIFontEnumerator);
+              return fontEnumerator.getStandardFamilyName(family);
             case "file":
               var f = this._branch
                           .getComplexValue(this.name, Components.interfaces.nsILocalFile);
               return f;
             default:
               this._reportUnknownType();
             }
           }
--- a/toolkit/mozapps/preferences/fontbuilder.js
+++ b/toolkit/mozapps/preferences/fontbuilder.js
@@ -111,23 +111,10 @@ var FontBuilder = {
         }
         else {
           builtItem = builtItem.nextSibling;
           builtItemValue = builtItem ? builtItem.getAttribute("value") : null;
         }
       }
     }
     aMenuList.appendChild(popup);    
-  },
-
-  getStandardFamilyName: function (aName) 
-  {
-    // XXX should return empty string on failure?
-    try {
-      var family = this.enumerator.getStandardFamilyName(aName);
-      if (!family)
-        return aName;
-      return family;
-    } catch (e) {
-      return aName;
-    }
   }
 };