Bug 1130246 - Treat general.useragent.locale as a localized pref in DirectoryProvider. r=rnewman
authorMike Connor <mconnor@mozilla.com>
Thu, 05 Feb 2015 20:46:01 -0800
changeset 227773 e0e812319eaeca663f61fa8cac50ce58e7c6d68a
parent 227772 00a4e75da857b51978751099679ceb4f9984226f
child 227774 946346db74bb3216ac5fa472d34f97706e75e218
push id28239
push userryanvm@gmail.com
push dateFri, 06 Feb 2015 13:52:40 +0000
treeherdermozilla-central@03b0004eba32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1130246
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1130246 - Treat general.useragent.locale as a localized pref in DirectoryProvider. r=rnewman
mobile/android/components/DirectoryProvider.js
--- a/mobile/android/components/DirectoryProvider.js
+++ b/mobile/android/components/DirectoryProvider.js
@@ -115,22 +115,33 @@ DirectoryProvider.prototype = {
     if (commonPlugins.exists())
       array.push(commonPlugins);
 
     let localePlugins = searchPlugins.clone();
     localePlugins.append("locale");
     if (!localePlugins.exists())
       return;
 
-    let curLocale = Services.prefs.getCharPref("general.useragent.locale");
-    let curLocalePlugins = localePlugins.clone();
-    curLocalePlugins.append(curLocale);
-    if (curLocalePlugins.exists()) {
-      array.push(curLocalePlugins);
-      return;
+    let curLocale = "";
+    try {
+      curLocale = Services.prefs.getComplexValue("general.useragent.locale", Ci.nsIPrefLocalizedString).data;
+    } catch (e) {
+      try {
+        curLocale = Services.prefs.getCharPref("general.useragent.locale");
+      } catch (ee) {
+      }
+    }
+
+    if (curLocale) {
+      let curLocalePlugins = localePlugins.clone();
+      curLocalePlugins.append(curLocale);
+      if (curLocalePlugins.exists()) {
+        array.push(curLocalePlugins);
+        return;
+      }
     }
 
     // We didn't append the locale dir - try the default one.
     let defLocale = Services.prefs.getCharPref("distribution.searchplugins.defaultLocale");
     let defLocalePlugins = localePlugins.clone();
     if (defLocalePlugins.exists())
       array.push(defLocalePlugins);
   },