Move profile opening to after component registration to prevent locked profiles from causing strange behaviour in the control. b=224455 r=bzbarsky sr=jst

This commit is contained in:
locka%iol.ie 2003-11-11 20:38:51 +00:00
parent b7d4dfaa28
commit ec43ccca35

View File

@ -1016,36 +1016,6 @@ HRESULT CMozillaBrowser::Initialize()
return E_FAIL;
}
// Set the profile which the control will use
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
{
return E_FAIL;
}
// Make a new default profile
nsAutoString newProfileName(NS_LITERAL_STRING("MozillaControl"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))
{
return E_FAIL;
}
else if (!profileExists)
{
rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE);
if (NS_FAILED(rv))
{
return E_FAIL;
}
}
rv = profileService->SetCurrentProfile(newProfileName.get());
if (NS_FAILED(rv))
{
return E_FAIL;
}
// Stuff in here only needs to be done once
static BOOL bRegisterComponents = FALSE;
if (!bRegisterComponents)
@ -1082,6 +1052,37 @@ HRESULT CMozillaBrowser::Initialize()
watcher->SetWindowCreator(windowCreator);
}
// Set the profile which the control will use
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
{
return E_FAIL;
}
// Make a new default profile
nsAutoString newProfileName(NS_LITERAL_STRING("MozillaControl"));
PRBool profileExists = PR_FALSE;
rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
if (NS_FAILED(rv))
{
return E_FAIL;
}
else if (!profileExists)
{
rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE);
if (NS_FAILED(rv))
{
return E_FAIL;
}
}
rv = profileService->SetCurrentProfile(newProfileName.get());
if (NS_FAILED(rv))
{
return E_FAIL;
}
#ifdef HACK_NON_REENTRANCY
}
#endif