зеркало из https://github.com/mozilla/pjs.git
This commit is contained in:
Родитель
943ef3491e
Коммит
44d16d2de0
|
@ -188,6 +188,12 @@ QGeckoGlobals::pushStartup()
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
if (sProfileDir && !sProfileLock) {
|
||||
rv = XRE_LockProfileDirectory(sProfileDir,
|
||||
&sProfileLock);
|
||||
if (NS_FAILED(rv)) return;
|
||||
}
|
||||
|
||||
rv = XRE_InitEmbedding(greDir, binDir,
|
||||
const_cast<QTEmbedDirectoryProvider*>
|
||||
(&kDirectoryProvider),
|
||||
|
@ -196,12 +202,6 @@ QGeckoGlobals::pushStartup()
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// we no longer need a reference to the DirectoryServiceProvider
|
||||
if (sAppFileLocProvider) {
|
||||
NS_RELEASE(sAppFileLocProvider);
|
||||
sAppFileLocProvider = nsnull;
|
||||
}
|
||||
|
||||
if (sProfileDir)
|
||||
XRE_NotifyProfile();
|
||||
|
||||
|
@ -215,8 +215,18 @@ QGeckoGlobals::popStartup()
|
|||
{
|
||||
sWidgetCount--;
|
||||
if (sWidgetCount == 0) {
|
||||
|
||||
// we no longer need a reference to the DirectoryServiceProvider
|
||||
if (sAppFileLocProvider) {
|
||||
NS_RELEASE(sAppFileLocProvider);
|
||||
sAppFileLocProvider = nsnull;
|
||||
}
|
||||
|
||||
// shut down XPCOM/Embedding
|
||||
XRE_TermEmbedding();
|
||||
|
||||
NS_IF_RELEASE(sProfileLock);
|
||||
NS_IF_RELEASE(sProfileDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,16 +274,27 @@ QGeckoGlobals::setProfilePath(const char *aDir, const char *aName)
|
|||
|
||||
nsresult rv =
|
||||
NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &sProfileDir);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && aName)
|
||||
rv = sProfileDir->AppendNative(nsDependentCString(aName));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool exists = PR_FALSE;
|
||||
rv = sProfileDir->Exists(&exists);
|
||||
if (!exists)
|
||||
rv = sProfileDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
|
||||
rv = XRE_LockProfileDirectory(sProfileDir, &sProfileLock);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (sWidgetCount)
|
||||
XRE_NotifyProfile();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (sWidgetCount)
|
||||
XRE_NotifyProfile();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NS_WARNING("Failed to lock profile.");
|
||||
|
||||
// Failed
|
||||
NS_IF_RELEASE(sProfileDir);
|
||||
NS_IF_RELEASE(sProfileLock);
|
||||
|
|
Загрузка…
Ссылка в новой задаче