Bug 592252 - Restart is required when pressing the down arrow in localization and autodetect is selected already [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Wed, 13 Oct 2010 09:44:31 -0400
changeset 66825 26f36479834386b00a338b004bfcf086f5c68941
parent 66824 663364184127782323b1ae6778df34051d42ba72
child 66826 5723ff8c20534d3c008d8a6e4b5419cd328810fe
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs592252
Bug 592252 - Restart is required when pressing the down arrow in localization and autodetect is selected already [r=mbrubeck]
mobile/chrome/content/bindings.xml
mobile/chrome/content/preferences.js
--- a/mobile/chrome/content/bindings.xml
+++ b/mobile/chrome/content/bindings.xml
@@ -1488,16 +1488,25 @@
         <![CDATA[
           if (this.disabled || this.itemCount == 0)
             return;
 
           this.focus();
           MenuListHelperUI.show(this);
         ]]>
       </handler>
+
+      <handler event="command" phase="capturing">
+        <![CDATA[
+          // The dropmark (button) fires a command event too. Don't forward that.
+          // Just forward the menuitem command events, which the toolkit version does.
+          if (event.target.parentNode.parentNode != this)
+            event.stopPropagation();
+        ]]>
+      </handler>
     </handlers>
   </binding>
 
   <binding id="chrome-select-option">
     <content orient="horizontal" flex="1">
       <xul:image class="chrome-select-option-image" anonid="check"/>
       <xul:label anonid="label" xbl:inherits="value=label"/>
     </content>
--- a/mobile/chrome/content/preferences.js
+++ b/mobile/chrome/content/preferences.js
@@ -154,31 +154,33 @@ var PreferencesView = {
     // Are we using auto-detection?
     let autoDetect = false;
     try {
       autoDetect = Services.prefs.getBoolPref("intl.locale.matchOS");
     }
     catch (e) {}
     
     // Highlight current locale (or auto-detect entry)
-    if (autoDetect)
+    if (autoDetect) {
       this._languages.selectedItem = document.getElementById("prefs-languages-auto");
-    else
+      this._currentLocale = "auto";
+    } else {
       this._languages.selectedItem = selectedItem;
+    }
     
     // Hide the setting if we only have one locale
     if (localeCount == 1)
       document.getElementById("prefs-uilanguage").hidden = true;
   },
   
   updateLocale: function updateLocale() {
     // Which locale did the user select?
     let newLocale = this._languages.selectedItem.value;
     let prefs = Services.prefs;
-    
+
     if (newLocale == "auto") {
       if (prefs.prefHasUserValue("general.useragent.locale"))
         prefs.clearUserPref("general.useragent.locale");
       prefs.setBoolPref("intl.locale.matchOS", true);
     } else {
       prefs.setBoolPref("intl.locale.matchOS", false);
       prefs.setCharPref("general.useragent.locale", newLocale);
     }