Bug 1557920 - Port bug 1555366 and bug 1557642 to about:support. r=jorgk
authorRichard Marti <richard.marti@gmail.com>
Sat, 08 Jun 2019 10:11:06 +0200
changeset 35843 f70af4f85c51f24777be1201b47800a1a30c8d47
parent 35842 11a90453a1d311cd8f24d21231591ae5760d392a
child 35844 32910388a6ee2f39c1ad7d015111aa3602bc4494
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersjorgk
bugs1557920, 1555366, 1557642
Bug 1557920 - Port bug 1555366 and bug 1557642 to about:support. r=jorgk Bug 1555366: Add installation directory to about:support Bug 1557642: Add Update Folder with Open Folder to about:support similar to how the Profile Folder is represented
mail/components/about-support/content/aboutSupport.js
mail/components/about-support/content/aboutSupport.xhtml
--- a/mail/components/about-support/content/aboutSupport.js
+++ b/mail/components/about-support/content/aboutSupport.js
@@ -65,24 +65,28 @@ function toFluentID(str) {
 // snapshot data.  Each function is passed its property's corresponding data,
 // and it's the function's job to update the page with it.
 var snapshotFormatters = {
 
   async application(data) {
     $("application-box").textContent = data.name;
     $("useragent-box").textContent = data.userAgent;
     $("os-box").textContent = data.osVersion;
+    $("binary-box").textContent = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
     $("supportLink").href = data.supportURL;
     let version = AppConstants.MOZ_APP_VERSION_DISPLAY;
     if (data.vendor)
       version += " (" + data.vendor + ")";
     $("version-box").textContent = version;
     $("buildid-box").textContent = data.buildID;
     if (data.updateChannel)
       $("updatechannel-box").textContent = data.updateChannel;
+    if (AppConstants.MOZ_UPDATER) {
+      $("update-dir-box").textContent = Services.dirsvc.get("UpdRootD", 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;
@@ -1280,43 +1284,60 @@ function safeModeRestart() {
 function onShowPrivateDataChange(aCheckbox) {
   document.getElementById("about-support-private").disabled = aCheckbox.checked;
 }
 
 /**
  * Set up event listeners for buttons.
  */
 function setupEventListeners() {
-  let button = $("show-update-history-button");
-  if (button) {
-    button.addEventListener("click", function(event) {
-      let uri = "chrome://mozapps/content/update/history.xul";
-      let features = "chrome,centerscreen,resizable=no,titlebar,toolbar=no," +
-                     "dialog=yes,modal";
-      Services.ww.openWindow(window, uri, "Update:History", features, null);
-    });
-  }
 /* not used by TB
-  button = $("reset-box-button");
+  let button = $("reset-box-button");
   if (button) {
     button.addEventListener("click", function(event) {
       ResetProfile.openConfirmationDialog(window);
     });
   }
 */
-  button = $("restart-in-safe-mode-button");
+  let button = $("restart-in-safe-mode-button");
   if (button) {
     button.addEventListener("click", function(event) {
       if (Services.obs.enumerateObservers("restart-in-safe-mode").hasMoreElements()) {
         Services.obs.notifyObservers(null, "restart-in-safe-mode");
       } else {
         safeModeRestart();
       }
     });
   }
+  if (AppConstants.MOZ_UPDATER) {
+    button = $("update-dir-button");
+    if (button) {
+      button.addEventListener("click", function(event) {
+        // Get the update directory.
+        let updateDir = Services.dirsvc.get("UpdRootD", Ci.nsIFile);
+        if (!updateDir.exists()) {
+          updateDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+        }
+        let updateDirPath = updateDir.path;
+        // Show the update directory.
+        let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
+                                                 "nsIFile", "initWithPath");
+        new nsLocalFile(updateDirPath).reveal();
+      });
+    }
+    button = $("show-update-history-button");
+    if (button) {
+      button.addEventListener("click", function(event) {
+        let uri = "chrome://mozapps/content/update/history.xul";
+        let features = "chrome,centerscreen,resizable=no,titlebar,toolbar=no," +
+                       "dialog=yes,modal";
+        Services.ww.openWindow(window, uri, "Update:History", features, null);
+      });
+    }
+  }
   button = $("verify-place-integrity-button");
   if (button) {
     button.addEventListener("click", function(event) {
       PlacesDBUtils.checkAndFixDatabase().then((tasksStatusMap) => {
         let logs = [];
         for (let [key, value] of tasksStatusMap) {
           logs.push(`> Task: ${key}`);
           let prefix = value.succeeded ? "+ " : "- ";
--- a/mail/components/about-support/content/aboutSupport.xhtml
+++ b/mail/components/about-support/content/aboutSupport.xhtml
@@ -100,16 +100,26 @@
 
           <tr>
             <th class="column" data-l10n-id="app-basics-build-id"/>
             <td id="buildid-box"></td>
           </tr>
 
 #ifndef ANDROID
 #ifdef MOZ_UPDATER
+          <tr id="update-row" class="no-copy">
+            <th class="column" data-l10n-id="app-basics-update-dir"/>
+
+            <td>
+              <button id="update-dir-button" data-l10n-id="show-dir-label"/>
+               <span id="update-dir-box">
+               </span>
+            </td>
+          </tr>
+
           <tr class="no-copy">
             <th class="column" data-l10n-id="app-basics-update-history"/>
 
             <td>
               <button id="show-update-history-button" data-l10n-id="app-basics-show-update-history"/>
             </td>
           </tr>
 #endif
@@ -131,16 +141,23 @@
 
           <tr>
             <th class="column" data-l10n-id="app-basics-os"/>
 
             <td id="os-box">
             </td>
           </tr>
 
+          <tr class="no-copy">
+            <th class="column" data-l10n-id="app-basics-binary"/>
+
+            <td id="binary-box">
+            </td>
+          </tr>
+
           <tr id="profile-row" class="no-copy">
             <th class="column" data-l10n-id="app-basics-profile-dir"/>
 
             <td>
               <button id="profile-dir-button" data-l10n-id="show-dir-label"/>
                <span id="profile-dir-box">
                </span>
             </td>