OneTab keep crashing

It was just a normal day, a day similar to others.  My OneTab was suddenly not working. Some people here might not know it, OneTab is a chrome extension that make keeping and restoring tabs easy.

Screenshot from 2016-04-06 18:04:16.png

Honestly , I didn’t get surprised. Why?

I have a habit of keeping lots of tabs open in multiple windows. In a regular day, I can open up to 30+ tabs easily. That’s why I need some tools like OneTab to manage all of them. Also, I keep all the lists even they are restored. This led to that over the past 2 years, I have 4k+ tab records inside the OneTab.

The reason is simple, when I open up the OneTab page, I have a sense that it becomes slower and slower, it’s because there are too many items in the page which may cause a memory leak. What’s worse is that I can’t even remove and export the data!

So, what can I do?

Popular Linux Distro mostly is storing the data of the chrome extensions under the following path:

 /home/{YOURNAME}/.config/google-chrome/Default/Local Storage

For each extensions, there would be a .localstorage file and a .localstorage-journal file. One tab is stored as:

 chrome-extension_chphlpgkkbolifaimnlloiipkdnihall_0.localstorage

 chrome-extension_chphlpgkkbolifaimnlloiipkdnihall_0.localstorage-journal

In fact, those .localstorage files are just SQLite files. Fortunately I can solve it by doing some DB operations.

To make life simpler, I do it in GUI. Thanks to the author of sqlitebrowser.

Screenshot from 2016-04-12 00:36:38.png

Screenshot from 2016-04-12 00:37:462.png

Basically, it’s just a simple database containing 1 key-value table only. There are 7 records in this table but only 2 records, idCounter and state, are matters.

  • idCounter: the last primary key of tabs
  • state: the tabs records that stored in JSON string

Copy and paste the value of “state” to any editor, you should see something like this:

{
  "tabGroups": [
    {
      "id": 3198,
      "tabsMeta": [
        {
          "id": 3182,
          "url": "http://localhost:3000/users/75/edit",
          "title": "Servlet Error"
        },
        {
          "id": 3183,
          "url": "https://docs.racket-lang.org/reference/lambda.html?q=lambda#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29",
          "title": "3.8 Procedure Expressions: lambda and case-lambda"
        },
        {
          "id": 3185,
          "url": "https://docs.racket-lang.org/reference/exns.html?q=object-name#%28def._%28%28quote._~23~25kernel%29._raise-user-error%29%29",
          "title": "10.2 Exceptions"
        },
        {
          "id": 3188,
          "url": "https://docs.racket-lang.org/reference/ivaraccess.html",
          "title": "6.4 Field and Method Access"
        },
        {
          "id": 3197,
          "url": "http://stackoverflow.com/questions/23296384/application-not-a-procedure-racket",
          "title": "condition - application: not a procedure racket - Stack Overflow"
        }
      ],
      "createDate": 1453743658563
    },
    {
      "id": 3212,
      "tabsMeta": [
        {
          "id": 3199,
          "url": "https://docs.racket-lang.org/reference/exns.html?q=object-name#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail%29%29",
          "title": "10.2 Exceptions"
        },
        {
          "id": 3200,
          "url": "https://docs.racket-lang.org/reference/define-struct.html?q=object-name#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-struct%29%29",
          "title": "5.1 Defining Structure Types: struct"
        },
        ...
      ],
      "createDate": 1454092984398
    },
     ...
  ]
}

It’s Just a pure Json data. I make a copy of this for backup purposes. Now I can remove some items here. I did few tests to find the recommended size, I prefer to limit to 1000. Besides that make sure the id of the last item is the same as the value of idCounter in itemTable.

Data is ready, But …

You can’t make this patch work if chrome is running. Basically, all the chrome’s instances must be terminated before you are touching the extension data. To do so, you might use some commands like: kill, top or htop, etc.

Finally just replace the state field of itemTable with the modified version of the json data. And of course, OneTab is back!

Advertisements

xgReader – 改善 google reader 介面

最近google推出了新介面,看起來的確很華麗,卻苦了經常使用NETBOOK的我。 於是動動手,寫了個插件 – xgReader 。xgReader 在原本頁面上加插了兩個按鈕,可以用來 切換 menu 與 search bar,不用時通通關掉,對於MON小的人來說應該不錯用。

空間多了,留白小了,心情好了。

website: http://code.google.com/p/xg-reader/

Discuz Reader – Chrome Extension

假期後一篇文章都沒有打過,懶惰非常。今天終於要打破平靜,寫些小的作個記錄。一直已來都想在某論壇團購買東西。每次找到心頭好的確很高興,可悲的總是為時已晚,空歡喜一場。於是我便想會不會有 像 feed Reader 之類的東西看 Discuz 的thread呢? ,這我無時無刻都可以看到最新的帖子!

於是「好手氣」了一下 發現 Discuz  雖然有RSS 的功能,但被關掉的論壇為數不少。沒錯,剛好那個論壇就是把它砍掉。

為免悲劇重蹈覆辙,寶貝和心情盡失,於是花了一些時間,用jQuery寫了個 Chrome extension – Discuz Reader.

話說在前,這東西雖則陽春,但至少可以把悲哀踼走!

website:http://code.google.com/p/discuz-reader/

download : Version 1