Thursday, April 19, 2012

Freeze inactive background Chrome tabs

In the vein of the Firefox extension Dormancy, build a Chrome extension that frees up resources used by background tabs that haven't been accessed in a while. Using the chrome.tabs.onUpdated event, an LRU list could be maintained. Inactive tabs would have a screenshot taken via chrome.tabs.captureVisibleTab, and the tab would then be navigated to a chrome-extension:// URL that shows that screenshot (thus making all inactive tabs live in the extension's process, instead of separate renderer ones). When the tab is re-selected, history.back() could be used to back to the live page (by using history traversal, form/scroll position restore is invoked, retaining as much of the state as possible).

Optionally, there could be a browser action that displays the total/live/frozen tab count, in the same way that Tab Count does.