Bug 944450 - Collect UITelemetry on number of tabs opened. r=Gijs, a=lsblakk.
authorMike Conley <mconley@mozilla.com>
Mon, 16 Dec 2013 11:45:54 -0500
changeset 167725 73aedac83ac732bae8730b5c6b83a80fa2741a40
parent 167724 84d1ee47e83c32af465d65ace1482424f551beef
child 167726 262bd97fdd8ca101a3c008d492c248f245588de0
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, lsblakk
bugs944450
milestone27.0
Bug 944450 - Collect UITelemetry on number of tabs opened. r=Gijs, a=lsblakk.
browser/modules/BrowserUITelemetry.jsm
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -506,16 +506,31 @@ this.BrowserUITelemetry = {
     let defaultRemoved = [node.id for (node of paletteChildren)
                           if (DEFAULT_ITEMS.indexOf(node.id) != -1)];
 
     result.defaultKept = defaultKept;
     result.defaultMoved = defaultMoved;
     result.nondefaultAdded = nondefaultAdded;
     result.defaultRemoved = defaultRemoved;
 
+    // Find out how many open tabs we have in each window
+    let winEnumerator = Services.wm.getEnumerator("navigator:browser");
+    let visibleTabs = [];
+    let hiddenTabs = [];
+    while (winEnumerator.hasMoreElements()) {
+      let someWin = winEnumerator.getNext();
+      if (someWin.gBrowser) {
+        let visibleTabsNum = someWin.gBrowser.visibleTabs.length;
+        visibleTabs.push(visibleTabsNum);
+        hiddenTabs.push(someWin.gBrowser.tabs.length - visibleTabsNum);
+      }
+    }
+    result.visibleTabs = visibleTabs;
+    result.hiddenTabs = hiddenTabs;
+
     result.countableEvents = this._countableEvents;
 
     return result;
   },
 };
 
 /**
  * Returns the id of the first ancestor of aNode that has an id, with