Bug 1419734 - Remove tab statistics lefovers. r=jdescottes draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 22 Nov 2017 08:19:03 -0800
changeset 702034 a778fbd11002d1229fa56753b0d4efe20545255c
parent 701872 5378dcb45044a160fad93b02eed0c617f3324dbc
child 741343 aca6dbc6e357c13d4e877855391742d279f4aec1
push id90355
push userbmo:poirot.alex@gmail.com
push dateWed, 22 Nov 2017 16:20:46 +0000
reviewersjdescottes
bugs1419734
milestone59.0a1
Bug 1419734 - Remove tab statistics lefovers. r=jdescottes MozReview-Commit-ID: GaMCH6BrFMP
devtools/client/framework/devtools-browser.js
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -55,23 +55,16 @@ var gDevToolsBrowser = exports.gDevTools
    */
   _browserStyleSheets: new WeakMap(),
 
   /**
    * WeakMap keeping track of DeveloperToolbar instances for each firefox window.
    */
   _toolbars: new WeakMap(),
 
-  _tabStats: {
-    peakOpen: 0,
-    peakPinned: 0,
-    histOpen: [],
-    histPinned: []
-  },
-
   /**
    * This function is for the benefit of Tools:DevToolbox in
    * browser/base/content/browser-sets.inc and should not be used outside
    * of there
    */
   // used by browser-sets.inc, command
   toggleToolboxCommand(gBrowser, startTime) {
     let target = TargetFactory.forTab(gBrowser.selectedTab);
@@ -471,20 +464,16 @@ var gDevToolsBrowser = exports.gDevTools
 
     this.updateCommandAvailability(win);
     this.updateDevtoolsThemeAttribute(win);
     this.ensurePrefObserver();
     win.addEventListener("unload", this);
 
     let tabContainer = win.gBrowser.tabContainer;
     tabContainer.addEventListener("TabSelect", this);
-    tabContainer.addEventListener("TabOpen", this);
-    tabContainer.addEventListener("TabClose", this);
-    tabContainer.addEventListener("TabPinned", this);
-    tabContainer.addEventListener("TabUnpinned", this);
   },
 
   /**
    * Create singleton instance of the developer toolbar for a given top level window.
    *
    * @param {Window} win
    *        The window to which the toolbar should be created.
    */
@@ -706,45 +695,20 @@ var gDevToolsBrowser = exports.gDevTools
       styleSheet.remove();
       this._browserStyleSheets.delete(win);
     }
 
     this._toolbars.delete(win);
 
     let tabContainer = win.gBrowser.tabContainer;
     tabContainer.removeEventListener("TabSelect", this);
-    tabContainer.removeEventListener("TabOpen", this);
-    tabContainer.removeEventListener("TabClose", this);
-    tabContainer.removeEventListener("TabPinned", this);
-    tabContainer.removeEventListener("TabUnpinned", this);
   },
 
   handleEvent(event) {
     switch (event.type) {
-      case "TabOpen":
-      case "TabClose":
-      case "TabPinned":
-      case "TabUnpinned":
-        let open = 0;
-        let pinned = 0;
-
-        for (let win of this._trackedBrowserWindows) {
-          let tabContainer = win.gBrowser.tabContainer;
-          let numPinnedTabs = win.gBrowser._numPinnedTabs || 0;
-          let numTabs = tabContainer.itemCount - numPinnedTabs;
-
-          open += numTabs;
-          pinned += numPinnedTabs;
-        }
-
-        this._tabStats.histOpen.push(open);
-        this._tabStats.histPinned.push(pinned);
-        this._tabStats.peakOpen = Math.max(open, this._tabStats.peakOpen);
-        this._tabStats.peakPinned = Math.max(pinned, this._tabStats.peakPinned);
-        break;
       case "TabSelect":
         gDevToolsBrowser._updateMenuCheckbox();
         break;
       case "unload":
         // top-level browser window unload
         gDevToolsBrowser._forgetBrowserWindow(event.target.defaultView);
         break;
     }