Bug 1496608 - Don't leak GeckoChildProcessHost when a content process fails to launch. r=mccr8
authorJed Davis <jld@mozilla.com>
Wed, 28 Nov 2018 20:42:07 +0000
changeset 507799 1b92017b48651531b42b12856acf0f36001168ae
parent 507798 e0e1a14b592fd45b1e4c8dffe51d68dbe84cd265
child 507800 25b4fcd4382dfa21ee08f1b7604c649132f52500
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1496608
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496608 - Don't leak GeckoChildProcessHost when a content process fails to launch. r=mccr8 Depends on D8939 Differential Revision: https://phabricator.services.mozilla.com/D8940
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2453,16 +2453,22 @@ ContentParent::~ContentParent()
   if (IsForJSPlugin()) {
     MOZ_ASSERT(!sJSPluginContentParents ||
                !sJSPluginContentParents->Get(mJSPluginID));
   } else {
     MOZ_ASSERT(!sBrowserContentParents ||
                !sBrowserContentParents->Contains(mRemoteType) ||
                !sBrowserContentParents->Get(mRemoteType)->Contains(this));
   }
+
+  // Normally mSubprocess is destroyed in ActorDestroy, but that won't
+  // happen if the process wasn't launched or if it failed to launch.
+  if (mSubprocess) {
+    DelayedDeleteSubprocess(mSubprocess);
+  }
 }
 
 void
 ContentParent::InitInternal(ProcessPriority aInitialPriority)
 {
   Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
                         static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
                                               .ToMilliseconds()));