Bug 1617371 - Remove callers to GetSelectedLocale. r=mkmelin
authorKai Engert <kaie@kuix.de>
Sat, 22 Feb 2020 14:24:39 +0100
changeset 37409 f141b2e4803fa87657179edce4e25e52ad684f07
parent 37408 6a1d2bed20be027aa69a482bb641f7696aaf8f42
child 37410 95dc8118d884b1704f06ffa6892e9749820eb7eb
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1617371
Bug 1617371 - Remove callers to GetSelectedLocale. r=mkmelin
mailnews/base/src/nsMailDirProvider.cpp
mailnews/base/src/nsMailDirProvider.h
mailnews/base/src/nsMsgMailSession.cpp
--- a/mailnews/base/src/nsMailDirProvider.cpp
+++ b/mailnews/base/src/nsMailDirProvider.cpp
@@ -138,37 +138,23 @@ nsMailDirProvider::AppendingEnumerator::
 
     nextbase->Clone(getter_AddRefs(mNext));
     if (!mNext) continue;
 
     mNext->AppendNative(NS_LITERAL_CSTRING("isp"));
     bool exists;
     nsresult rv = mNext->Exists(&exists);
     if (NS_SUCCEEDED(rv) && exists) {
-      if (!mLocale.IsEmpty()) {
-        mNext->Clone(getter_AddRefs(mNextWithLocale));
-        mNextWithLocale->AppendNative(mLocale);
-        rv = mNextWithLocale->Exists(&exists);
-        if (NS_FAILED(rv) || !exists) {
-          // Clear out mNextWithLocale, so we don't try to iterate over it.
-          mNextWithLocale = nullptr;
-        }
-      }
       break;
     }
 
     mNext = nullptr;
   }
 
   return NS_OK;
 }
 
 nsMailDirProvider::AppendingEnumerator::AppendingEnumerator(
     nsISimpleEnumerator *aBase)
     : mBase(aBase) {
-  nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
-      mozilla::services::GetXULChromeRegistryService();
-  if (packageRegistry)
-    packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"), false,
-                                       mLocale);
   // Initialize mNext to begin
   GetNext(nullptr);
 }
--- a/mailnews/base/src/nsMailDirProvider.h
+++ b/mailnews/base/src/nsMailDirProvider.h
@@ -31,13 +31,12 @@ class nsMailDirProvider final : public n
 
     explicit AppendingEnumerator(nsISimpleEnumerator* aBase);
 
    private:
     ~AppendingEnumerator() override = default;
     nsCOMPtr<nsISimpleEnumerator> mBase;
     nsCOMPtr<nsIFile> mNext;
     nsCOMPtr<nsIFile> mNextWithLocale;
-    nsCString mLocale;
   };
 };
 
 #endif  // nsMailDirProvider_h__
--- a/mailnews/base/src/nsMsgMailSession.cpp
+++ b/mailnews/base/src/nsMsgMailSession.cpp
@@ -367,49 +367,16 @@ nsMsgMailSession::ConvertMsgURIToMsgURL(
 //-------------------------------------------------------------------------
 // GetSelectedLocaleDataDir - If a locale is selected, appends the selected
 //                            locale to the defaults data dir and returns
 //                            that new defaults data dir
 //-------------------------------------------------------------------------
 nsresult nsMsgMailSession::GetSelectedLocaleDataDir(nsIFile *defaultsDir) {
   NS_ENSURE_ARG_POINTER(defaultsDir);
 
-  bool baseDirExists = false;
-  nsresult rv = defaultsDir->Exists(&baseDirExists);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (baseDirExists) {
-    nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
-        mozilla::services::GetXULChromeRegistryService();
-    if (packageRegistry) {
-      nsAutoCString localeName;
-      rv = packageRegistry->GetSelectedLocale(
-          NS_LITERAL_CSTRING("global-region"), false, localeName);
-
-      if (NS_SUCCEEDED(rv) && !localeName.IsEmpty()) {
-        bool localeDirExists = false;
-        nsCOMPtr<nsIFile> localeDataDir;
-
-        rv = defaultsDir->Clone(getter_AddRefs(localeDataDir));
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        rv = localeDataDir->AppendNative(localeName);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        rv = localeDataDir->Exists(&localeDirExists);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (localeDirExists) {
-          // use locale provider instead
-          rv = defaultsDir->AppendNative(localeName);
-          NS_ENSURE_SUCCESS(rv, rv);
-        }
-      }
-    }
-  }
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // GetDataFilesDir - Gets the application's default folder and then appends the
 //                   subdirectory named passed in as param dirName. If there is
 //                   a selected locale, will append that to the dir path before
 //                   returning the value