From 7d9927b1a4462180f2fd75845c8eda47c27edd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Tue, 9 Sep 2014 16:57:53 +0800 Subject: [PATCH] Bug 1040561 - Part 4. Initialize mOpener when transform preallocated process. r=khuey --- dom/ipc/ContentParent.cpp | 12 ++++++++---- dom/ipc/ContentParent.h | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 181e0f724067..a26f41107b51 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -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 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; } diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 8ef5f160c523..e56e5be6102a 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -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*().