Bug 710693 - Move internal encoding check into nsCharsetAlias. r=smontagu
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 24 May 2012 18:45:10 -0400
changeset 94906 8ead764172123d47f85c79f27c70e5736fd5c76f
parent 94905 4eaf67a7f50ff315939d5a8e71407a66928fb418
child 94907 dbf995d86990a8172176cbfd918da50f64d23ca2
push idunknown
push userunknown
push dateunknown
reviewerssmontagu
bugs710693
milestone15.0a1
Bug 710693 - Move internal encoding check into nsCharsetAlias. r=smontagu
gfx/thebes/gfxFontUtils.cpp
intl/build/Makefile.in
intl/build/nsI18nModule.cpp
intl/locale/public/nsCharsetAlias.h
intl/locale/src/Makefile.in
intl/locale/src/nsCharsetAlias.cpp
intl/uconv/idl/nsICharsetConverterManager.idl
intl/uconv/src/nsCharsetConverterManager.cpp
intl/uconv/src/nsCharsetConverterManager.h
intl/uconv/tests/unit/test_bug399284.js
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -1748,17 +1748,17 @@ gfxFontUtils::DecodeFontName(const PRUin
     nsCOMPtr<nsICharsetConverterManager> ccm =
         do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get charset converter manager");
     if (NS_FAILED(rv)) {
         return false;
     }
 
     nsCOMPtr<nsIUnicodeDecoder> decoder;
-    rv = ccm->GetUnicodeDecoderRawInternal(csName, getter_AddRefs(decoder));
+    rv = ccm->GetUnicodeDecoderRaw(csName, getter_AddRefs(decoder));
     if (NS_FAILED(rv)) {
         NS_WARNING("failed to get the decoder for a font name string");
         return false;
     }
 
     PRInt32 destLength;
     rv = decoder->GetMaxLength(reinterpret_cast<const char*>(aNameData), aByteLen, &destLength);
     if (NS_FAILED(rv)) {
--- a/intl/build/Makefile.in
+++ b/intl/build/Makefile.in
@@ -34,16 +34,17 @@ endif
 endif
 
 LOCAL_INCLUDES = \
 			-I$(srcdir)/../lwbrk/src \
 			-I$(srcdir)/../unicharutil/src \
 			-I$(srcdir)/../strres/src \
 			-I$(srcdir)/../locale/src \
 			-I$(srcdir)/../locale/src/$(LOCALE_DIR) \
+			-I$(srcdir)/../uconv/src \
 			$(NULL)
 
 SHARED_LIBRARY_LIBS = \
 			../lwbrk/src/$(LIB_PREFIX)lwbrk_s.$(LIB_SUFFIX) \
 			../unicharutil/src/$(LIB_PREFIX)ucharucomp_s.$(LIB_SUFFIX) \
 			../strres/src/$(LIB_PREFIX)strres_s.$(LIB_SUFFIX) \
 			../locale/src/$(LIB_PREFIX)nslocale_s.$(LIB_SUFFIX) \
 			../locale/src/$(LOCALE_DIR)/$(LIB_PREFIX)platlocale_s.$(LIB_SUFFIX) \
--- a/intl/build/nsI18nModule.cpp
+++ b/intl/build/nsI18nModule.cpp
@@ -23,16 +23,19 @@
 
 // string bundles (intl)
 #include "nsStringBundleService.h"
 #include "nsStringBundleTextOverride.h"
 
 // locale
 #include "nsLocaleConstructors.h"
 
+// uconv
+#include "nsCharsetConverterManager.h"
+
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSemanticUnitScanner)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init)
 
