Bug 1374093 - Port bug 1369025 to C-C [Remove mozilla::dom::EncodingUtils]. r=bustage-fix
authorJorg K <jorgk@jorgk.com>
Mon, 19 Jun 2017 00:03:32 +0200
changeset 28361 978085bf1e8265c57b70b9ebcefcba19f082c6b8
parent 28360 a2a5296a88089da072a381f163ea78cc3ad89bc8
child 28362 484beb60833c61561f1c447b972e7d4f55e52633
push id1986
push userclokep@gmail.com
push dateWed, 02 Aug 2017 14:43:31 +0000
treeherdercomm-beta@b51c9adf2c9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1374093, 1369025
Bug 1374093 - Port bug 1369025 to C-C [Remove mozilla::dom::EncodingUtils]. r=bustage-fix
mailnews/intl/nsCharsetAlias.cpp
--- a/mailnews/intl/nsCharsetAlias.cpp
+++ b/mailnews/intl/nsCharsetAlias.cpp
@@ -1,49 +1,52 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/ArrayUtils.h"
-#include "mozilla/dom/EncodingUtils.h"
+#include "mozilla/Encoding.h"
 
 #include "nsCharsetAlias.h"
 
 // for NS_ERROR_UCONV_NOCONV
 #include "nsCharsetConverterManager.h"
 
 #include "nsUConvPropertySearch.h"
 
 using namespace mozilla;
-using namespace mozilla::dom;
 
 //
 static const nsUConvProp kAliases[] = {
 #include "charsetalias.properties.h"
 };
 
 //--------------------------------------------------------------
 // static
 nsresult
 nsCharsetAlias::GetPreferredInternal(const nsACString& aAlias,
                                      nsACString& oResult)
 {
    // First check charsetalias.properties and if there is no match, continue to
-   // call EncodingUtils::FindEncodingForLabel.
+   // call Encoding::ForLabel.
    nsAutoCString key(aAlias);
    ToLowerCase(key);
 
    nsresult rv = nsUConvPropertySearch::SearchPropertyValue(kAliases,
       ArrayLength(kAliases), key, oResult);
    if (NS_SUCCEEDED(rv)) {
      return NS_OK;
    }
-   return EncodingUtils::FindEncodingForLabel(key, oResult) ?
-      NS_OK: NS_ERROR_NOT_AVAILABLE;
+
+   const Encoding* encoding = Encoding::ForLabel(key);
+   if (!encoding)
+     return NS_ERROR_NOT_AVAILABLE;
+   encoding->Name(oResult);
+   return NS_OK;
 }
 
 //--------------------------------------------------------------
 // static
 nsresult
 nsCharsetAlias::GetPreferred(const nsACString& aAlias,
                              nsACString& oResult)
 {