Bug 1557642 - Add Update Directory with the ability to open the directory to about:support. r=bytesized,flod,fluent-reviewers
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 07 Jun 2019 17:01:56 +0000
changeset 477886 90fa7d261787a5f3d69dcc5d95cfbb316f20ca7e
parent 477885 11921c8b4eb05f392adf4cdaf34e5698a2c1c999
child 477887 d820bbb356aaae7b17231df39e7ac0fda9c77493
push id36125
push userapavel@mozilla.com
push dateFri, 07 Jun 2019 22:00:07 +0000
treeherdermozilla-central@d820bbb356aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized, flod, fluent-reviewers
bugs1557642
milestone69.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 1557642 - Add Update Directory with the ability to open the directory to about:support. r=bytesized,flod,fluent-reviewers Differential Revision: https://phabricator.services.mozilla.com/D34120
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -51,16 +51,19 @@ var snapshotFormatters = {
     $("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;
+    }
     $("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:
@@ -1220,41 +1223,58 @@ function safeModeRestart() {
   if (!cancelQuit.data) {
     Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
   }
 }
 /**
  * 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);
-    });
-  }
-  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");
   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/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -75,16 +75,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
--- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
@@ -31,16 +31,21 @@ features-id = ID
 processes-title = Remote Processes
 processes-type = Type
 processes-count = Count
 app-basics-title = Application Basics
 app-basics-name = Name
 app-basics-version = Version
 app-basics-build-id = Build ID
 app-basics-update-channel = Update Channel
+app-basics-update-dir =
+    { PLATFORM() ->
+        [linux] Update Directory
+       *[other] Update Folder
+    }
 app-basics-update-history = Update History
 app-basics-show-update-history = Show Update History
 # Represents the path to the binary used to start the application.
 app-basics-binary = Application Binary
 app-basics-profile-dir =
     { PLATFORM() ->
         [linux] Profile Directory
        *[other] Profile Folder