Skip to content

Instantly share code, notes, and snippets.

@mooz
Created January 23, 2010 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mooz/284632 to your computer and use it in GitHub Desktop.
Save mooz/284632 to your computer and use it in GitHub Desktop.
// initialIndex : 初期選択行を指定
ext.add("list-tab-history", function () {
const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
var tabHistory = [];
var sessionHistory = gBrowser.webNavigation.sessionHistory;
if (sessionHistory.count < 1)
return void display.echoStatusBar("Tab history not exist", 2000);
for (var i = 0; i < sessionHistory.count; i++) {
var entry = sessionHistory.getEntryAtIndex(i, false);
if (!entry)
continue;
try {
var iconURL = Cc["@mozilla.org/browser/favicon-service;1"]
.getService(Ci.nsIFaviconService)
.getFaviconForPage(entry.URI).spec;
} catch (ex) {}
tabHistory.push([iconURL || fav, entry.title, entry.URI.spec, i]);
}
prompt.selector(
{
message : "select history in tab",
collection : tabHistory,
flags : [ICON | IGNORE, 0, 0, IGNORE | HIDDEN],
header : ["Title", "URL"],
initialIndex : tabHistory.length - 1,
callback : function(i) { if (i >= 0) gBrowser.webNavigation.gotoIndex(tabHistory[i][3]); }
});
}, 'List tab history');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment