Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Removing entry from "closed tabs" list

6 views
Skip to first unread message

skry...@yahoo.fr

unread,
Oct 23, 2008, 11:42:29 AM10/23/08
to
I can't find a way to remove (for an add-on about privacy) an entry from the
"closed tabs" list.
I have found the list of closed Tabs (in nsISessionStore), but I can figure
out how to remove one.

Any hint ?

Regards
--
Benoit Bailleux

Simon Bünzli

unread,
Oct 25, 2008, 7:41:07 AM10/25/08
to
skry...@yahoo.fr schrieb am 23.10.08 17:42:

> I can't find a way to remove (for an add-on about privacy) an entry from
> the "closed tabs" list.

If you want to remove _all_ closed tabs, just set
browser.sessionstore.max_tabs_undo to 0 and then back to its original value.

Removing a single closed tab isn't that simple. I've filed a bug about
this (see https://bugzilla.mozilla.org/show_bug.cgi?id=461634 ), but
until the API has been extended, you can use the following work-around
(leads to some flickering, but does the job):

function forgetClosedTab(aIndex) {
var selectedTab = getBrowser().selectedTab;

// reopen the tab to forget
var tab = undoCloseTab(aIndex) || gBrowser.selectedTab
var browser = gBrowser.getBrowserForTab(tab);

// load a blank document and clear its history
browser.contentDocument.location = "about:blank";
with (browser.webNavigation.sessionHistory) PurgeHistory(count);

// don't wait for the tab to complete loading
// (this clears data associated with partially loaded tabs)
var event = document.createEvent("Events");
event.initEvent("load", true, false);
browser.dispatchEvent(event);

// close the tab for good (blank tabs can't be reopened)
gBrowser.removeTab(tab);
gBrowser.selectedTab = selectedTab;
}

Cheers,
Simon

skry...@yahoo.fr

unread,
Nov 18, 2008, 2:11:59 AM11/18/08
to Simon Bünzli
Simon Bünzli a écrit :
> [...]

> // close the tab for good (blank tabs can't be reopened)
> [...]

Thanks for the trick (I didn't know that "blank tabs can't be reopened").
I could not try it until this last week-end, but it works as I need.

By the way, do you agree / mind to be listed as a contributor in my little
extension ?

Regards,
--
BBa

0 new messages