зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1235864 - about:profiles - deleting the default profile should set a new default profile, r=ehsan
This commit is contained in:
Родитель
2a4fdce7ee
Коммит
c24fece6cb
|
@ -298,6 +298,31 @@ function removeProfile(profile) {
|
|||
}
|
||||
}
|
||||
|
||||
// If we are deleting the selected or the default profile we must choose a
|
||||
// different one.
|
||||
let isSelected = ProfileService.selectedProfile == profile;
|
||||
let isDefault = ProfileService.defaultProfile == profile;
|
||||
|
||||
if (isSelected || isDefault) {
|
||||
let itr = ProfileService.profiles;
|
||||
while(itr.hasMoreElements()) {
|
||||
let p = itr.getNext().QueryInterface(Ci.nsIToolkitProfile);
|
||||
if (profile == p) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSelected) {
|
||||
ProfileService.selectedProfile = p;
|
||||
}
|
||||
|
||||
if (isDefault) {
|
||||
ProfileService.defaultProfile = p;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
profile.remove(deleteFiles);
|
||||
ProfileService.flush();
|
||||
refreshUI();
|
||||
|
|
Загрузка…
Ссылка в новой задаче