Skip to content

Instantly share code, notes, and snippets.

@dcower
Created November 8, 2024 16:35
Show Gist options
  • Select an option

  • Save dcower/ebe2fd51a1b31c4b495b782d49fab6b6 to your computer and use it in GitHub Desktop.

Select an option

Save dcower/ebe2fd51a1b31c4b495b782d49fab6b6 to your computer and use it in GitHub Desktop.
Remove crashed sessions in Tabs Outliner
function search_and_remove() {
// Search for crashed windows and tabs. Reverse the list so that we delete
// from the bottom, which is MUCH faster.
elements = Array.from(document.querySelectorAll('li.savedwinNTASC,li.savedtabNTASC')).reverse();
if (elements.length == 0) {
console.log("Finished removing stale windows and tabs.");
return;
}
// Hover over the element.
elements[0].childNodes[0].dispatchEvent(new MouseEvent('mouseover', {
'view': window,
'bubbles': true,
'cancelable': true
}));
// Click the trash icon.
document.querySelectorAll('span.hoveringMenu_deleteAction')[0].click();
// Give a bit of time for the deletion to finish.
setTimeout(search_and_remove, 10);
}
@AnirudhaS
Copy link

The API seems to have changed recently. This version is working for deleting the crashed windows and tabs. Thanks!

@simPod
Copy link

simPod commented Sep 21, 2025

Works even today, thx

@IFlip92
Copy link

IFlip92 commented Sep 24, 2025

For me it does not work. When I try to run it Chrome just says "undefined" without specifying what.

@AnirudhaS
Copy link

For me it does not work. When I try to run it Chrome just says "undefined" without specifying what.

Make sure to declare the function in the console. And then run the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment