Bug 1502440 - Hide browser internals in about:performance for beta and release users, r=felipe a=jcristau
authorFlorian Quèze <florian@queze.net>
Wed, 31 Oct 2018 19:10:51 +0100
changeset 501074 61362de96df954b728a8a9787e1839bc8b15dbc1
parent 501073 4bf79d20c6444193ca12af354163c448d81a1f44
child 501075 02f3ab06c2eb5abc97b49c12d3702d50c439526f
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe, jcristau
bugs1502440
milestone64.0
Bug 1502440 - Hide browser internals in about:performance for beta and release users, r=felipe a=jcristau
modules/libpref/init/all.js
toolkit/components/aboutperformance/content/aboutPerformance.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5866,16 +5866,22 @@ pref("dom.xhr.lowercase_header.enabled",
 
 // Control whether clients.openWindow() opens windows in the same process
 // that called the API vs following our normal multi-process selection
 // algorithm.  Restricting openWindow to same process improves service worker
 // web compat in the short term.  Once the SW multi-e10s refactor is complete
 // this can be removed.
 pref("dom.clients.openwindow_favors_same_process", true);
 
+#ifdef RELEASE_OR_BETA
+pref("toolkit.aboutPerformance.showInternals", false);
+#else
+pref("toolkit.aboutPerformance.showInternals", true);
+#endif
+
 // When a crash happens, whether to include heap regions of the crash context
 // in the minidump. Enabled by default on nightly and aurora.
 #ifdef RELEASE_OR_BETA
 pref("toolkit.crashreporter.include_context_heap", false);
 #else
 pref("toolkit.crashreporter.include_context_heap", true);
 #endif
 
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -601,53 +601,58 @@ var State = {
   getCounters() {
     tabFinder.update();
     // We rebuild the maps during each iteration to make sure that
     // we do not maintain references to groups that has been removed
     // (e.g. pages that have been closed).
 
     let previous = this._buffer[Math.max(this._buffer.length - 2, 0)].tabs;
     let current = this._latest.tabs;
-    return Object.keys(current).map(id => {
+    let counters = [];
+    for (let id of Object.keys(current)) {
       let tab = current[id];
       let oldest;
       for (let index = 0; index <= this._buffer.length - 2; ++index) {
         if (id in this._buffer[index].tabs) {
           oldest = this._buffer[index].tabs[id];
           break;
         }
       }
       let prev = previous[id];
       let host = tab.host;
 
-      let type = "tab";
+      let type = "other";
       let name = `${host} (${id})`;
       let image = "chrome://mozapps/skin/places/defaultFavicon.svg";
       let found = tabFinder.get(parseInt(id));
       if (found) {
         if (found.tabbrowser) {
           name = found.tab.getAttribute("label");
           image = found.tab.getAttribute("image");
+          type = "tab";
         } else {
           name = {id: "preloaded-tab",
                   title: found.tab.linkedBrowser.contentTitle};
-          type = "other";
         }
       } else if (id == 1) {
         name = BRAND_NAME;
         image = "chrome://branding/content/icon32.png";
         type = "browser";
       } else if (/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(host)) {
         let addon = WebExtensionPolicy.getByHostname(host);
         name = `${addon.name} (${addon.id})`;
         image = "chrome://mozapps/skin/extensions/extensionGeneric-16.svg";
         type = "addon";
       } else if (id == 0 && !tab.isWorker) {
         name = {id: "ghost-windows"};
-        type = "other";
+      }
+
+      if (type != "tab" && type != "addon" &&
+          !Services.prefs.getBoolPref("toolkit.aboutPerformance.showInternals", false)) {
+        continue;
       }
 
       // Create a map of all the child items from the previous time we read the
       // counters, indexed by counterId so that we can quickly find the previous
       // value for any subitem.
       let prevChildren = new Map();
       if (prev) {
         for (let child of prev.children) {
@@ -696,22 +701,23 @@ var State = {
           dispatches - prev.dispatchCount - (prev.dispatchesFromFormerChildren || 0);
       }
       if (oldest) {
         dispatchesSinceStartOfBuffer =
           dispatches - oldest.dispatchCount - (oldest.dispatchesFromFormerChildren || 0);
         durationSinceStartOfBuffer =
           duration - oldest.duration - (oldest.durationFromFormerChildren || 0);
       }
-      return ({id, name, image, type,
-               totalDispatches: dispatches, totalDuration: duration,
-               durationSincePrevious, dispatchesSincePrevious,
-               durationSinceStartOfBuffer, dispatchesSinceStartOfBuffer,
-               children});
-    });
+      counters.push({id, name, image, type,
+                     totalDispatches: dispatches, totalDuration: duration,
+                     durationSincePrevious, dispatchesSincePrevious,
+                     durationSinceStartOfBuffer, dispatchesSinceStartOfBuffer,
+                     children});
+    }
+    return counters;
   },
 };
 
 var View = {
   /**
    * A cache for all the per-item DOM elements that are reused across refreshes.
    *
    * Reusing the same elements means that elements that were hidden (respectively