Bug 1040561 - Part 4. Initialize mOpener when transform preallocated process. r=khuey

This commit is contained in:
Kan-Ru Chen (陳侃如) 2014-09-09 16:57:53 +08:00
Родитель 5ff4caf32e
Коммит 7d9927b1a4
2 изменённых файлов: 11 добавлений и 6 удалений

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

@ -651,7 +651,8 @@ ContentParent::GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
NS_ERROR("Failed to get manifest URL");
return nullptr;
}
process->TransformPreallocatedIntoApp(manifestURL);
process->TransformPreallocatedIntoApp(aOpener,
manifestURL);
if (aTookPreAllocated) {
*aTookPreAllocated = true;
}
@ -799,7 +800,7 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
// Try to take and transform the preallocated process into browser.
nsRefPtr<ContentParent> p = PreallocatedProcessManager::Take();
if (p) {
p->TransformPreallocatedIntoBrowser();
p->TransformPreallocatedIntoBrowser(aOpener);
} else {
// Failed in using the preallocated process: fork from the chrome process.
p = new ContentParent(/* app = */ nullptr,
@ -1383,17 +1384,20 @@ TryGetNameFromManifestURL(const nsAString& aManifestURL,
}
void
ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL)
ContentParent::TransformPreallocatedIntoApp(ContentParent* aOpener,
const nsAString& aAppManifestURL)
{
MOZ_ASSERT(IsPreallocated());
mOpener = aOpener;
mAppManifestURL = aAppManifestURL;
TryGetNameFromManifestURL(aAppManifestURL, mAppName);
}
void
ContentParent::TransformPreallocatedIntoBrowser()
ContentParent::TransformPreallocatedIntoBrowser(ContentParent* aOpener)
{
// Reset mAppManifestURL, mIsForBrowser and mOSPrivileges for browser.
mOpener = aOpener;
mAppManifestURL.Truncate();
mIsForBrowser = true;
}

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

@ -363,11 +363,12 @@ private:
// Transform a pre-allocated app process into a "real" app
// process, for the specified manifest URL.
void TransformPreallocatedIntoApp(const nsAString& aAppManifestURL);
void TransformPreallocatedIntoApp(ContentParent* aOpener,
const nsAString& aAppManifestURL);
// Transform a pre-allocated app process into a browser process. If this
// returns false, the child process has died.
void TransformPreallocatedIntoBrowser();
void TransformPreallocatedIntoBrowser(ContentParent* aOpener);
/**
* Mark this ContentParent as dead for the purposes of Get*().