зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1530615: Remove missing profiles from the profile service when showing the profile manager or about:profiles. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D22146 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d2e43c76a3
Коммит
c1a0af0769
|
@ -331,5 +331,26 @@ function restart(safeMode) {
|
|||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
// Check if any profiles are missing on the disk and if so remove them.
|
||||
// We cannot remove profiles while iterating the list returned from the
|
||||
// profile service, so convert it to a new array first.
|
||||
try {
|
||||
let changed = false;
|
||||
for (let profile of [...ProfileService.profiles]) {
|
||||
if (!profile.rootDir.exists() || !profile.rootDir.isDirectory()) {
|
||||
profile.remove(false);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
ProfileService.flush();
|
||||
}
|
||||
} catch (e) {
|
||||
// There shouldn't be any failures to catch here, but just in case let the
|
||||
// UI build itself properly.
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
refreshUI();
|
||||
}, {once: true});
|
||||
|
|
|
@ -24,6 +24,23 @@ function startup() {
|
|||
|
||||
gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
|
||||
|
||||
// Check if any profiles are missing on the disk and if so remove them.
|
||||
// We cannot remove profiles while iterating the list returned from the
|
||||
// profile service, so convert it to a new array first.
|
||||
try {
|
||||
for (let profile of [...gProfileService.profiles]) {
|
||||
if (!profile.rootDir.exists() || !profile.rootDir.isDirectory()) {
|
||||
profile.remove(false);
|
||||
}
|
||||
}
|
||||
|
||||
// The profile service is always flushed after this dialog completes.
|
||||
} catch (e) {
|
||||
// There shouldn't be any failures to catch here, but just in case let the
|
||||
// UI build itself properly.
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
||||
gBrandBundle = document.getElementById("bundle_brand");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче