зеркало из https://github.com/mozilla/pjs.git
Fixing bugs 16791, 23339, 25609, 25891, 23873. These chnages fix rename profile problem on windows, setting the profile name to the user register name, a fix to nsvoidarray memory leak, loading the user prefs and bringing the right UI for -P option. r=gayatrib
This commit is contained in:
Родитель
672ebbefd2
Коммит
1a96dba91a
|
@ -57,6 +57,7 @@
|
||||||
#include "nsIBookmarksService.h"
|
#include "nsIBookmarksService.h"
|
||||||
#include "nsIModule.h"
|
#include "nsIModule.h"
|
||||||
#include "nsIGenericFactory.h"
|
#include "nsIGenericFactory.h"
|
||||||
|
#include "nsICookieService.h"
|
||||||
|
|
||||||
#if defined (XP_UNIX)
|
#if defined (XP_UNIX)
|
||||||
#elif defined (XP_MAC)
|
#elif defined (XP_MAC)
|
||||||
|
@ -89,6 +90,7 @@
|
||||||
|
|
||||||
// Use PregUrlPref to extract the activation url
|
// Use PregUrlPref to extract the activation url
|
||||||
#define PREG_URL_PREF "browser.registration.url"
|
#define PREG_URL_PREF "browser.registration.url"
|
||||||
|
#define ACTIVATION_SERVER_URL "browser.registration.domain"
|
||||||
|
|
||||||
#define PROFILE_SELECTION_URL "chrome://profile/content/profileSelection.xul"
|
#define PROFILE_SELECTION_URL "chrome://profile/content/profileSelection.xul"
|
||||||
#define PROFILE_SELECTION_CMD_LINE_ARG "-SelectProfile"
|
#define PROFILE_SELECTION_CMD_LINE_ARG "-SelectProfile"
|
||||||
|
@ -112,6 +114,8 @@
|
||||||
// destructor at the right time (count == 0)
|
// destructor at the right time (count == 0)
|
||||||
static nsProfileAccess* gProfileDataAccess = nsnull;
|
static nsProfileAccess* gProfileDataAccess = nsnull;
|
||||||
static PRInt32 gDataAccessInstCount = 0;
|
static PRInt32 gDataAccessInstCount = 0;
|
||||||
|
static PRBool mCurrentProfileAvailable = PR_FALSE;
|
||||||
|
static nsFileSpec mRedundantDirectory;
|
||||||
|
|
||||||
// IID and CIDs of all the services needed
|
// IID and CIDs of all the services needed
|
||||||
static NS_DEFINE_CID(kIProfileIID, NS_IPROFILE_IID);
|
static NS_DEFINE_CID(kIProfileIID, NS_IPROFILE_IID);
|
||||||
|
@ -125,6 +129,7 @@ static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||||
static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID);
|
static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID);
|
||||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
|
static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
|
||||||
|
static NS_DEFINE_IID(kCookieServiceCID, NS_COOKIESERVICE_CID);
|
||||||
|
|
||||||
static
|
static
|
||||||
nsresult GetStringFromSpec(nsFileSpec inSpec, char **string)
|
nsresult GetStringFromSpec(nsFileSpec inSpec, char **string)
|
||||||
|
@ -169,6 +174,7 @@ nsProfile::~nsProfile()
|
||||||
printf("~nsProfile \n");
|
printf("~nsProfile \n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CleanUp();
|
||||||
gProfileDataAccess->UpdateRegistry();
|
gProfileDataAccess->UpdateRegistry();
|
||||||
|
|
||||||
gDataAccessInstCount--;
|
gDataAccessInstCount--;
|
||||||
|
@ -240,7 +246,6 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIURI> profileURL;
|
nsCOMPtr<nsIURI> profileURL;
|
||||||
PRInt32 numProfiles=0;
|
PRInt32 numProfiles=0;
|
||||||
PRBool pregURLLoaded = PR_FALSE;
|
|
||||||
|
|
||||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -254,30 +259,8 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
char *isPregInfoSet = nsnull;
|
PRBool pregEnabled = PR_FALSE;
|
||||||
IsPregCookieSet(&isPregInfoSet);
|
rv = prefs->GetBoolPref(PREG_PREF, &pregEnabled);
|
||||||
|
|
||||||
PRBool pregPref = PR_FALSE;
|
|
||||||
|
|
||||||
rv = prefs->GetBoolPref(PREG_PREF, &pregPref);
|
|
||||||
//if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsXPIDLCString pregURL;
|
|
||||||
rv = prefs->CopyCharPref(PREG_URL_PREF, getter_Copies(pregURL));
|
|
||||||
|
|
||||||
// Check if the javascript is enabled....
|
|
||||||
PRBool javascriptEnabled = PR_TRUE;
|
|
||||||
rv = prefs->GetBoolPref(JAVASCRIPT_PREF, &javascriptEnabled);
|
|
||||||
|
|
||||||
// Check if cookies are accepted....
|
|
||||||
PRInt32 acceptCookies = 0;
|
|
||||||
rv = prefs->GetIntPref(COOKIES_PREF, &acceptCookies);
|
|
||||||
|
|
||||||
// Set the boolean based on javascript and cookies prefs
|
|
||||||
PRBool requiredPrefsEnabled = PR_TRUE;
|
|
||||||
|
|
||||||
if ((!(javascriptEnabled)) || (acceptCookies == NEVER_ACCEPT_COOKIES))
|
|
||||||
requiredPrefsEnabled = PR_FALSE;
|
|
||||||
|
|
||||||
if (profileURLStr.Length() == 0)
|
if (profileURLStr.Length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -286,13 +269,17 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
||||||
// are no profiles yet, or if there is more than one.
|
// are no profiles yet, or if there is more than one.
|
||||||
if (numProfiles == 0)
|
if (numProfiles == 0)
|
||||||
{
|
{
|
||||||
if (pregPref && requiredPrefsEnabled)
|
if (pregEnabled)
|
||||||
{
|
{
|
||||||
rv = CreateDefaultProfile();
|
rv = CreateDefaultProfile();
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
GetProfileCount(&numProfiles);
|
GetProfileCount(&numProfiles);
|
||||||
profileURLStr = pregURL;
|
profileURLStr = "";
|
||||||
|
|
||||||
|
mCurrentProfileAvailable = PR_TRUE;
|
||||||
|
// Need to load new profile prefs.
|
||||||
|
rv = LoadNewProfilePrefs();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
profileURLStr = PROFILE_WIZARD_URL;
|
profileURLStr = PROFILE_WIZARD_URL;
|
||||||
|
@ -301,18 +288,8 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
||||||
profileURLStr = PROFILE_SELECTION_URL;
|
profileURLStr = PROFILE_SELECTION_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provide Preg information
|
|
||||||
if (pregPref && (PL_strcmp(isPregInfoSet, REGISTRY_YES_STRING) != 0) && requiredPrefsEnabled)
|
|
||||||
{
|
|
||||||
if (profileURLStr.Length() == 0)
|
|
||||||
profileURLStr = pregURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profileURLStr.Length() != 0)
|
if (profileURLStr.Length() != 0)
|
||||||
{
|
{
|
||||||
if (PL_strcmp((const char *)profileURLStr, pregURL) == 0)
|
|
||||||
pregURLLoaded = PR_TRUE;
|
|
||||||
|
|
||||||
rv = NS_NewURI(getter_AddRefs(profileURL), (const char *)profileURLStr);
|
rv = NS_NewURI(getter_AddRefs(profileURL), (const char *)profileURLStr);
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
@ -367,48 +344,17 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr)
|
||||||
if (NS_FAILED(rv) || !currentProfileStr || (PL_strlen(currentProfileStr) == 0)) {
|
if (NS_FAILED(rv) || !currentProfileStr || (PL_strlen(currentProfileStr) == 0)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
PR_FREEIF(currentProfileStr);
|
mCurrentProfileAvailable = PR_TRUE;
|
||||||
|
|
||||||
// in multiple profiles case, we still need to take them to registration screens
|
if (pregEnabled)
|
||||||
if (pregPref && (PL_strcmp(isPregInfoSet, REGISTRY_YES_STRING) != 0) && requiredPrefsEnabled)
|
TriggerActivation(currentProfileStr);
|
||||||
{
|
|
||||||
profileURLStr = pregURL;
|
|
||||||
|
|
||||||
// Load PReg shell
|
|
||||||
if (!pregURLLoaded)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIURI> registrationURL;
|
|
||||||
rv = NS_NewURI(getter_AddRefs(registrationURL), (const char *)profileURLStr);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWebShellWindow> profWindow;
|
|
||||||
rv = profAppShell->CreateTopLevelWindow(nsnull, registrationURL,
|
|
||||||
PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,
|
|
||||||
nsnull,
|
|
||||||
NS_SIZETOCONTENT, // width
|
|
||||||
NS_SIZETOCONTENT, // height
|
|
||||||
getter_AddRefs(profWindow));
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Start up the main event loop...
|
|
||||||
*/
|
|
||||||
rv = profAppShell->Run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pregPref && (PL_strcmp(isPregInfoSet, REGISTRY_YES_STRING) != 0) && requiredPrefsEnabled)
|
|
||||||
ProcessPRegCookie();
|
|
||||||
|
|
||||||
CRTFREEIF(isPregInfoSet);
|
|
||||||
|
|
||||||
// Now we have the right profile, read the user-specific prefs.
|
// Now we have the right profile, read the user-specific prefs.
|
||||||
rv = prefs->ReadUserPrefs();
|
rv = prefs->ReadUserPrefs();
|
||||||
return rv;
|
|
||||||
|
PR_FREEIF(currentProfileStr);
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -460,11 +406,37 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
|
||||||
#ifdef DEBUG_profile
|
#ifdef DEBUG_profile
|
||||||
printf("ProfileName : %s\n", cmdResult);
|
printf("ProfileName : %s\n", cmdResult);
|
||||||
#endif /* DEBUG_profile */
|
#endif /* DEBUG_profile */
|
||||||
|
PRBool exists;
|
||||||
|
rv = ProfileExists(currProfileName, &exists);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
GetProfileDir(currProfileName, &currProfileDirSpec);
|
if (!exists) {
|
||||||
|
PRInt32 num5xProfiles = 0;
|
||||||
if (NS_SUCCEEDED(rv)){
|
PRInt32 num4xProfiles = 0;
|
||||||
*profileDirSet = PR_TRUE;
|
|
||||||
|
GetProfileCount(&num5xProfiles);
|
||||||
|
Get4xProfileCount(&num4xProfiles);
|
||||||
|
|
||||||
|
if (num5xProfiles == 0 && num4xProfiles == 0) {
|
||||||
|
profileURLStr = PROFILE_WIZARD_URL;
|
||||||
|
}
|
||||||
|
else if (num5xProfiles > 0) {
|
||||||
|
profileURLStr = PROFILE_SELECTION_URL;
|
||||||
|
}
|
||||||
|
else if (num4xProfiles > 0) {
|
||||||
|
profileURLStr = PROFILE_MANAGER_URL;
|
||||||
|
}
|
||||||
|
*profileDirSet = PR_FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rv = GetProfileDir(currProfileName, &currProfileDirSpec);
|
||||||
|
if (NS_SUCCEEDED(rv)){
|
||||||
|
*profileDirSet = PR_TRUE;
|
||||||
|
mCurrentProfileAvailable = PR_TRUE;
|
||||||
|
|
||||||
|
// Need to load new profile prefs.
|
||||||
|
rv = LoadNewProfilePrefs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,6 +483,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
|
||||||
rv = CreateNewProfile(currProfileName, currProfileDirSpec.GetNativePathCString());
|
rv = CreateNewProfile(currProfileName, currProfileDirSpec.GetNativePathCString());
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
*profileDirSet = PR_TRUE;
|
*profileDirSet = PR_TRUE;
|
||||||
|
mCurrentProfileAvailable = PR_TRUE;
|
||||||
|
|
||||||
// Need to load new profile prefs.
|
// Need to load new profile prefs.
|
||||||
rv = LoadNewProfilePrefs();
|
rv = LoadNewProfilePrefs();
|
||||||
|
@ -580,6 +553,10 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
|
||||||
AutoMigrate();
|
AutoMigrate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (numProfiles > 1)
|
||||||
|
{
|
||||||
|
profileURLStr = PROFILE_SELECTION_URL;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// show the profile manager
|
// show the profile manager
|
||||||
profileURLStr = PROFILE_MANAGER_URL;
|
profileURLStr = PROFILE_MANAGER_URL;
|
||||||
|
@ -747,6 +724,8 @@ NS_IMETHODIMP nsProfile::SetProfileDir(const char *profileName, nsFileSpec& prof
|
||||||
aProfile->isMigrated = nsCRT::strdup(REGISTRY_YES_STRING);
|
aProfile->isMigrated = nsCRT::strdup(REGISTRY_YES_STRING);
|
||||||
aProfile->NCProfileName = nsnull;
|
aProfile->NCProfileName = nsnull;
|
||||||
aProfile->NCDeniedService = nsnull;
|
aProfile->NCDeniedService = nsnull;
|
||||||
|
aProfile->NCEmailAddress = nsnull;
|
||||||
|
aProfile->NCHavePregInfo = nsnull;
|
||||||
|
|
||||||
rv = CreateUserDirectories(tmpDir);
|
rv = CreateUserDirectories(tmpDir);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -970,6 +949,8 @@ nsresult nsProfile::CopyRegKey(const char *oldProfile, const char *newProfile)
|
||||||
aProfile->profileName = nsCRT::strdup(newProfile);
|
aProfile->profileName = nsCRT::strdup(newProfile);
|
||||||
aProfile->NCProfileName = nsnull;
|
aProfile->NCProfileName = nsnull;
|
||||||
aProfile->NCDeniedService = nsnull;
|
aProfile->NCDeniedService = nsnull;
|
||||||
|
aProfile->NCEmailAddress = nsnull;
|
||||||
|
aProfile->NCHavePregInfo = nsnull;
|
||||||
|
|
||||||
rv = gProfileDataAccess->SetValue(aProfile);
|
rv = gProfileDataAccess->SetValue(aProfile);
|
||||||
|
|
||||||
|
@ -1053,7 +1034,8 @@ NS_IMETHODIMP nsProfile::StartApprunner(const char* profileName)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gProfileDataAccess->SetCurrentProfile(profileName);
|
gProfileDataAccess->SetCurrentProfile(profileName);
|
||||||
|
mCurrentProfileAvailable = PR_TRUE;
|
||||||
|
|
||||||
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
|
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
@ -1229,9 +1211,25 @@ NS_IMETHODIMP nsProfile::MigrateProfile(const char* profileName, PRBool showProg
|
||||||
|
|
||||||
NS_IMETHODIMP nsProfile::GetCookie(char **cookie)
|
NS_IMETHODIMP nsProfile::GetCookie(char **cookie)
|
||||||
{
|
{
|
||||||
// XXX NECKO we need to use the cookie module for this info instead of
|
nsresult rv = NS_OK;
|
||||||
// XXX the IOService
|
nsString aCookie;
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
|
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
char* pregURL;
|
||||||
|
rv = prefs->CopyCharPref(ACTIVATION_SERVER_URL, &pregURL);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> pregURI;
|
||||||
|
rv = NS_NewURI(getter_AddRefs(pregURI), pregURL);
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsICookieService, service, kCookieServiceCID, &rv);
|
||||||
|
if ((NS_OK == rv) && (nsnull != service) && (nsnull != pregURI)) {
|
||||||
|
rv = service->GetCookieString(pregURI, aCookie);
|
||||||
|
*cookie = nsCRT::strdup(aCookie.ToNewCString());
|
||||||
|
}
|
||||||
|
CRTFREEIF(pregURL);
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsProfile::ProcessPRegCookie()
|
NS_IMETHODIMP nsProfile::ProcessPRegCookie()
|
||||||
|
@ -1324,16 +1322,31 @@ NS_IMETHODIMP nsProfile::ProcessPREGInfo(const char* data)
|
||||||
rv = GetCurrentProfile(&curProfile);
|
rv = GetCurrentProfile(&curProfile);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsFileSpec dirSpec;
|
||||||
|
rv = GetProfileDir(curProfile, &dirSpec);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (userProfileName.mLength > 0)
|
if (userProfileName.mLength > 0)
|
||||||
{
|
{
|
||||||
CloneProfile(userProfileName.ToNewCString());
|
rv = CloneProfile(userProfileName.ToNewCString());
|
||||||
DeleteProfile(curProfile, PR_TRUE);
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
// Delete only if the new name is different from current profile
|
||||||
|
if (PL_strcmp(userProfileName.ToNewCString(), curProfile) != 0)
|
||||||
|
{
|
||||||
|
rv = DeleteProfile(curProfile, PR_FALSE);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// After cloning we have a new filespec. Remove the old one.
|
||||||
|
mRedundantDirectory = dirSpec;
|
||||||
|
|
||||||
ProfileStruct* aProfile;
|
ProfileStruct* aProfile;
|
||||||
|
|
||||||
gProfileDataAccess->GetValue(userProfileName.ToNewCString(), &aProfile);
|
gProfileDataAccess->GetValue(userProfileName.ToNewCString(), &aProfile);
|
||||||
|
|
||||||
aProfile->NCProfileName = nsCRT::strdup(userProfileName.ToNewCString());
|
aProfile->NCProfileName = nsCRT::strdup(userProfileName.ToNewCString());
|
||||||
|
aProfile->NCHavePregInfo = nsCRT::strdup(REGISTRY_YES_STRING);
|
||||||
|
|
||||||
gProfileDataAccess->SetValue(aProfile);
|
gProfileDataAccess->SetValue(aProfile);
|
||||||
gProfileDataAccess->SetCurrentProfile(userProfileName.ToNewCString());
|
gProfileDataAccess->SetCurrentProfile(userProfileName.ToNewCString());
|
||||||
|
@ -1346,6 +1359,7 @@ NS_IMETHODIMP nsProfile::ProcessPREGInfo(const char* data)
|
||||||
gProfileDataAccess->GetValue(curProfile, &aProfile);
|
gProfileDataAccess->GetValue(curProfile, &aProfile);
|
||||||
|
|
||||||
aProfile->NCDeniedService = nsCRT::strdup(userServiceDenial.ToNewCString());
|
aProfile->NCDeniedService = nsCRT::strdup(userServiceDenial.ToNewCString());
|
||||||
|
aProfile->NCHavePregInfo = nsCRT::strdup(REGISTRY_YES_STRING);
|
||||||
|
|
||||||
gProfileDataAccess->SetValue(aProfile);
|
gProfileDataAccess->SetValue(aProfile);
|
||||||
FreeProfileStruct(aProfile);
|
FreeProfileStruct(aProfile);
|
||||||
|
@ -1358,9 +1372,9 @@ NS_IMETHODIMP nsProfile::ProcessPREGInfo(const char* data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsProfile::IsPregCookieSet(char **pregSet)
|
NS_IMETHODIMP nsProfile::IsPregCookieSet(const char *profileName, char **pregSet)
|
||||||
{
|
{
|
||||||
gProfileDataAccess->GetPREGInfo(pregSet);
|
gProfileDataAccess->GetPREGInfo(profileName, pregSet);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,6 +1384,11 @@ NS_IMETHODIMP nsProfile::ProfileExists(const char *profileName, PRBool *exists)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsProfile::IsCurrentProfileAvailable(PRBool *avialable)
|
||||||
|
{
|
||||||
|
*avialable = mCurrentProfileAvailable;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the number of unmigrated 4x profiles
|
// Gets the number of unmigrated 4x profiles
|
||||||
// Location: Common/Profiles
|
// Location: Common/Profiles
|
||||||
|
@ -1431,15 +1450,15 @@ NS_IMETHODIMP nsProfile::CloneProfile(const char* newProfile)
|
||||||
nsFileSpec currProfileDir;
|
nsFileSpec currProfileDir;
|
||||||
nsFileSpec newProfileDir;
|
nsFileSpec newProfileDir;
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
|
||||||
|
if (NS_FAILED(rv) || !locator) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
GetCurrentProfileDir(&currProfileDir);
|
GetCurrentProfileDir(&currProfileDir);
|
||||||
|
|
||||||
if (currProfileDir.Exists())
|
if (currProfileDir.Exists())
|
||||||
{
|
{
|
||||||
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
|
nsCOMPtr <nsIFileSpec> dirSpec;
|
||||||
if (NS_FAILED(rv) || !locator) return NS_ERROR_FAILURE;
|
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(dirSpec));
|
||||||
|
|
||||||
nsCOMPtr <nsIFileSpec> dirSpec;
|
|
||||||
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(dirSpec));
|
|
||||||
|
|
||||||
if (NS_FAILED(rv) || !dirSpec)
|
if (NS_FAILED(rv) || !dirSpec)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -1472,8 +1491,11 @@ NS_IMETHODIMP nsProfile::CloneProfile(const char* newProfile)
|
||||||
printf("ProfileManager : Cloned CurrentProfile to new Profile ->%s<-\n", newProfile);
|
printf("ProfileManager : Cloned CurrentProfile to new Profile ->%s<-\n", newProfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gProfileDataAccess->mNumProfiles++;
|
||||||
gProfileDataAccess->mProfileDataChanged = PR_TRUE;
|
gProfileDataAccess->mProfileDataChanged = PR_TRUE;
|
||||||
gProfileDataAccess->UpdateRegistry();
|
|
||||||
|
rv = locator->ForgetProfileDir();
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -1488,11 +1510,102 @@ nsProfile::FreeProfileStruct(ProfileStruct* aProfile)
|
||||||
CRTFREEIF(aProfile->isMigrated);
|
CRTFREEIF(aProfile->isMigrated);
|
||||||
CRTFREEIF(aProfile->NCProfileName);
|
CRTFREEIF(aProfile->NCProfileName);
|
||||||
CRTFREEIF(aProfile->NCDeniedService);
|
CRTFREEIF(aProfile->NCDeniedService);
|
||||||
|
CRTFREEIF(aProfile->NCEmailAddress);
|
||||||
|
CRTFREEIF(aProfile->NCHavePregInfo);
|
||||||
|
|
||||||
PR_FREEIF(aProfile);
|
PR_FREEIF(aProfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsProfile::TriggerActivation(char *profileName)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
char *isPregInfoSet = nsnull;
|
||||||
|
IsPregCookieSet(profileName, &isPregInfoSet);
|
||||||
|
|
||||||
|
if (PL_strcmp(isPregInfoSet, REGISTRY_YES_STRING) != 0)
|
||||||
|
{
|
||||||
|
// fire up an instance of the cookie manager.
|
||||||
|
// I'm doing this using the serviceManager for convenience's sake.
|
||||||
|
// Presumably an application will init it's own cookie service a
|
||||||
|
// different way (this way works too though).
|
||||||
|
nsCOMPtr<nsICookieService> cookieService = do_GetService(NS_COOKIESERVICE_PROGID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
// quiet the compiler
|
||||||
|
(void)cookieService;
|
||||||
|
|
||||||
|
PRBool acceptCookies = PR_TRUE;
|
||||||
|
cookieService->CookieEnabled(&acceptCookies);
|
||||||
|
|
||||||
|
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
char* pregURL = nsnull;
|
||||||
|
rv = prefs->CopyCharPref(PREG_URL_PREF, &pregURL);
|
||||||
|
|
||||||
|
// Check if the javascript is enabled....
|
||||||
|
PRBool javascriptEnabled = PR_TRUE;
|
||||||
|
rv = prefs->GetBoolPref(JAVASCRIPT_PREF, &javascriptEnabled);
|
||||||
|
|
||||||
|
// Check if cookies are accepted....
|
||||||
|
// PRInt32 acceptCookies = 0;
|
||||||
|
// rv = prefs->GetIntPref(COOKIES_PREF, &acceptCookies);
|
||||||
|
|
||||||
|
// Set the boolean based on javascript and cookies prefs
|
||||||
|
PRBool requiredPrefsEnabled = PR_TRUE;
|
||||||
|
|
||||||
|
if ((!(javascriptEnabled)) || (!acceptCookies))
|
||||||
|
requiredPrefsEnabled = PR_FALSE;
|
||||||
|
|
||||||
|
if (requiredPrefsEnabled)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Create the Application Shell instance...
|
||||||
|
*/
|
||||||
|
NS_WITH_SERVICE(nsIAppShellService, pregAppShell, kAppShellServiceCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> registrationURL;
|
||||||
|
rv = NS_NewURI(getter_AddRefs(registrationURL), pregURL);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIWebShellWindow> pregWindow;
|
||||||
|
rv = pregAppShell->CreateTopLevelWindow(nsnull, registrationURL,
|
||||||
|
PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,
|
||||||
|
nsnull,
|
||||||
|
NS_SIZETOCONTENT, // width
|
||||||
|
NS_SIZETOCONTENT, // height
|
||||||
|
getter_AddRefs(pregWindow));
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start up the main event loop...
|
||||||
|
*/
|
||||||
|
rv = pregAppShell->Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessPRegCookie();
|
||||||
|
|
||||||
|
CRTFREEIF(pregURL);
|
||||||
|
}
|
||||||
|
CRTFREEIF(isPregInfoSet);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsProfile::CleanUp()
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
DeleteUserDirectories(mRedundantDirectory);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsProfile::CreateDefaultProfile(void)
|
nsProfile::CreateDefaultProfile(void)
|
||||||
{
|
{
|
||||||
|
@ -1517,4 +1630,3 @@ nsProfile::CreateDefaultProfile(void)
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,7 @@ public:
|
||||||
nsresult AutoMigrate();
|
nsresult AutoMigrate();
|
||||||
|
|
||||||
nsresult CreateDefaultProfile(void);
|
nsresult CreateDefaultProfile(void);
|
||||||
|
nsresult TriggerActivation(char *profileName);
|
||||||
|
nsresult CleanUp();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
#define REGISTRY_CURRENT_PROFILE_STRING "CurrentProfile"
|
#define REGISTRY_CURRENT_PROFILE_STRING "CurrentProfile"
|
||||||
#define REGISTRY_NC_SERVICE_DENIAL_STRING "NCServiceDenial"
|
#define REGISTRY_NC_SERVICE_DENIAL_STRING "NCServiceDenial"
|
||||||
#define REGISTRY_NC_PROFILE_NAME_STRING "NCProfileName"
|
#define REGISTRY_NC_PROFILE_NAME_STRING "NCProfileName"
|
||||||
|
#define REGISTRY_NC_USER_EMAIL_STRING "NCEmailAddress"
|
||||||
|
#define REGISTRY_NC_HAVE_PREG_INFO_STRING "NCHavePregInfo"
|
||||||
#define REGISTRY_HAVE_PREG_INFO_STRING "HavePregInfo"
|
#define REGISTRY_HAVE_PREG_INFO_STRING "HavePregInfo"
|
||||||
#define REGISTRY_MIGRATED_STRING "migrated"
|
#define REGISTRY_MIGRATED_STRING "migrated"
|
||||||
#define REGISTRY_DIRECTORY_STRING "directory"
|
#define REGISTRY_DIRECTORY_STRING "directory"
|
||||||
|
@ -107,8 +109,8 @@ nsProfileAccess::~nsProfileAccess()
|
||||||
CRTFREEIF(mVersion);
|
CRTFREEIF(mVersion);
|
||||||
CRTFREEIF(mHavePREGInfo);
|
CRTFREEIF(mHavePREGInfo);
|
||||||
|
|
||||||
FreeProfileMembers(mProfiles, mCount);
|
FreeProfileMembers(mProfiles, mProfiles->Count());
|
||||||
FreeProfileMembers(m4xProfiles, m4xCount);
|
FreeProfileMembers(m4xProfiles, m4xProfiles->Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free up the member profile structs
|
// Free up the member profile structs
|
||||||
|
@ -124,6 +126,8 @@ nsProfileAccess::FreeProfileMembers(nsVoidArray *profiles, PRInt32 numElems)
|
||||||
aProfile = (ProfileStruct *) profiles->ElementAt(index);
|
aProfile = (ProfileStruct *) profiles->ElementAt(index);
|
||||||
delete aProfile;
|
delete aProfile;
|
||||||
}
|
}
|
||||||
|
if (profiles)
|
||||||
|
delete profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the registry.
|
// Close the registry.
|
||||||
|
@ -188,6 +192,8 @@ nsProfileAccess::GetValue(const char* profileName, ProfileStruct** aProfile)
|
||||||
(*aProfile)->isMigrated = nsnull;
|
(*aProfile)->isMigrated = nsnull;
|
||||||
(*aProfile)->NCProfileName = nsnull;
|
(*aProfile)->NCProfileName = nsnull;
|
||||||
(*aProfile)->NCDeniedService = nsnull;
|
(*aProfile)->NCDeniedService = nsnull;
|
||||||
|
(*aProfile)->NCEmailAddress = nsnull;
|
||||||
|
(*aProfile)->NCHavePregInfo = nsnull;
|
||||||
|
|
||||||
(*aProfile)->profileName = nsCRT::strdup(profileItem->profileName);
|
(*aProfile)->profileName = nsCRT::strdup(profileItem->profileName);
|
||||||
(*aProfile)->profileLocation = nsCRT::strdup(profileItem->profileLocation);
|
(*aProfile)->profileLocation = nsCRT::strdup(profileItem->profileLocation);
|
||||||
|
@ -197,6 +203,10 @@ nsProfileAccess::GetValue(const char* profileName, ProfileStruct** aProfile)
|
||||||
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCProfileName);
|
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCProfileName);
|
||||||
if (profileItem->NCDeniedService)
|
if (profileItem->NCDeniedService)
|
||||||
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCDeniedService);
|
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCDeniedService);
|
||||||
|
if (profileItem->NCEmailAddress)
|
||||||
|
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCEmailAddress);
|
||||||
|
if (profileItem->NCHavePregInfo)
|
||||||
|
(*aProfile)->NCProfileName = nsCRT::strdup(profileItem->NCHavePregInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*aProfile = nsnull;
|
*aProfile = nsnull;
|
||||||
|
@ -241,6 +251,18 @@ nsProfileAccess::SetValue(ProfileStruct* aProfile)
|
||||||
profileItem->NCDeniedService = (char *) PR_Realloc(profileItem->NCDeniedService, length+1);
|
profileItem->NCDeniedService = (char *) PR_Realloc(profileItem->NCDeniedService, length+1);
|
||||||
PL_strcpy(profileItem->NCDeniedService, aProfile->NCDeniedService);
|
PL_strcpy(profileItem->NCDeniedService, aProfile->NCDeniedService);
|
||||||
}
|
}
|
||||||
|
if (aProfile->NCEmailAddress)
|
||||||
|
{
|
||||||
|
length = PL_strlen(aProfile->NCEmailAddress);
|
||||||
|
profileItem->NCEmailAddress = (char *) PR_Realloc(profileItem->NCEmailAddress, length+1);
|
||||||
|
PL_strcpy(profileItem->NCEmailAddress, aProfile->NCEmailAddress);
|
||||||
|
}
|
||||||
|
if (aProfile->NCHavePregInfo)
|
||||||
|
{
|
||||||
|
length = PL_strlen(aProfile->NCHavePregInfo);
|
||||||
|
profileItem->NCHavePregInfo = (char *) PR_Realloc(profileItem->NCHavePregInfo, length+1);
|
||||||
|
PL_strcpy(profileItem->NCHavePregInfo, aProfile->NCHavePregInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -253,6 +275,8 @@ nsProfileAccess::SetValue(ProfileStruct* aProfile)
|
||||||
profileItem->isMigrated = nsnull;
|
profileItem->isMigrated = nsnull;
|
||||||
profileItem->NCProfileName = nsnull;
|
profileItem->NCProfileName = nsnull;
|
||||||
profileItem->NCDeniedService = nsnull;
|
profileItem->NCDeniedService = nsnull;
|
||||||
|
profileItem->NCEmailAddress = nsnull;
|
||||||
|
profileItem->NCHavePregInfo = nsnull;
|
||||||
|
|
||||||
profileItem->profileName = nsCRT::strdup(aProfile->profileName);
|
profileItem->profileName = nsCRT::strdup(aProfile->profileName);
|
||||||
profileItem->profileLocation = nsCRT::strdup(aProfile->profileLocation);
|
profileItem->profileLocation = nsCRT::strdup(aProfile->profileLocation);
|
||||||
|
@ -263,6 +287,10 @@ nsProfileAccess::SetValue(ProfileStruct* aProfile)
|
||||||
profileItem->NCProfileName = nsCRT::strdup(aProfile->NCProfileName);
|
profileItem->NCProfileName = nsCRT::strdup(aProfile->NCProfileName);
|
||||||
if (aProfile->NCDeniedService)
|
if (aProfile->NCDeniedService)
|
||||||
profileItem->NCProfileName = nsCRT::strdup(aProfile->NCDeniedService);
|
profileItem->NCProfileName = nsCRT::strdup(aProfile->NCDeniedService);
|
||||||
|
if (aProfile->NCEmailAddress)
|
||||||
|
profileItem->NCEmailAddress = nsCRT::strdup(aProfile->NCEmailAddress);
|
||||||
|
if (aProfile->NCHavePregInfo)
|
||||||
|
profileItem->NCHavePregInfo = nsCRT::strdup(aProfile->NCHavePregInfo);
|
||||||
|
|
||||||
if (!mProfiles)
|
if (!mProfiles)
|
||||||
mProfiles = new nsVoidArray();
|
mProfiles = new nsVoidArray();
|
||||||
|
@ -352,6 +380,8 @@ nsProfileAccess::FillProfileInfo()
|
||||||
nsXPIDLCString isMigrated;
|
nsXPIDLCString isMigrated;
|
||||||
nsXPIDLCString NCProfileName;
|
nsXPIDLCString NCProfileName;
|
||||||
nsXPIDLCString NCDeniedService;
|
nsXPIDLCString NCDeniedService;
|
||||||
|
nsXPIDLCString NCEmailAddress;
|
||||||
|
nsXPIDLCString NCHavePregInfo;
|
||||||
char* directory = nsnull;
|
char* directory = nsnull;
|
||||||
|
|
||||||
rv = node->GetName( getter_Copies(profile) );
|
rv = node->GetName( getter_Copies(profile) );
|
||||||
|
@ -375,6 +405,8 @@ nsProfileAccess::FillProfileInfo()
|
||||||
|
|
||||||
rv = m_registry->GetString(profKey, REGISTRY_NC_PROFILE_NAME_STRING, getter_Copies(NCProfileName));
|
rv = m_registry->GetString(profKey, REGISTRY_NC_PROFILE_NAME_STRING, getter_Copies(NCProfileName));
|
||||||
rv = m_registry->GetString(profKey, REGISTRY_NC_SERVICE_DENIAL_STRING, getter_Copies(NCDeniedService));
|
rv = m_registry->GetString(profKey, REGISTRY_NC_SERVICE_DENIAL_STRING, getter_Copies(NCDeniedService));
|
||||||
|
rv = m_registry->GetString(profKey, REGISTRY_NC_USER_EMAIL_STRING, getter_Copies(NCEmailAddress));
|
||||||
|
rv = m_registry->GetString(profKey, REGISTRY_NC_HAVE_PREG_INFO_STRING, getter_Copies(NCHavePregInfo));
|
||||||
|
|
||||||
ProfileStruct* profileItem = new ProfileStruct();
|
ProfileStruct* profileItem = new ProfileStruct();
|
||||||
if (!profileItem)
|
if (!profileItem)
|
||||||
|
@ -385,6 +417,8 @@ nsProfileAccess::FillProfileInfo()
|
||||||
profileItem->isMigrated = nsnull;
|
profileItem->isMigrated = nsnull;
|
||||||
profileItem->NCProfileName = nsnull;
|
profileItem->NCProfileName = nsnull;
|
||||||
profileItem->NCDeniedService = nsnull;
|
profileItem->NCDeniedService = nsnull;
|
||||||
|
profileItem->NCEmailAddress = nsnull;
|
||||||
|
profileItem->NCHavePregInfo = nsnull;
|
||||||
profileItem->updateProfileEntry = PR_TRUE;
|
profileItem->updateProfileEntry = PR_TRUE;
|
||||||
|
|
||||||
profileItem->profileName = nsCRT::strdup(profile);
|
profileItem->profileName = nsCRT::strdup(profile);
|
||||||
|
@ -392,9 +426,13 @@ nsProfileAccess::FillProfileInfo()
|
||||||
profileItem->isMigrated = nsCRT::strdup(isMigrated);
|
profileItem->isMigrated = nsCRT::strdup(isMigrated);
|
||||||
|
|
||||||
if (NCProfileName)
|
if (NCProfileName)
|
||||||
profileItem->NCProfileName = nsCRT::strdup(NCProfileName);
|
profileItem->NCProfileName = nsCRT::strdup(NCProfileName);
|
||||||
if (NCDeniedService)
|
if (NCDeniedService)
|
||||||
profileItem->NCDeniedService = nsCRT::strdup(NCDeniedService);
|
profileItem->NCDeniedService = nsCRT::strdup(NCDeniedService);
|
||||||
|
if (NCEmailAddress)
|
||||||
|
profileItem->NCEmailAddress = nsCRT::strdup(NCEmailAddress);
|
||||||
|
if (NCHavePregInfo)
|
||||||
|
profileItem->NCHavePregInfo = nsCRT::strdup(NCHavePregInfo);
|
||||||
|
|
||||||
if (PL_strcmp(isMigrated, REGISTRY_YES_STRING) == 0)
|
if (PL_strcmp(isMigrated, REGISTRY_YES_STRING) == 0)
|
||||||
mNumProfiles++;
|
mNumProfiles++;
|
||||||
|
@ -625,15 +663,15 @@ nsProfileAccess::UpdateRegistry()
|
||||||
rv = m_registry->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &profilesTreeKey);
|
rv = m_registry->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &profilesTreeKey);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// Get the current profile
|
// Set the current profile
|
||||||
rv = m_registry->SetString(profilesTreeKey, REGISTRY_CURRENT_PROFILE_STRING, mCurrentProfile);
|
rv = m_registry->SetString(profilesTreeKey, REGISTRY_CURRENT_PROFILE_STRING, mCurrentProfile);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// Get the current profile
|
// Set the registry version
|
||||||
rv = m_registry->SetString(profilesTreeKey, REGISTRY_VERSION_STRING, mVersion);
|
rv = m_registry->SetString(profilesTreeKey, REGISTRY_VERSION_STRING, mVersion);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// Get the current profile
|
// Set preg info
|
||||||
rv = m_registry->SetString(profilesTreeKey, REGISTRY_HAVE_PREG_INFO_STRING, mHavePREGInfo);
|
rv = m_registry->SetString(profilesTreeKey, REGISTRY_HAVE_PREG_INFO_STRING, mHavePREGInfo);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
@ -692,6 +730,8 @@ nsProfileAccess::UpdateRegistry()
|
||||||
|
|
||||||
rv = m_registry->SetString(profKey, REGISTRY_NC_PROFILE_NAME_STRING, profileItem->NCProfileName);
|
rv = m_registry->SetString(profKey, REGISTRY_NC_PROFILE_NAME_STRING, profileItem->NCProfileName);
|
||||||
rv = m_registry->SetString(profKey, REGISTRY_NC_SERVICE_DENIAL_STRING, profileItem->NCDeniedService);
|
rv = m_registry->SetString(profKey, REGISTRY_NC_SERVICE_DENIAL_STRING, profileItem->NCDeniedService);
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_USER_EMAIL_STRING, profileItem->NCEmailAddress);
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_HAVE_PREG_INFO_STRING, profileItem->NCHavePregInfo);
|
||||||
|
|
||||||
profileItem->updateProfileEntry = PR_FALSE;
|
profileItem->updateProfileEntry = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -716,6 +756,11 @@ nsProfileAccess::UpdateRegistry()
|
||||||
rv = m_registry->SetString(profKey, REGISTRY_MIGRATED_STRING, profileItem->isMigrated);
|
rv = m_registry->SetString(profKey, REGISTRY_MIGRATED_STRING, profileItem->isMigrated);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_PROFILE_NAME_STRING, profileItem->NCProfileName);
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_SERVICE_DENIAL_STRING, profileItem->NCDeniedService);
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_USER_EMAIL_STRING, profileItem->NCEmailAddress);
|
||||||
|
rv = m_registry->SetString(profKey, REGISTRY_NC_HAVE_PREG_INFO_STRING, profileItem->NCHavePregInfo);
|
||||||
|
|
||||||
profileItem->updateProfileEntry = PR_FALSE;
|
profileItem->updateProfileEntry = PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,6 +895,8 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
||||||
profileItem->isMigrated = nsnull;
|
profileItem->isMigrated = nsnull;
|
||||||
profileItem->NCProfileName = nsnull;
|
profileItem->NCProfileName = nsnull;
|
||||||
profileItem->NCDeniedService = nsnull;
|
profileItem->NCDeniedService = nsnull;
|
||||||
|
profileItem->NCEmailAddress = nsnull;
|
||||||
|
profileItem->NCHavePregInfo = nsnull;
|
||||||
profileItem->updateProfileEntry = PR_TRUE;
|
profileItem->updateProfileEntry = PR_TRUE;
|
||||||
|
|
||||||
profileItem->profileName = nsCRT::strdup(nsUnescape(profile));
|
profileItem->profileName = nsCRT::strdup(nsUnescape(profile));
|
||||||
|
@ -896,6 +943,8 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
||||||
profileItem->isMigrated = nsnull;
|
profileItem->isMigrated = nsnull;
|
||||||
profileItem->NCProfileName = nsnull;
|
profileItem->NCProfileName = nsnull;
|
||||||
profileItem->NCDeniedService = nsnull;
|
profileItem->NCDeniedService = nsnull;
|
||||||
|
profileItem->NCEmailAddress = nsnull;
|
||||||
|
profileItem->NCHavePregInfo = nsnull;
|
||||||
profileItem->updateProfileEntry = PR_TRUE;
|
profileItem->updateProfileEntry = PR_TRUE;
|
||||||
|
|
||||||
profileItem->profileName = nsCRT::strdup(nsUnescape(unixProfileName));
|
profileItem->profileName = nsCRT::strdup(nsUnescape(unixProfileName));
|
||||||
|
@ -981,11 +1030,21 @@ nsProfileAccess::SetPREGInfo(const char* pregInfo)
|
||||||
|
|
||||||
//Get the for PREG info.
|
//Get the for PREG info.
|
||||||
void
|
void
|
||||||
nsProfileAccess::GetPREGInfo(char **info)
|
nsProfileAccess::GetPREGInfo(const char *profileName, char **info)
|
||||||
{
|
{
|
||||||
*info = nsnull;
|
*info = nsnull;
|
||||||
|
PRInt32 index = 0;
|
||||||
|
|
||||||
if (mHavePREGInfo)
|
index = FindProfileIndex(profileName);
|
||||||
*info = nsCRT::strdup(mHavePREGInfo);
|
|
||||||
|
if (index >= 0 )
|
||||||
|
{
|
||||||
|
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||||
|
|
||||||
|
if (profileItem->NCHavePregInfo)
|
||||||
|
*info = nsCRT::strdup(profileItem->NCHavePregInfo);
|
||||||
|
else
|
||||||
|
*info = nsCRT::strdup(REGISTRY_NO_STRING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,14 @@
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
|
|
||||||
//typedef struct _profile_struct ProfileStruct;
|
|
||||||
typedef struct _profile_struct {
|
typedef struct _profile_struct {
|
||||||
char* profileName;
|
char* profileName;
|
||||||
char* profileLocation;
|
char* profileLocation;
|
||||||
char* isMigrated;
|
char* isMigrated;
|
||||||
char* NCProfileName;
|
char* NCProfileName;
|
||||||
char* NCDeniedService;
|
char* NCDeniedService;
|
||||||
|
char* NCEmailAddress;
|
||||||
|
char* NCHavePregInfo;
|
||||||
PRBool updateProfileEntry;
|
PRBool updateProfileEntry;
|
||||||
}ProfileStruct;
|
}ProfileStruct;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public:
|
||||||
nsresult Get4xProfileInfo(const char *registryName);
|
nsresult Get4xProfileInfo(const char *registryName);
|
||||||
nsresult UpdateProfileArray();
|
nsresult UpdateProfileArray();
|
||||||
void SetPREGInfo(const char* pregInfo);
|
void SetPREGInfo(const char* pregInfo);
|
||||||
void GetPREGInfo(char** pregInfo);
|
void GetPREGInfo(const char *profileName, char** pregInfo);
|
||||||
void FreeProfileMembers(nsVoidArray *aProfile, PRInt32 numElems);
|
void FreeProfileMembers(nsVoidArray *aProfile, PRInt32 numElems);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче