undoclosetab icon indicating copy to clipboard operation
undoclosetab copied to clipboard

If closed tab was in a container, it will be reopened without the container

Open MPeti1 opened this issue 3 years ago • 7 comments

Well, not sure if there's anything else I could say. I used a container tab to search google for something that other search engines didn't have good results for.

Would it be possible to restore the page in the container in which it was originally? The tab history is already restored, so I would think this could be stored somewhere too

MPeti1 avatar Jan 09 '21 19:01 MPeti1

I don't know anything about containers.

I can have a look at this but what Add-ons are allowed to do is very limited, so I can't promise anything!

At first, please tell me how you use "containers". This is clearly no Firefox standard feature, so you most probably have some Add-on for that.

M-Reimer avatar Jan 10 '21 16:01 M-Reimer

Sorry for the delay.

There are multiple plugins that add support for containers. I use the official Multi Account Containers and the 3rd party Temporary Containers.

I think this is a feature supported by Firefox itself, it just doesn't have the UI to control it without addons, like what is the case with the tab groups feature readded by Simple Tab Groups. Why I think this is because I 'think' I heard that when the addon was first released, and also because it has integration in the browser, like adding a colored line for tabs which are in containers, or it's components integrated into about:preferences (screenshot 1, 2)

This is the official support article of Multi Account Containers.

These are the addons that I know can deal with containers:

  • Multi Account Containers (official): GitHub, AMO. It adds general container control functionality.
  • Facebook Container (official): GitHub, AMO. It doesn't have a UI, it just puts everything facebook into a container
  • Temporary Containers: GitHub, AMO. It makes single-use containers with a few settings.
  • CanvasBlocker: GitHub, AMO. It can fake the Navigator API's values (like user agent) based on the container of a tab.
  • Simple Tab Groups: GitHub, AMO. It can be set to always use a container for a specific tab group, or to grab all tabs opened in a specific container and put it in a specific group.

MPeti1 avatar Jan 14 '21 16:01 MPeti1

I did a short try now and as long as you restore only from the current session it does work with Firefox 90 for me.

There is a fix in place to work around a Firefox bug which will cause tabs, that are restored from a previous session, to always open not in the correct container. At least in theory there is API to get the needed info and add it to the restored tab. I'll check that. If it is possible, then I would prefer to fix this so it works even for previous sessions. Otherwise I would at least add a warning to the AMO description.

M-Reimer avatar Jul 22 '21 09:07 M-Reimer

With the current and previous session do you mean since and before restarting Firefox?

In the meantime I've noticed that it works in most cases, but rarely it doesn't. I don't remember if when I created the issue I tried to reopen a tab that was closed before restarting Firefox

MPeti1 avatar Jul 25 '21 11:07 MPeti1

Exactly. If you restart Firefox once, you can restore tabs from the previous session. Without my Add-on and with Firefox-internal tools even from a few restarts before it would work but my workaround purges them. This is the only way to prevent random tabs to open as the Mozilla API is broken for years, now. The way my workaround works is the best I could come up with. Without it restoring tabs from previons sessions would restore random stuff which is way worse than what we have now.

I tried a few things and did some reading in the Mozilla documentation for the relevant API but couldn't find any way to make this possible for previous sessions. The "cookieStoreId" (which represents the container) is added to the tab which is referenced by a tab ID. If you close this tab, then its ID is lost and a new ID is bound to it called "session ID". I could not find any reliable way to find out about this connection between old tab ID and new session ID.

So in theory this issue here is also blocked by https://bugzilla.mozilla.org/show_bug.cgi?id=1538119

Not much I can do about this. Mozilla has to fix their stuff first. The last comment in this bug sounds promising. So there is not even a maintainer for this session stuff...

M-Reimer avatar Jul 25 '21 13:07 M-Reimer

Well, this sounds good. I have had session restore enabled for ages, does this mean that I might have a ton of tabs that are no longer the same ones as they were before closing Firefox?

MPeti1 avatar Jul 28 '21 17:07 MPeti1

My Add-on deals with the problem.

But the workaround makes it impossible to have tabs from the previous session restored in the correct container...

M-Reimer avatar Jul 28 '21 17:07 M-Reimer

I guess this will also be fixed with the upcoming 8.0.0 release (or any revised release if Mozilla decides to decline review).

M-Reimer avatar Dec 21 '23 18:12 M-Reimer