My Firefox usage has always been a bit excessive. I used to open windows to group my different tasks. Then Panorama came along and I started using groups. Then I had too many groups so I started opening new windows. Luckily I set max_concurrent_tabs to 0 so I avoid loading all of those pages at startup (it’s that BarTab-like thing).

simple tab stats

My curiosity got the better of me so I wrote a little script to tell me some facts about my usage. There are extensions that do some or all of this, but I didn’t actually want to install anything, I just wanted a quick snapshot of what was up. (That said I might turn it into an about:something sort of extension.) You can see what it tells you - it’s not much but it told me what I wanted to know. My usage was higher earlier today, and I’m sure there are people who are much more abusive of Firefox, so no judging.

/* Run this in your error console */
var wc=0, tc=0, tgc=0;
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var wm = Services.wm;
var ss = Cc[";1"].getService(Ci.nsISessionStore);
var e = wm.getEnumerator("navigator:browser");
var uc = { };
while (e.hasMoreElements()) {
var win = e.getNext();
var tabs = win.gBrowser.tabs;
tc += tabs.length;
var gd = ss.getWindowValue(win, "tabview-group");
tgc += gd ? Object.keys(JSON.parse(gd)).length : 1;
Array.forEach(tabs, function(t) {
var url = t.linkedBrowser.currentURI.spec;
if (!(url in uc)) {
uc[url] = 0;
var ssFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
var stream = Cc[";1"].createInstance(Ci.nsIFileInputStream);
stream.init(ssFile, 0x01, 0, 0);
var cvstream = Cc[";1"].createInstance(Ci.nsIConverterInputStream);
var fs = stream.available();
var s = "Open windows: " + wc +
"\nOpen tabs: " + tc +
"\nTab Groups: " + tgc +
"\nsessionstore.js file size: " + DownloadUtils.convertByteUnits(fs).join("");
var s2 = "";
for ([u,c] in Iterator(uc)) {
if (c > 1) {
s2 += " " + c + " - " + u + "\n";
if (s2) {
s += "\nDuplicated urls:\n" + s2;
view raw run-this.js hosted with ❤ by GitHub

Judging me on coding style? I would be. I started writing this in the error console, so I left out whitespace and used shitty variable names. Then it grew up and got all awkward.