From 844f914326bf5070a5a4abb54769fe5c2640ef32 Mon Sep 17 00:00:00 2001 From: "Stefan.Borggraefe%gmx.de" Date: Thu, 29 Apr 2004 14:34:55 +0000 Subject: [PATCH] Fix for Bug 182642: Title of the "Available Profiles" listbox can be deleted with the "Delete Profile" button r=jag, sr=alecf --- profile/resources/content/profileManager.js | 28 ++++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/profile/resources/content/profileManager.js b/profile/resources/content/profileManager.js index 6161a435c9ac..8d445aa47ff9 100644 --- a/profile/resources/content/profileManager.js +++ b/profile/resources/content/profileManager.js @@ -196,25 +196,29 @@ function ConfirmDelete() } // Delete the profile, with the delete flag set as per instruction above. -function DeleteProfile( deleteFiles ) +function DeleteProfile(deleteFiles) { - var profileList = document.getElementById( "profiles" ); + var profileList = document.getElementById("profiles"); if (profileList.selectedItems && profileList.selectedItems.length) { var selected = profileList.selectedItems[0]; - var firstAdjacent = selected.previousSibling; - var name = selected.getAttribute( "rowName" ); + var name = selected.getAttribute("rowName"); + var previous = profileList.getPreviousItem(selected, 1); + try { - profile.deleteProfile( name, deleteFiles ); - profileList.removeChild( selected ); + profile.deleteProfile(name, deleteFiles); + profileList.removeChild(selected); + + if (previous) { + profileList.selectItem(previous); + profileList.ensureElementIsVisible(previous); + } + + // set the button state + DoEnabling(); } catch (ex) { + dump("Exception during profile deletion.\n"); } - if( firstAdjacent ) { - profileList.selectItem( firstAdjacent ); - profileList.ensureElementIsVisible( firstAdjacent ); - } - // set the button state - DoEnabling(); } }