Bug 1348547 - ReleaseCachedProcesses() between aboutdebugging tests. r=gabor, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Tue, 04 Apr 2017 09:45:20 -0600
changeset 395799 fe788c5c3a4f3ace4360c86906bd191c98106cfd
parent 395798 87dc33c4e22658e1b9464766622f7f01e722f439
child 395800 faf1b27107b20297d49a6abfded2fdf556e0e356
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor, test-only
bugs1348547
milestone54.0a2
Bug 1348547 - ReleaseCachedProcesses() between aboutdebugging tests. r=gabor, a=test-only
devtools/client/aboutdebugging/test/head.js
dom/ipc/ContentParent.cpp
--- a/devtools/client/aboutdebugging/test/head.js
+++ b/devtools/client/aboutdebugging/test/head.js
@@ -428,10 +428,11 @@ function enableServiceWorkerDebugging() 
       // Enable service workers.
       ["dom.serviceWorkers.enabled", true],
       // Accept workers from mochitest's http.
       ["dom.serviceWorkers.testing.enabled", true],
       // Force single content process.
       ["dom.ipc.processCount", 1],
     ]};
     SpecialPowers.pushPrefEnv(options, done);
+    Services.ppmm.releaseCachedProcesses();
   });
 }
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -739,16 +739,20 @@ ContentParent::GetMaxProcessCount(const 
 ContentParent::IsMaxProcessCountReached(const nsAString& aContentProcessType)
 {
   return GetPoolSize(aContentProcessType) >= GetMaxProcessCount(aContentProcessType);
 }
 
 /*static*/ void
 ContentParent::ReleaseCachedProcesses()
 {
+  if (!GetPoolSize(NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE))) {
+    return;
+  }
+
   // We might want to extend this for other process types as well in the future...
   nsTArray<ContentParent*>& contentParents = GetOrCreatePool(NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
   ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
   nsTArray<ContentParent*> toRelease;
 
   // Shuting down these processes will change the array so let's use another array for the removal.
   for (auto* cp : contentParents) {
     nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(cp->mChildID);