@@ -143,15 +146,25 @@ static const mozilla::Module::ContractID
 #ifdef XP_OS2
     { NS_OS2LOCALE_CONTRACTID, &kNS_OS2LOCALE_CID },
     { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
     { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
 #endif
     { NULL }
 };
 
+static void
+I18nModuleDtor()
+{
+    nsCharsetConverterManager::Shutdown();
+}
+
 static const mozilla::Module kIntlModule = {
     mozilla::Module::kVersion,
     kIntlCIDs,
     kIntlContracts,
+    NULL,
+    NULL,
+    NULL,
+    I18nModuleDtor
 };
 
 NSMODULE_DEFN(nsI18nModule) = &kIntlModule;
--- a/intl/locale/public/nsCharsetAlias.h
+++ b/intl/locale/public/nsCharsetAlias.h
@@ -4,16 +4,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsCharsetAlias_h___
 #define nsCharsetAlias_h___
 
 #include "nscore.h"
 #include "nsStringGlue.h"
 
+class nsCharsetConverterManager;
+
 class nsCharsetAlias
 {
+   friend class nsCharsetConverterManager;
+   static nsresult GetPreferredInternal(const nsACString& aAlias, nsACString& aResult);
 public:
    static nsresult GetPreferred(const nsACString& aAlias, nsACString& aResult);
    static nsresult Equals(const nsACString& aCharset1, const nsACString& aCharset2, bool* aResult);
 };
 
 #endif /* nsCharsetAlias_h___ */
--- a/intl/locale/src/Makefile.in
+++ b/intl/locale/src/Makefile.in
@@ -50,16 +50,20 @@ EXPORT_RESOURCE = \
 
 EXTRA_JS_MODULES = \
   PluralForm.jsm \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
+LOCAL_INCLUDES = \
+	-I$(topsrcdir)/intl/uconv/src \
+	$(NULL)
+
 include $(topsrcdir)/config/rules.mk
 
 nsCharsetAlias.$(OBJ_SUFFIX): charsetalias.properties.h
 
 charsetalias.properties.h: props2arrays.py charsetalias.properties
 	$(PYTHON) $^ $@
 
 GARBAGE += \
--- a/intl/locale/src/nsCharsetAlias.cpp
+++ b/intl/locale/src/nsCharsetAlias.cpp
@@ -3,16 +3,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Util.h"
 
 #include "nsCharsetAlias.h"
 #include "pratom.h"
 
+// for NS_ERROR_UCONV_NOCONV
+#include "nsEncoderDecoderUtils.h"
+#include "nsCharsetConverterManager.h"
+
 // for NS_IMPL_IDS only
 #include "nsIPlatformCharset.h"
 
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsUConvPropertySearch.h"
 
 using namespace mozilla;
@@ -20,26 +24,42 @@ using namespace mozilla;
 // 
 static const char* kAliases[][3] = {
 #include "charsetalias.properties.h"
 };
 
 //--------------------------------------------------------------
 // static
 nsresult
+nsCharsetAlias::GetPreferredInternal(const nsACString& aAlias,
+                                     nsACString& oResult)
+{
+   nsCAutoString key(aAlias);
+   ToLowerCase(key);
+
+   return nsUConvPropertySearch::SearchPropertyValue(kAliases,
+      ArrayLength(kAliases), key, oResult);
+}
+
+//--------------------------------------------------------------
+// static
+nsresult
 nsCharsetAlias::GetPreferred(const nsACString& aAlias,
                              nsACString& oResult)
 {
    if (aAlias.IsEmpty()) return NS_ERROR_NULL_POINTER;
 
-   nsCAutoString key(aAlias);
-   ToLowerCase(key);
+   nsresult res = GetPreferredInternal(aAlias, oResult);
+   if (NS_FAILED(res))
+      return res;
 
-   return nsUConvPropertySearch::SearchPropertyValue(kAliases,
-      ArrayLength(kAliases), key, oResult);
+   if (nsCharsetConverterManager::IsInternal(oResult))
+      return NS_ERROR_UCONV_NOCONV;
+
+   return res;
 }
 
 //--------------------------------------------------------------
 // static
 nsresult
 nsCharsetAlias::Equals(const nsACString& aCharset1,
                        const nsACString& aCharset2, bool* oResult)
 {
@@ -52,20 +72,20 @@ nsCharsetAlias::Equals(const nsACString&
 
    if(aCharset1.IsEmpty() || aCharset2.IsEmpty()) {
       *oResult = false;
       return res;
    }
 
    *oResult = false;
    nsCAutoString name1;
-   res = GetPreferred(aCharset1, name1);
+   res = GetPreferredInternal(aCharset1, name1);
    if (NS_FAILED(res))
      return res;
 
    nsCAutoString name2;
-   res = GetPreferred(aCharset2, name2);
+   res = GetPreferredInternal(aCharset2, name2);
    if (NS_FAILED(res))
      return res;
 
    *oResult = name1.Equals(name2);
    return NS_OK;
 }
--- a/intl/uconv/idl/nsICharsetConverterManager.idl
+++ b/intl/uconv/idl/nsICharsetConverterManager.idl
@@ -28,30 +28,26 @@ interface nsIUTF8StringEnumerator;
  *
  * Here Charsets are identified by ASCII strings. Charset alias
  * resolution is provided by default in most methods. "Raw"
  * versions that do not need this resolution are also provided.
  *
  * @created         21/Feb/2000
  * @author  Catalin Rotaru [CATA]
  */
-[scriptable, uuid(bf733b00-198f-4553-a061-637a21793330)]
+[scriptable, uuid(a0550d46-8d9c-47dd-acc7-c083620dff12)]
 interface nsICharsetConverterManager : nsISupports
 {
     /**
      * Get the Unicode decoder for the given charset.
      * The "Raw" version skips charset alias resolution
-     * The "Internal" version will return a decoder for any charset; the others
-     *  will return NS_ERROR_UCONV_NOCONV if the requested charsets is
-     *  vulnerable to XSS attacks and should not be used with untrusted input
      */
     [noscript] nsIUnicodeDecoder getUnicodeDecoder(in string charset);
     [noscript] nsIUnicodeDecoder getUnicodeDecoderRaw(in string charset);
     [noscript] nsIUnicodeDecoder getUnicodeDecoderInternal(in string charset);
-    [noscript] nsIUnicodeDecoder getUnicodeDecoderRawInternal(in string charset);
 
     /**
      * Get the Unicode encoder for the given charset.
      * The "Raw" version skips charset alias resolution
      */
     [noscript] nsIUnicodeEncoder getUnicodeEncoder(in string charset);
     [noscript] nsIUnicodeEncoder getUnicodeEncoderRaw(in string charset);
 
--- a/intl/uconv/src/nsCharsetConverterManager.cpp
+++ b/intl/uconv/src/nsCharsetConverterManager.cpp
@@ -22,76 +22,113 @@
 
 #include "nsXPCOM.h"
 #include "nsComponentManagerUtils.h"
 #include "nsISupportsPrimitives.h"
 
 // just for CONTRACTIDs
 #include "nsCharsetConverterManager.h"
 
+static nsIStringBundle * sDataBundle;
+static nsIStringBundle * sTitleBundle;
+
 // Class nsCharsetConverterManager [implementation]
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsCharsetConverterManager,
                               nsICharsetConverterManager)
 
 nsCharsetConverterManager::nsCharsetConverterManager() 
-  : mDataBundle(NULL)
-  , mTitleBundle(NULL)
 {
 }
 
 nsCharsetConverterManager::~nsCharsetConverterManager() 
 {
-  NS_IF_RELEASE(mDataBundle);
-  NS_IF_RELEASE(mTitleBundle);
 }
 
-nsresult nsCharsetConverterManager::LoadExtensibleBundle(
-                                    const char* aCategory, 
-                                    nsIStringBundle ** aResult)
+//static
+void nsCharsetConverterManager::Shutdown()
+{
+  NS_IF_RELEASE(sDataBundle);
+  NS_IF_RELEASE(sTitleBundle);
+}
+
+static
+nsresult LoadExtensibleBundle(const char* aCategory, 
+                              nsIStringBundle ** aResult)
 {
   nsCOMPtr<nsIStringBundleService> sbServ =
     mozilla::services::GetStringBundleService();
   if (!sbServ)
     return NS_ERROR_FAILURE;
 
   return sbServ->CreateExtensibleBundle(aCategory, aResult);
 }
 
-nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle, 
-                                                   const char * aName, 
-                                                   const nsAFlatString& aProp, 
-                                                   PRUnichar ** aResult)
+static
+nsresult GetBundleValue(nsIStringBundle * aBundle, 
+                        const char * aName, 
+                        const nsAFlatString& aProp, 
+                        PRUnichar ** aResult)
 {
   nsAutoString key; 
 
   key.AssignWithConversion(aName);
   ToLowerCase(key); // we lowercase the main comparison key
   key.Append(aProp);
 
   return aBundle->GetStringFromName(key.get(), aResult);
 }
 
-nsresult nsCharsetConverterManager::GetBundleValue(nsIStringBundle * aBundle, 
-                                                   const char * aName, 
-                                                   const nsAFlatString& aProp, 
-                                                   nsAString& aResult)
+static
+nsresult GetBundleValue(nsIStringBundle * aBundle, 
+                        const char * aName, 
+                        const nsAFlatString& aProp, 
+                        nsAString& aResult)
 {
   nsresult rv = NS_OK;
 
   nsXPIDLString value;
   rv = GetBundleValue(aBundle, aName, aProp, getter_Copies(value));
   if (NS_FAILED(rv))
     return rv;
 
   aResult = value;
 
   return NS_OK;
 }
 
+static
+nsresult GetCharsetDataImpl(const char * aCharset, const PRUnichar * aProp,
+                            nsAString& aResult)
+{
+  if (aCharset == NULL)
+    return NS_ERROR_NULL_POINTER;
+  // aProp can be NULL
+
+  if (sDataBundle == NULL) {
+    nsresult rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &sDataBundle);
+    if (NS_FAILED(rv))
+      return rv;
+  }
+
+  return GetBundleValue(sDataBundle, aCharset, nsDependentString(aProp), aResult);
+}
+
+//static
+bool nsCharsetConverterManager::IsInternal(const nsACString& aCharset)
+{
+  nsAutoString str;
+  // fully qualify to possibly avoid vtable call
+  nsresult rv = GetCharsetDataImpl(PromiseFlatCString(aCharset).get(),
+                                   NS_LITERAL_STRING(".isXSSVulnerable").get(),
+                                   str);
+
+  return NS_SUCCEEDED(rv);
+}
+
 
 //----------------------------------------------------------------------------//----------------------------------------------------------------------------
 // Interface nsICharsetConverterManager [implementation]
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetUnicodeEncoder(const char * aDest, 
                                              nsIUnicodeEncoder ** aResult)
 {
@@ -128,82 +165,70 @@ nsCharsetConverterManager::GetUnicodeEnc
   {
     *aResult = encoder.get();
     NS_ADDREF(*aResult);
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsCharsetConverterManager::GetUnicodeDecoderRaw(const char * aSrc,
-                                                nsIUnicodeDecoder ** aResult)
-{
-  nsresult rv;
-
-  nsAutoString str;
-  rv = GetCharsetData(aSrc, NS_LITERAL_STRING(".isXSSVulnerable").get(), str);
-  if (NS_SUCCEEDED(rv))
-    return NS_ERROR_UCONV_NOCONV;
-
-  return GetUnicodeDecoderRawInternal(aSrc, aResult);
-}
-
-NS_IMETHODIMP
 nsCharsetConverterManager::GetUnicodeDecoder(const char * aSrc, 
                                              nsIUnicodeDecoder ** aResult)
 {
   // resolve the charset first
   nsCAutoString charset;
-  
+
   // fully qualify to possibly avoid vtable call
-  nsCharsetConverterManager::GetCharsetAlias(aSrc, charset);
+  nsresult rv = nsCharsetConverterManager::GetCharsetAlias(aSrc, charset);
+  if (NS_FAILED(rv))
+    return rv;
 
   return nsCharsetConverterManager::GetUnicodeDecoderRaw(charset.get(),
                                                          aResult);
 }
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetUnicodeDecoderInternal(const char * aSrc, 
                                                      nsIUnicodeDecoder ** aResult)
 {
   // resolve the charset first
   nsCAutoString charset;
-  
-  // fully qualify to possibly avoid vtable call
-  nsresult rv = nsCharsetConverterManager::GetCharsetAlias(aSrc, charset);
+
+  nsresult rv = nsCharsetAlias::GetPreferredInternal(nsDependentCString(aSrc),
+                                                     charset);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return nsCharsetConverterManager::GetUnicodeDecoderRawInternal(charset.get(),
-                                                                 aResult);
+  return nsCharsetConverterManager::GetUnicodeDecoderRaw(charset.get(),
+                                                         aResult);
 }
 
 NS_IMETHODIMP
-nsCharsetConverterManager::GetUnicodeDecoderRawInternal(const char * aSrc, 
-                                                        nsIUnicodeDecoder ** aResult)
+nsCharsetConverterManager::GetUnicodeDecoderRaw(const char * aSrc, 
+                                                nsIUnicodeDecoder ** aResult)
 {
   *aResult= nsnull;
   nsCOMPtr<nsIUnicodeDecoder> decoder;
 
   nsresult rv = NS_OK;
 
   NS_NAMED_LITERAL_CSTRING(contractbase, NS_UNICODEDECODER_CONTRACTID_BASE);
   nsDependentCString src(aSrc);
-  
+
   decoder = do_CreateInstance(PromiseFlatCString(contractbase + src).get(),
                               &rv);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_UCONV_NOCONV);
 
   decoder.forget(aResult);
   return rv;
 }
 
-nsresult 
-nsCharsetConverterManager::GetList(const nsACString& aCategory,
-                                   const nsACString& aPrefix,
-                                   nsIUTF8StringEnumerator** aResult)
+static
+nsresult GetList(const nsACString& aCategory,
+                 const nsACString& aPrefix,
+                 nsIUTF8StringEnumerator** aResult)
 {
   if (aResult == NULL) 
     return NS_ERROR_NULL_POINTER;
   *aResult = NULL;
 
   nsresult rv;
 
   nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
@@ -284,40 +309,30 @@ nsCharsetConverterManager::GetCharsetAli
 
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetCharsetTitle(const char * aCharset, 
                                            nsAString& aResult)
 {
   NS_ENSURE_ARG_POINTER(aCharset);
 
-  if (mTitleBundle == NULL) {
-    nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &mTitleBundle);
+  if (sTitleBundle == NULL) {
+    nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &sTitleBundle);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  return GetBundleValue(mTitleBundle, aCharset, NS_LITERAL_STRING(".title"), aResult);
+  return GetBundleValue(sTitleBundle, aCharset, NS_LITERAL_STRING(".title"), aResult);
 }
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetCharsetData(const char * aCharset, 
                                           const PRUnichar * aProp,
                                           nsAString& aResult)
 {
-  if (aCharset == NULL)
-    return NS_ERROR_NULL_POINTER;
-  // aProp can be NULL
-
-  if (mDataBundle == NULL) {
-    nsresult rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &mDataBundle);
-    if (NS_FAILED(rv))
-      return rv;
-  }
-
-  return GetBundleValue(mDataBundle, aCharset, nsDependentString(aProp), aResult);
+  return GetCharsetDataImpl(aCharset, aProp, aResult);
 }
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetCharsetLangGroup(const char * aCharset, 
                                                nsIAtom** aResult)
 {
   // resolve the charset first
   nsCAutoString charset;
@@ -331,29 +346,20 @@ nsCharsetConverterManager::GetCharsetLan
 }
 
 NS_IMETHODIMP
 nsCharsetConverterManager::GetCharsetLangGroupRaw(const char * aCharset, 
                                                   nsIAtom** aResult)
 {
 
   *aResult = nsnull;
-  if (aCharset == NULL)
-    return NS_ERROR_NULL_POINTER;
-
-  nsresult rv = NS_OK;
-
-  if (mDataBundle == NULL) {
-    rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &mDataBundle);
-    if (NS_FAILED(rv))
-      return rv;
-  }
-
   nsAutoString langGroup;
-  rv = GetBundleValue(mDataBundle, aCharset, NS_LITERAL_STRING(".LangGroup"), langGroup);
+  // fully qualify to possibly avoid vtable call
+  nsresult rv = nsCharsetConverterManager::GetCharsetData(
+      aCharset, NS_LITERAL_STRING(".LangGroup").get(), langGroup);
 
   if (NS_SUCCEEDED(rv)) {
     ToLowerCase(langGroup); // use lowercase for all language atoms
     *aResult = NS_NewAtom(langGroup);
   }
 
   return rv;
 }
