Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions toolkit/profile/nsToolkitProfileService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
# include "mozilla/WidgetUtilsGtk.h"
#endif

#if defined(MOZ_ENTERPRISE)
# include "mozilla/browser/extensions/felt/felt.h"
#endif

#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetCID.h"
Expand Down Expand Up @@ -1560,36 +1556,6 @@ nsresult nsToolkitProfileService::SelectStartupProfile(
return NS_OK;
}

#if defined(MOZ_ENTERPRISE)
auto forcedProfile = geckoargs::sProfile.IsPresent(gArgc, gArgv);
if (is_felt_ui() && !forcedProfile) {
nsCOMPtr<nsIFile> file;
MOZ_TRY(
GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(file)));
MOZ_TRY(file->AppendNative("felt"_ns));

bool exists = false;
MOZ_TRY(file->Exists(&exists));

if (!exists) {
// Create a unique profile directory. This can fail if there are too many
// (thousands) of existing directories, which is unlikely to happen.
MOZ_TRY(file->CreateUnique(nsIFile::DIRECTORY_TYPE, 0700));
}

nsCOMPtr<nsIFile> localDir = file;
file.forget(aRootDir);
localDir.forget(aLocalDir);
// Background tasks never use profiles known to the profile service.
*aProfile = nullptr;

// consume -profile
(void)geckoargs::sProfile.Get(gArgc, gArgv);

return NS_OK;
}
#endif

// Check the -profile command line argument. It accepts a single argument that
// gives the path to use for the profile.
ArgResult ar = CheckArg(*aArgc, aArgv, "profile", &arg);
Expand Down
34 changes: 34 additions & 0 deletions toolkit/xre/nsAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#if defined(MOZ_ENTERPRISE)
# include "mozilla/browser/extensions/felt/felt.h"
# include "SpecialSystemDirectory.h"
#endif

#include "nsAppRunner.h"
Expand Down Expand Up @@ -3118,6 +3119,39 @@ static nsresult SelectProfile(nsToolkitProfileService* aProfileSvc,
return ShowProfileManager(aProfileSvc, aNative);
}

#if defined(MOZ_ENTERPRISE)
{
auto forcedProfile = geckoargs::sProfile.IsPresent(gArgc, gArgv);
if (is_felt_ui() && !forcedProfile) {
nsCOMPtr<nsIFile> file;
MOZ_TRY(GetSpecialSystemDirectory(OS_TemporaryDirectory,
getter_AddRefs(file)));
MOZ_TRY(file->AppendNative("felt"_ns));

bool exists = false;
MOZ_TRY(file->Exists(&exists));

if (!exists) {
// Create a unique profile directory. This can fail if there are too
// many (thousands) of existing directories, which is unlikely to
// happen.
MOZ_TRY(file->CreateUnique(nsIFile::DIRECTORY_TYPE, 0700));
}

nsCOMPtr<nsIFile> localDir = file;
file.forget(aRootDir);
localDir.forget(aLocalDir);
// Background tasks never use profiles known to the profile service.
*aProfile = nullptr;

// consume -profile
(void)geckoargs::sProfile.Get(gArgc, gArgv);

return NS_OK;
}
}
#endif

// Ask the profile manager to select the profile directories to use.
bool didCreate = false;
rv = aProfileSvc->SelectStartupProfile(&gArgc, gArgv, gDoProfileReset,
Expand Down