¯\_(ツ)_/¯

thunder@home:~$

This is my home blog, mostly to share some useful info or code snippets
~ 1 min

Hi, everyone!

There is a grean extension for Google Chrome browser – Tabs Outliner

Tabs Outliner is a fusion of tabs manager, session manager, and a tree like personal information organizer. It’s also embed instruments that greatly help reduce open tabs count by making it possible to easily annotate and close-save open windows and tabs in their original context. And what’s more important - allow them to work with their saved tabs practically in the same way as with open ones, thus greatly reducing resource usage.

It also implements one of the best ways to handle crashed sessions - an unfortunate reality for users with a habit of accumulating hundreds of open tabs.

At some point, I saw that I have a lot of crashed sessions in Tab Outliner history. And Database of this extension which keeps all that opened tabs, sessions, is over 3Gb!

Each time you close Chrome, it saves your session… I had a lot of such crashed entries… starting 2016…

The only option is to click each group to collapse and then Delete button, because if you click Delete button on a non-collapsed entry, it will delete only this entry, leaving sub-entries unbound. Sad.

But there is another way!

Open Tab Outliner window, go to Developer Console (push Control-Shift-I), open Javascript Console and enter following commands:

treeView.treeModel.currentSession_rootNode.subnodes.forEach(n => n.setCollapsing(true));

This will collapse all Sessions. Then run this script to Delete all sessions which has crashed in title:

let i = 0;
let t = setInterval(() => {
    let n = treeView.treeModel.currentSession_rootNode.subnodes[i];
    if (n.getNodeText().includes(" (crashed ")) {
        console.log(`Removing node ${n.getNodeText()}`, n);
        n.removeOwnTreeFromParent();
    } else {
        i++;
    }
    if (i == treeView.treeModel.currentSession_rootNode.subnodes.length) {
        clearInterval(t);
    }
}, 100);

Oneliner for the code above:

let i = 0; let t = setInterval(() => { let n = treeView.treeModel.currentSession_rootNode.subnodes[i]; if (n.getNodeText().includes(" (crashed ")) { console.log(`Removing node ${n.getNodeText()}`, n); n.removeOwnTreeFromParent(); } else { i++; } if (i == treeView.treeModel.currentSession_rootNode.subnodes.length) { clearInterval(t); } }, 100);

That is it!

Thank You For Reading