Panorama is this cool new feature coming to Firefox 4. Most of the big issues have been fixed, but there’s still the occasional issue with orphan tabs.

Last week I wrote a script that would strip the Panorama data out of Session Restore. That worked but would require a restart. Ian Gilman (one of the Panorama developers) used that script for the basis of a script that worked much better (it actually called into Panorama and told it to reset properly). The only problem is that it left tabs hidden, so it would require jumping into and then out of TabView to bring everything back to normal. I forked that and just added a call that made sure all tabs were shown.

So if you ever get into a confusing state and don’t mind wiping out your current Panorama data, this script is for you:

/* Run this from your error console. WARNING: removes tabs from their existing groups! */
var Cc = Components.classes;
var Ci = Components.interfaces;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var winEnum = wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
var win = winEnum.getNext();
win.TabView._initFrame(function() {
var contentWindow = win.TabView._window;
contentWindow.UI.reset();
});
Array.forEach(win.gBrowser.tabs, function(tab) win.gBrowser.showTab(tab));
}