--- a/intl/uconv/src/nsCharsetConverterManager.h
+++ b/intl/uconv/src/nsCharsetConverterManager.h
@@ -6,41 +6,31 @@
 #define nsCharsetConverterManager_h__
 
 #include "nsISupports.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIStringBundle.h"
 #include "nsInterfaceHashtable.h"
 #include "mozilla/Mutex.h"
 
+class nsCharsetAlias;
+
 class nsCharsetConverterManager : public nsICharsetConverterManager
 {
+  friend class nsCharsetAlias;
+
   NS_DECL_ISUPPORTS
   NS_DECL_NSICHARSETCONVERTERMANAGER
 
 public:
-
   nsCharsetConverterManager();
   virtual ~nsCharsetConverterManager();
 
+  static void Shutdown();
+
 private:
 
-  nsIStringBundle * mDataBundle;
-  nsIStringBundle * mTitleBundle;
-
-  nsresult LoadExtensibleBundle(const char * aRegistryKey, 
-      nsIStringBundle ** aResult);
-
-  nsresult GetBundleValue(nsIStringBundle * aBundle,
-                          const char * aName, 
-                          const nsAFlatString& aProp, PRUnichar ** aResult);
-  nsresult GetBundleValue(nsIStringBundle * aBundle,
-                          const char * aName, 
-                          const nsAFlatString& aProp, nsAString& aResult);
-
-  nsresult GetList(const nsACString& aCategory,
-                   const nsACString& aPrefix,
-                   nsIUTF8StringEnumerator** aResult);
+  static bool IsInternal(const nsACString& aCharset);
 };
 
 #endif // nsCharsetConverterManager_h__
 
 
--- a/intl/uconv/tests/unit/test_bug399284.js
+++ b/intl/uconv/tests/unit/test_bug399284.js
@@ -4,17 +4,17 @@ function run_test()
     var ccManager =
 	Components.classes["@mozilla.org/charset-converter-manager;1"]
 	.getService(Components.interfaces.nsICharsetConverterManager);
 
     var decoderList = ccManager.getDecoderList();
     while (decoderList.hasMore()) {
 	var decoder = decoderList.getNext();
 	try {
-	    var langGroup = ccManager.getCharsetLangGroup(decoder);
+	    var langGroup = ccManager.getCharsetLangGroupRaw(decoder);
 	} catch(e) {
 	    dump("no langGroup for " + decoder + "\n");
 	    failures = true;
 	}
     }
     if (failures) {
 	do_throw("missing langGroups");
     }