Bug 735398 - Make tabs in Attachment pane in Preferences dialog persist last selected tab. r=bienvenu.
authorMike Conley <mconley@mozilla.com>
Tue, 13 Mar 2012 16:39:23 -0400
changeset 11099 a4020ebe7917e8685777ee2a1712aef1ac6789c3
parent 11098 1c3e03827e862a18c1e740d786ee481a9b65c642
child 11100 3eea95c4774822f87037945ef591ce68a229667e
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs735398
Bug 735398 - Make tabs in Attachment pane in Preferences dialog persist last selected tab. r=bienvenu.
mail/components/preferences/applications.js
mail/test/mozmill/pref-window/test-attachments-pane.js
--- a/mail/components/preferences/applications.js
+++ b/mail/components/preferences/applications.js
@@ -469,17 +469,17 @@ var gApplicationsTabController = {
       tabs.hidden = true;
       this.mInitialized = true;
       return;
     }
 
     gCloudFileTab.init();
 
     let preference = document.getElementById("mail.preferences.applications.selectedTabIndex");
-    tabbox.selectedIndex = preference.value ? preference.value : this.mDefaultIndex;
+    tabbox.selectedIndex = preference.value != null ? preference.value : this.mDefaultIndex;
 
     this.mInitialized = true;
   },
 
   tabSelectionChanged: function() {
     if (this.mInitialized)
       document.getElementById("mail.preferences.applications.selectedTabIndex")
               .valueFromPreferences = document.getElementById("attachmentPrefs")
--- a/mail/test/mozmill/pref-window/test-attachments-pane.js
+++ b/mail/test/mozmill/pref-window/test-attachments-pane.js
@@ -1,11 +1,11 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
-  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Tests the manager for attachment storage services
  */
 
 let Cu = Components.utils;
 let Cc = Components.classes;
 let Ci = Components.interfaces;
@@ -32,40 +32,41 @@ function setupModule(module) {
  * Test that if we come back to the Attachment pane, then
  * we'll automatically be viewing the same tab we were viewing
  * last time.
  */
 function test_persist_tabs() {
   open_pref_window("paneApplications", function(w) {
     let tabbox = w.e("attachmentPrefs");
 
+    // We should default to be viewing the "Outgoing" tab, which is the
+    // second tab, with index 1.
+    assert_equals(1, tabbox.selectedIndex,
+                  "The second tab should have been selected");
+    // Switch to the first tab
+    tabbox.selectedIndex = 0;
+    close_window(w);
+  });
+
+  open_pref_window("paneApplications", function(w) {
+    let tabbox = w.e("attachmentPrefs");
+
     // We should default to be viewing the first tab
+    // now
     assert_equals(0, tabbox.selectedIndex,
-                  "The first tab should have been selected");
-    // Switch to the second tab
+                  "The first tab selection should have been "
+                  + "persisted");
+    // Switch back to the second tab
     tabbox.selectedIndex = 1;
     close_window(w);
   });
 
   open_pref_window("paneApplications", function(w) {
     let tabbox = w.e("attachmentPrefs");
 
     // We should default to be viewing the second tab
-    // now
     assert_equals(1, tabbox.selectedIndex,
                   "The second tab selection should have been "
                   + "persisted");
-    // Switch back to the first tab
-    tabbox.selectedIndex = 0;
-    close_window(w);
-  });
-
-  open_pref_window("paneApplications", function(w) {
-    let tabbox = w.e("attachmentPrefs");
-
-    // We should default to be viewing the first tab
-    assert_equals(0, tabbox.selectedIndex,
-                  "The first tab selection should have been "
-                  + "persisted");
     close_window(w);
   });
 
 }