Bug 1016038 - languagechange is emitted twice for each language change. r=vingtetun
authorStaś Małolepszy <stas@mozilla.com>
Mon, 26 May 2014 11:26:00 -0400
changeset 204502 450492b8afb866eeeb760b25e0bc7a3a5e611331
parent 204501 8331da4219d87d9eb90cb54a7fad608c0e47562b
child 204503 635f500c32d618f4d8de122e8761e8a18a983313
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs1016038
milestone32.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 1016038 - languagechange is emitted twice for each language change. r=vingtetun
b2g/chrome/content/settings.js
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -73,24 +73,22 @@ SettingsListener.observe('debug.console.
   Services.prefs.setBoolPref('layout.css.report_errors', value);
 });
 
 // =================== Languages ====================
 SettingsListener.observe('language.current', 'en-US', function(value) {
   Services.prefs.setCharPref('general.useragent.locale', value);
 
   let prefName = 'intl.accept_languages';
-  if (Services.prefs.prefHasUserValue(prefName)) {
-    Services.prefs.clearUserPref(prefName);
-  }
+  let defaultBranch = Services.prefs.getDefaultBranch(null);
 
   let intl = '';
   try {
-    intl = Services.prefs.getComplexValue(prefName,
-                                          Ci.nsIPrefLocalizedString).data;
+    intl = defaultBranch.getComplexValue(prefName,
+                                         Ci.nsIPrefLocalizedString).data;
   } catch(e) {}
 
   // Bug 830782 - Homescreen is in English instead of selected locale after
   // the first run experience.
   // In order to ensure the current intl value is reflected on the child
   // process let's always write a user value, even if this one match the
   // current localized pref value.
   if (!((new RegExp('^' + value + '[^a-z-_] *[,;]?', 'i')).test(intl))) {