After a recent Windows crash, restarting Chrome would not open all the windows and tabs I had collected, despite its nice “Restore previous session” question.
None of the tips I found on the net helped recovering those tabs:
- copying Session and Tabs files,
- adding the –restore-last-session command line parameter,
- there is no Recent Tabs menu item
- changing exited_cleanly did nothing
Anyway, I found that the tabs suspended by The Great Suspender were most likely not contained in the Tabs file, so where is that information stored?
By looking at the source it turns out that TGS stores its data in an IndexedDB.
To access this database, you need to open TGS’s extension URL chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html. Using F12 (Developer Tools) and selecting Resources, you find “tgs” under IndexedDB, containing the tables gsCurrentSessions, gsSuspendedTabInfo, gsPreviews, and gsSavedSessions.
Unfortunately, currently there is no way to export this data directly from the DevTools, so we need a little bit of scripting magic.
After copying and pasting from MDN’s IndexedDB API documentation and sample code and some trial and error, I finally completed a small Javascript script which, when entered in the Developer Tools’ Console, results in a JSON-formatted list of all suspended tabs:
var db; var result=""; var record=0; var dbor = window.indexedDB.open("tgs"); dbor.onsuccess = function(event) { db = dbor.result; db.transaction(["gsSuspendedTabInfo"], "readonly") .objectStore("gsSuspendedTabInfo") .openCursor() .onsuccess= function(event) { var c=event.target.result; if (c){ result+=JSON.stringify(c.value)+"\r\n"; console.log(record++); c.continue(); } else { console.log(result); } }; };
A single JSON record of a suspended tab looks like this:
{ "date":"2015-12-14T18:40:55.563Z", "title":".validate() | jQuery Validation Plugin", "url":"http://jqueryvalidation.org/validate#toptions", "favicon":"chrome://favicon/http://jqueryvalidation.org/validate#toptions", "pinned":false, "index":3, "windowId":2898, "id":1281 }
Of course, you can process each tab’s record (c.value in the code above) any way you need.
What if I can’t boot to my screen and I can only access my HDD from another PC? How can I open that database for looking into that precious session info?
Thanks in advance and thanks already for the tip
Have a look at the files in directory [user]\AppData\Local\Google\Chrome\User Data\Default\IndexedDB\chrome-extension_klbibkeccnjlkjkiokjodocebajanakg_0.indexeddb.leveldb. Maybe it’s sufficient to copy them into your chrome profile. Just an idea though…
Oh shit it worked! 😀 It didn’t show up at first but I was able to recall them because they were listed nicely in the extension as nothing happened. Thank you.
Not sure if it will be useful but I had to modify the script to get it running (after backing up my profile, reinstalling chrome, moving the database over like you suggested in your other comment).
var db;
var result=””;
var record=0;
var dbor = window.indexedDB.open(“tgs”);
dbor.onsuccess = function (event) {
db = dbor.result;
db.transaction([“gsSuspendedTabInfo”], “readonly”)
.objectStore(“gsSuspendedTabInfo”)
.openCursor()
.onsuccess= function(event) {
var c=event.target.result;
if (c){
result+=JSON.stringify(c.value)+”\r\n”;
console.log(record++);
c.continue();
} else {
console.log(result);
}
};
};
This was on a Mac.
That long complicated link (kibkib… etc) you offered did not open. Is there an alternative?
seems like wordpress does not recognize “chrome-extension://” as valid protocol, and creates an “http://” URL instead. apparently pasting the URL in a comment chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html works. another way is to click the icon of The Great Suspender and going to Settings, and editing the URL from there.