From db72bfb6fd1bfd8ab4c7ced63c2b231602c69a2f Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Tue, 30 Oct 2007 18:23:39 +0000 Subject: [PATCH] bug 396491: actions menu for feed type in Applications prefpane loses focus upon selection; r=gavin, a=mconnor git-svn-id: svn://10.0.0.236/trunk@238341 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/preferences/applications.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mozilla/browser/components/preferences/applications.js b/mozilla/browser/components/preferences/applications.js index e3f81beeb2f..97e535d4a28 100755 --- a/mozilla/browser/components/preferences/applications.js +++ b/mozilla/browser/components/preferences/applications.js @@ -718,6 +718,14 @@ var feedHandlerInfo = { this.element(PREF_FEED_SELECTED_ACTION).value = "reader"; }, + // Whether or not we are currently storing the action selected by the user. + // We use this to suppress notification-triggered updates to the list when + // we make changes that may spawn such updates, specifically when we change + // the action for the feed type, which results in feed preference updates, + // which spawn "pref changed" notifications that would otherwise cause us + // to rebuild the view unnecessarily. + _storingAction: false, + //**************************************************************************// // nsIMIMEInfo @@ -881,7 +889,7 @@ var gApplicationsPane = { observe: function (aSubject, aTopic, aData) { // Rebuild the list when there are changes to preferences that influence // whether or not to show certain entries in the list. - if (aTopic == "nsPref:changed") { + if (aTopic == "nsPref:changed" && !this._storingAction) { // These two prefs alter the list of visible types, so we have to rebuild // that list when they change. if (aData == PREF_SHOW_PLUGINS_IN_LIST || @@ -1450,6 +1458,17 @@ var gApplicationsPane = { // Changes onSelectAction: function(aActionItem) { + this._storingAction = true; + + try { + this._storeAction(aActionItem); + } + finally { + this._storingAction = false; + } + }, + + _storeAction: function(aActionItem) { var typeItem = this._list.selectedItem; var handlerInfo = this._handledTypes[typeItem.type];