Bug 1517636: Add launcher process state to about:support; r=Felipe,flod
authorAaron Klotz <aklotz@mozilla.com>
Wed, 16 Jan 2019 00:22:19 +0000
changeset 514031 447687e20dac74b338c8955ebb2d35ddfebd1fc7
parent 514030 e2b32bfc7522e311d487fbc1193c3e9348ab647c
child 514032 1f0d9b94c057fd473932d359d7e04289c6d4016e
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, flod
bugs1517636
milestone66.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 1517636: Add launcher process state to about:support; r=Felipe,flod Differential Revision: https://phabricator.services.mozilla.com/D15759
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
toolkit/xre/LauncherRegistryInfo.h
toolkit/xre/nsAppRunner.cpp
xpcom/system/nsIXULRuntime.idl
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -53,16 +53,29 @@ var snapshotFormatters = {
     if (data.vendor)
       version += " (" + data.vendor + ")";
     $("version-box").textContent = version;
     $("buildid-box").textContent = data.buildID;
     if (data.updateChannel)
       $("updatechannel-box").textContent = data.updateChannel;
     $("profile-dir-box").textContent = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
 
+    try {
+      let launcherStatusTextId = "launcher-process-status-unknown";
+      switch (data.launcherProcessState) {
+        case 0:
+        case 1:
+        case 2:
+          launcherStatusTextId = "launcher-process-status-" + data.launcherProcessState;
+          break;
+      }
+
+      document.l10n.setAttributes($("launcher-process-box"), launcherStatusTextId);
+    } catch (e) {}
+
     let statusTextId = "multi-process-status-unknown";
 
     // Whitelist of known values with string descriptions:
     switch (data.autoStartStatus) {
       case 0:
       case 1:
       case 2:
       case 4:
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -158,16 +158,25 @@
           <tr class="no-copy">
             <th class="column" data-l10n-id="app-basics-service-workers"/>
 
             <td>
               <a href="about:serviceworkers">about:serviceworkers</a>
             </td>
           </tr>
 
+#if defined(XP_WIN) && defined(MOZ_LAUNCHER_PROCESS)
+          <tr>
+            <th class="column" data-l10n-id="app-basics-launcher-process-status"/>
+
+            <td id="launcher-process-box">
+            </td>
+          </tr>
+#endif
+
           <tr>
             <th class="column" data-l10n-id="app-basics-multi-process-support"/>
 
             <td id="multiprocess-box">
               <span id="multiprocess-box-process-count"/>
               <span id="multiprocess-box-status" data-l10n-id="multi-process-status-unknown"/>
             </td>
           </tr>
--- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
@@ -43,16 +43,17 @@ app-basics-profile-dir =
 app-basics-enabled-plugins = Enabled Plugins
 app-basics-build-config = Build Configuration
 app-basics-user-agent = User Agent
 app-basics-os = OS
 app-basics-memory-use = Memory Use
 app-basics-performance = Performance
 app-basics-service-workers = Registered Service Workers
 app-basics-profiles = Profiles
+app-basics-launcher-process-status = Launcher Process
 app-basics-multi-process-support = Multiprocess Windows
 app-basics-process-count = Web Content Processes
 app-basics-enterprise-policies = Enterprise Policies
 app-basics-key-google = Google Key
 app-basics-key-mozilla = Mozilla Location Service Key
 app-basics-safe-mode = Safe Mode
 show-dir-label =
     { PLATFORM() ->
@@ -255,16 +256,21 @@ has-privileged-user-namespaces = User Na
 can-sandbox-content = Content Process Sandboxing
 can-sandbox-media = Media Plugin Sandboxing
 content-sandbox-level = Content Process Sandbox Level
 effective-content-sandbox-level = Effective Content Process Sandbox Level
 sandbox-proc-type-content = content
 sandbox-proc-type-file = file content
 sandbox-proc-type-media-plugin = media plugin
 
+launcher-process-status-0 = Enabled
+launcher-process-status-1 = Disabled due to failure
+launcher-process-status-2 = Disabled forcibly
+launcher-process-status-unknown = Unknown status
+
 # Variables
 # $remoteWindows (integer) - Number of remote windows
 # $totalWindows (integer) - Number of total windows
 multi-process-windows = { $remoteWindows }/{ $totalWindows }
 multi-process-status-0 = Enabled by user
 multi-process-status-1 = Enabled by default
 multi-process-status-2 = Disabled
 multi-process-status-4 = Disabled by accessibility tools
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -192,16 +192,20 @@ var dataProviders = {
       data.numTotalWindows++;
       let remote = docShell.QueryInterface(Ci.nsILoadContext)
                    .useRemoteTabs;
       if (remote) {
         data.numRemoteWindows++;
       }
     }
 
+    try {
+      data.launcherProcessState = Services.appinfo.launcherProcessState;
+    } catch(e) {}
+
     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;
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -120,16 +120,19 @@ const SNAPSHOT_SCHEMA = {
           type: "string",
         },
         updateChannel: {
           type: "string",
         },
         supportURL: {
           type: "string",
         },
+        launcherProcessState: {
+          type: "number",
+        },
         remoteAutoStart: {
           type: "boolean",
           required: true,
         },
         autoStartStatus: {
           type: "number",
         },
         numTotalWindows: {
--- a/toolkit/xre/LauncherRegistryInfo.h
+++ b/toolkit/xre/LauncherRegistryInfo.h
@@ -21,20 +21,20 @@
  */
 
 namespace mozilla {
 
 class LauncherRegistryInfo final {
  public:
   enum class ProcessType { Launcher, Browser };
 
-  enum class EnabledState {
-    Enabled,
-    FailDisabled,
-    ForceDisabled,
+  enum class EnabledState : uint32_t {
+    Enabled = 0,
+    FailDisabled = 1,
+    ForceDisabled = 2,
   };
 
   LauncherRegistryInfo() : mBinPath(GetFullBinaryPath().get()) {}
 
   LauncherVoidResult ReflectPrefToRegistry(const bool aEnable);
   LauncherResult<EnabledState> IsEnabled();
   LauncherResult<ProcessType> Check(const ProcessType aDesiredType);
   LauncherVoidResult DisableDueToFailure();
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -940,16 +940,34 @@ nsXULAppInfo::GetWindowsDLLBlocklistStat
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetRestartedByOS(bool* aResult) {
   *aResult = gRestartedByOS;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsXULAppInfo::GetLauncherProcessState(uint32_t* aResult) {
+#if defined(XP_WIN) && defined(MOZ_LAUNCHER_PROCESS)
+  LauncherRegistryInfo launcherInfo;
+
+  LauncherResult<LauncherRegistryInfo::EnabledState> state =
+      launcherInfo.IsEnabled();
+  if (state.isErr()) {
+    return NS_ERROR_UNEXPECTED;
+  }
+
+  *aResult = static_cast<uint32_t>(state.unwrap());
+  return NS_OK;
+#else
+  return NS_ERROR_NOT_AVAILABLE;
+#endif
+}
+
 #ifdef XP_WIN
 // Matches the enum in WinNT.h for the Vista SDK but renamed so that we can
 // safely build with the Vista SDK and without it.
 typedef enum {
   VistaTokenElevationTypeDefault = 1,
   VistaTokenElevationTypeFull,
   VistaTokenElevationTypeLimited
 } VISTA_TOKEN_ELEVATION_TYPE;
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -197,9 +197,15 @@ interface nsIXULRuntime : nsISupports
    */
   readonly attribute boolean windowsDLLBlocklistStatus;
 
   /**
    * True if this application was started by the OS as part of an automatic
    * restart mechanism (such as RegisterApplicationRestart on Windows).
    */
   readonly attribute boolean restartedByOS;
+
+  /**
+   * Returns a value corresponding to one of the
+   * |mozilla::LauncherRegistryInfo::EnabledState| values.
+   */
+  readonly attribute uint32_t launcherProcessState;
 };