Bug 1496608 - Don't leak GeckoChildProcessHost when a content process fails to launch. r=mccr8
☠☠ backed out by b0e69b136883 ☠ ☠
authorJed Davis <jld@mozilla.com>
Thu, 22 Nov 2018 00:06:09 +0000
changeset 504600 8ede2ebe6b7ab639e729614cb3609776955a6bc2
parent 504599 cea43bc88c7a564f0ca72995f6eac6b0d118f3f1
child 504601 37bf52f0e9cf2ccd4427197a2e99f40c239f01a7
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [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()));