Bug 1381175 - Display count of web content processes in about:support. r=mrbkap draft
authorFelipe Gomes <felipc@gmail.com>
Fri, 14 Jul 2017 20:33:07 -0300
changeset 609168 7dffdd8b018de25fd74db08f57a35ec14734027a
parent 609005 7d92f47379da55adf4da6d0b16398f5c629cf949
child 637527 1cde5d74a3b52f4eb544645150a7a1ff12320589
push id68530
push userfelipc@gmail.com
push dateFri, 14 Jul 2017 23:33:32 +0000
reviewersmrbkap
bugs1381175
milestone56.0a1
Bug 1381175 - Display count of web content processes in about:support. r=mrbkap MozReview-Commit-ID: 55j6uusx3RL
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/chrome/global/aboutSupport.dtd
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -67,16 +67,24 @@ var snapshotFormatters = {
       case 10:
         statusText = (Services.appinfo.OS == "Darwin" ? "OS X 10.6 - 10.8" : "Windows XP");
         break;
     }
 
     $("multiprocess-box").textContent = strings.formatStringFromName("multiProcessWindows",
       [data.numRemoteWindows, data.numTotalWindows, statusText], 3);
 
+    if (data.remoteAutoStart) {
+      $("contentprocesses-box").textContent = data.currentContentProcesses +
+                                              "/" +
+                                              data.maxContentProcesses;
+    } else {
+      $("contentprocesses-row").hidden = true;
+    }
+
     let styloReason;
     if (!data.styloBuild) {
       styloReason = strings.GetStringFromName("disabledByBuild");
     } else if (data.styloResult != data.styloDefault) {
       if (data.styloResult) {
         styloReason = strings.GetStringFromName("enabledByUser");
       } else {
         styloReason = strings.GetStringFromName("disabledByUser");
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -223,16 +223,25 @@
             <th class="column">
               &aboutSupport.appBasicsMultiProcessSupport;
             </th>
 
             <td id="multiprocess-box">
             </td>
           </tr>
 
+          <tr id="contentprocesses-row">
+            <th class="column">
+              &aboutSupport.appBasicsProcessCount;
+            </th>
+
+            <td id="contentprocesses-box">
+            </td>
+          </tr>
+
           <tr>
             <th class="column">
               Stylo
             </th>
 
             <td id="stylo-box">
             </td>
           </tr>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -65,16 +65,18 @@ Windows/Mac use the term "Folder" instea
 
 <!-- LOCALIZATION NOTE the term "Service Workers" should not be translated. -->
 <!ENTITY aboutSupport.appBasicsServiceWorkers "Registered Service Workers">
 
 <!ENTITY aboutSupport.appBasicsProfiles "Profiles">
 
 <!ENTITY aboutSupport.appBasicsMultiProcessSupport "Multiprocess Windows">
 
+<!ENTITY aboutSupport.appBasicsProcessCount "Web Content Processes">
+
 <!ENTITY aboutSupport.appBasicsKeyGoogle "Google Key">
 <!ENTITY aboutSupport.appBasicsKeyMozilla "Mozilla Location Service Key">
 
 <!ENTITY aboutSupport.appBasicsSafeMode "Safe Mode">
 
 <!ENTITY aboutSupport.showDir.label "Open Directory">
 <!-- LOCALIZATION NOTE (aboutSupport.showMac.label): This is the Mac-specific
 variant of aboutSupport.showDir.label.  This allows us to use the preferred
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -211,16 +211,23 @@ var dataProviders = {
                    useRemoteTabs;
       if (remote) {
         data.numRemoteWindows++;
       }
     }
 
     data.remoteAutoStart = Services.appinfo.browserTabsRemoteAutostart;
 
+    // Services.ppmm.childCount is a count of how many processes currently
+    // exist that might respond to messages sent through the ppmm, including
+    // the parent process. So we subtract the parent process with the "- 1",
+    // and that’s how many content processes we’re waiting for.
+    data.currentContentProcesses = Services.ppmm.childCount - 1;
+    data.maxContentProcesses = Services.appinfo.maxWebProcessCount;
+
     try {
       let e10sStatus = Cc["@mozilla.org/supports-PRUint64;1"]
                          .createInstance(Ci.nsISupportsPRUint64);
       let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
       appinfo.observe(e10sStatus, "getE10SBlocked", "");
       data.autoStartStatus = e10sStatus.data;
     } catch (e) {
       data.autoStartStatus = -1;
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -133,16 +133,22 @@ const SNAPSHOT_SCHEMA = {
           type: "number",
         },
         numTotalWindows: {
           type: "number",
         },
         numRemoteWindows: {
           type: "number",
         },
+        currentContentProcesses: {
+          type: "number",
+        },
+        maxContentProcesses: {
+          type: "number",
+        },
         styloBuild: {
           type: "boolean",
         },
         styloDefault: {
           type: "boolean",
         },
         styloResult: {
           type: "boolean",