Bug 804091 - force firing of 'onchange' events when leaving an Account manager pane. r=Neil, r=mconley, a=Standard8
authoraceman <acelists@atlas.sk>
Wed, 13 Feb 2013 11:39:09 +0000
changeset 13631 dcc1993f148f5ae761ae3ef570fcfb45bc9a7656
parent 13623 48a7e6a5f7549416a43ba949086fe1cecb25d14b
child 13632 66f7060807f04653b2aea4226de0c12252def41b
push id38
push userbugzilla@standard8.plus.com
push dateWed, 13 Feb 2013 11:39:17 +0000
reviewersNeil, mconley, Standard8
bugs804091
Bug 804091 - force firing of 'onchange' events when leaving an Account manager pane. r=Neil, r=mconley, a=Standard8
mailnews/base/prefs/content/AccountManager.js
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -729,16 +729,23 @@ function onAccountTreeSelect(pageId, acc
   checkUserServerChanges(false);
 
   if (gSmtpHostNameIsIllegal) {
     gSmtpHostNameIsIllegal = false;
     selectServer(currentAccount.incomingServer, currentPageId);
     return true;
   }
 
+  if (currentPageId) {
+    // Change focus to the account tree first so that any 'onchange' handlers
+    // on elements in the current page have a chance to run before the page
+    // is saved and replaced by the new one.
+    tree.focus();
+  }
+
   // save the previous page
   savePage(currentAccount);
 
   let changeAccount = (account != currentAccount);
 
   if (changeView)
     selectServer(account.incomingServer, pageId);