Bug 1507874 - Port bug 1507640: Remove about:support "Show update history" button when the updater is disabled. r=jorgk CLOSED TREE
authorRichard Marti <richard.marti@gmail.com>
Fri, 16 Nov 2018 19:48:40 +0100
changeset 33726 062d7a8d50be38a9b05c584051ace406f2cf1fca
parent 33725 fa82003e8d33fd5e1759a7b183fc65c18ebb207f
child 33727 8cf3f95e48e8b97a754cd22446ef6231e65791d3
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1507874, 1507640
Bug 1507874 - Port bug 1507640: Remove about:support "Show update history" button when the updater is disabled. r=jorgk CLOSED TREE
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
@@ -95,32 +95,35 @@ var snapshotFormatters = {
                                               "/" +
                                               data.maxContentProcesses;
     } else {
       $("contentprocesses-row").hidden = true;
     }
 
     if (Services.policies) {
       let policiesText = "";
+      let aboutPolicies = "about:policies";
       switch (data.policiesStatus) {
         case Services.policies.INACTIVE:
           policiesText = strings.GetStringFromName("policies.inactive");
           break;
 
         case Services.policies.ACTIVE:
           policiesText = strings.GetStringFromName("policies.active");
+          aboutPolicies += "#active";
           break;
 
         default:
           policiesText = strings.GetStringFromName("policies.error");
+          aboutPolicies += "#errors";
           break;
       }
 
       if (data.policiesStatus != Services.policies.INACTIVE) {
-        let activePolicies = $.new("a", policiesText, null, {href: "about:policies"});
+        let activePolicies = $.new("a", policiesText, null, {href: aboutPolicies});
         $("policies-status").appendChild(activePolicies);
       } else {
         $("policies-status").textContent = policiesText;
       }
     } else {
       $("policies-status-row").hidden = true;
     }
 
@@ -1239,47 +1242,67 @@ function safeModeRestart() {
 function onShowPrivateDataChange(aCheckbox) {
   document.getElementById("about-support-private").disabled = aCheckbox.checked;
 }
 
 /**
  * Set up event listeners for buttons.
  */
 function setupEventListeners() {
-  $("show-update-history-button").addEventListener("click", function(event) {
-    var prompter = Cc["@mozilla.org/updates/update-prompt;1"].createInstance(Ci.nsIUpdatePrompt);
+  let button = $("show-update-history-button");
+  if (button) {
+    button.addEventListener("click", function(event) {
+      var prompter = Cc["@mozilla.org/updates/update-prompt;1"].createInstance(Ci.nsIUpdatePrompt);
       prompter.showUpdateHistory(window);
+    });
+  }
+/* not used by TB
+  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();
+      }
+    });
+  }
+  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 ? "+ " : "- ";
+          logs = logs.concat(value.logs.map(m => `${prefix}${m}`));
+        }
+        $("verify-place-result").style.display = "block";
+        $("verify-place-result").classList.remove("no-copy");
+        $("verify-place-result").textContent = logs.join("\n");
+      });
+    });
+  }
+
+  // added for TB
+  $("send-via-email").addEventListener("click", function(event) {
+    sendViaEmail();
   });
+  // end of TB addition
 /* not used by TB
-  $("reset-box-button").addEventListener("click", function(event) {
-    ResetProfile.openConfirmationDialog(window);
-  });
   $("copy-raw-data-to-clipboard").addEventListener("click", function(event) {
     copyRawDataToClipboard(this);
   });
 */
   $("copy-to-clipboard").addEventListener("click", function(event) {
     copyContentsToClipboard();
   });
-  // added for TB
-  $("send-via-email").addEventListener("click", function(event) {
-    sendViaEmail();
-  });
-  // end of TB addition
   $("profile-dir-button").addEventListener("click", function(event) {
     openProfileDirectory();
   });
-  $("restart-in-safe-mode-button").addEventListener("click", function(event) {
-    if (Services.obs.enumerateObservers("restart-in-safe-mode").hasMoreElements()) {
-      Services.obs.notifyObservers(null, "restart-in-safe-mode");
-    } else {
-      safeModeRestart();
-    }
-  });
-  $("verify-place-integrity-button").addEventListener("click", function(event) {
-    PlacesDBUtils.checkAndFixDatabase(function(aLog) {
-      let msg = aLog.join("\n");
-      $("verify-place-result").style.display = "block";
-      $("verify-place-result").classList.remove("no-copy");
-      $("verify-place-result").textContent = msg;
-    });
-  });
 }
--- a/mail/components/about-support/content/aboutSupport.xhtml
+++ b/mail/components/about-support/content/aboutSupport.xhtml
@@ -119,28 +119,30 @@
           <tr>
             <th class="column">
               &aboutSupport.appBasicsBuildID;
               </th>
             <td id="buildid-box"></td>
           </tr>
 
 #ifndef ANDROID
+#ifdef MOZ_UPDATER
           <tr class="no-copy">
             <th class="column">
               &aboutSupport.appBasicsUpdateHistory;
             </th>
 
             <td>
               <button id="show-update-history-button">
                 &aboutSupport.appBasicsShowUpdateHistory;
               </button>
             </td>
           </tr>
 #endif
+#endif
 
 #ifdef MOZ_UPDATER
           <tr>
             <th class="column">
               &aboutSupport.appBasicsUpdateChannel;
             </th>
             <td id="updatechannel-box"></td>
           </tr>