Bug 1700850 - Pre: Create backgroundtask temporary profile before profile service. r=mossop

It's very unlikely that this would make a difference, since creating
the service does not immediately look for a profile.  But it's also
not clear to me why I originally placed it after the service was
created, and it's not impossible that the service creation would look
for `XRE_PROFILE_PATH` (which is how we communicate the desired
profile to the profile service), so let's create the profile before
the service.

Differential Revision: https://phabricator.services.mozilla.com/D110309
This commit is contained in:
Nick Alexander 2021-04-05 04:16:36 +00:00
Родитель 05cea55db6
Коммит b27ba19e6d
1 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -4524,22 +4524,10 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
return 0;
}
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc));
if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
PR_fprintf(PR_STDERR,
"Error: Access was denied while trying to open files in "
"your profile directory.\n");
}
if (NS_FAILED(rv)) {
// We failed to choose or create profile - notify user and quit
ProfileMissingDialog(mNativeApp);
return 1;
}
#ifdef MOZ_BACKGROUNDTASKS
if (BackgroundTasks::IsBackgroundTaskMode()) {
// Allow tests to specify profile path via the environment.
if (!EnvHasValue("XRE_PROFILE_PATH")) {
// Allow tests to specify profile path via the environment.
nsCOMPtr<nsIFile> file;
nsresult rv = BackgroundTasks::GetOrCreateTemporaryProfileDirectory(
getter_AddRefs(file));
@ -4552,6 +4540,18 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
}
#endif
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc));
if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
PR_fprintf(PR_STDERR,
"Error: Access was denied while trying to open files in "
"your profile directory.\n");
}
if (NS_FAILED(rv)) {
// We failed to choose or create profile - notify user and quit
ProfileMissingDialog(mNativeApp);
return 1;
}
bool wasDefaultSelection;
nsCOMPtr<nsIToolkitProfile> profile;
rv = SelectProfile(mProfileSvc, mNativeApp, getter_AddRefs(mProfD),