Bug 1130246 - Treat general.useragent.locale as a localized pref in DirectoryProvider. r=rnewman a=sylvestre
authorMike Connor <mconnor@mozilla.com>
Thu, 05 Feb 2015 20:46:01 -0800
changeset 243710 581876946dcf2741db3adaa290f7f7da1e086951
parent 243709 222d4a9f7ed399ff00175c572529fd2789e4afb8
child 243711 6f3775d5c83900af6a39b611f16e53bf97ac559a
push id4448
push usermfinkle@mozilla.com
push dateMon, 09 Feb 2015 15:31:36 +0000
treeherdermozilla-beta@581876946dcf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, sylvestre
bugs1130246
milestone36.0
Bug 1130246 - Treat general.useragent.locale as a localized pref in DirectoryProvider. r=rnewman a=sylvestre
mobile/android/components/DirectoryProvider.js
--- a/mobile/android/components/DirectoryProvider.js
+++ b/mobile/android/components/DirectoryProvider.js
@@ -116,22 +116,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);
   },