temporary-containers icon indicating copy to clipboard operation
temporary-containers copied to clipboard

Page action button (in address bar) does not display if tab is in no container at all

Open nike4613 opened this issue 1 year ago • 8 comments

  • Temporary Containers Version: 1.9.2
  • Firefox Version: 115.13.0 (Floorp 11.15.0)

Actual behavior

No page action button when tab does not have container

Expected behavior

The page action button to be present even when a tab is not in a container

Steps to reproduce

  1. Open a tab outside any containers (you can use the Sideberry extension, for instance, to do so)
  2. Observe lack of button, even with option enabled

Notes

It seems to be this code that causes the problem:

https://github.com/stoically/temporary-containers/blob/cbb39f7abbdf3c767bd1fbdc109394a0db169b05/src/background/pageaction.ts#L43-L45

I see in the debug console for the background page this error: image

nike4613 avatar Jul 14 '24 08:07 nike4613

I can't replicate this behaviour. I assume you are talking about the button that appears within the address bar with the advanced option "Show icon in the address bar that reveals the popup" enabled? If you open a new tab that button wont appear until you have loaded a url in the tab regardless of if it is a TC or not, is that what you mean? If not can you provide further details on how to replicate the issue?

GodKratos avatar Mar 25 '25 09:03 GodKratos

For a tab in a container, behaving as expected (in this case, a Github site): image

For a tab in the default container (or no container?) this issue: image

I'm not sure what else there is to it? For most of my container management, I'm using Sidebery, and the 'default' container here is what it shows here: image

The stack trace in my previous comment is still the same, and manually invoking the relevant APIs from the console reproduces the error: image

nike4613 avatar Mar 25 '25 09:03 nike4613

A little more debugging on my end reveals that this is an issue with the computation of containerPrefix. It computes the name based on .name.toLowerCase() of browser.runtime.getBroswerInfo(), but that seems to be wrong for Floorp. Here's the browser info object returned there: image

nike4613 avatar Mar 25 '25 09:03 nike4613

Though actually, it's getting it from a tab cookieStoreId, and that's what's failing. Poking around Sidebery suggests that it doesn't treat firefox-default as a container, and it seems like that's the correct way to deal with this?

nike4613 avatar Mar 25 '25 09:03 nike4613

but is that only when you open the default container before opening a URL or is it also missing after you have loaded a URL?

GodKratos avatar Mar 25 '25 12:03 GodKratos

Also after loading a URL. (I do not have automatic temporary containers enabled.)

nike4613 avatar Mar 25 '25 12:03 nike4613

A little more debugging on my end reveals that this is an issue with the computation of containerPrefix. It computes the name based on .name.toLowerCase() of browser.runtime.getBroswerInfo(), but that seems to be wrong for Floorp. Here's the browser info object returned there: image

Ah ok, this will be the problem. If the tab doesn't have a container it should be detecting the firefox-default cookieStoreId but in your case the containerPrefix variable is calculating the default container as something different. This is likely causing other problems for you as the same way of identifying the default container is used elsewhere. Ideally this should be fixed as part of calculating the containerPrefix variable but this will affect other users besides you. I can add a catch all to the container check for this particular error (which should be throwing an error anyway).

GodKratos avatar Mar 25 '25 12:03 GodKratos

I've applied a fix for now here https://github.com/GodKratos/temporary-containers/commit/5e693b236aa814afb4db2f859d0ed1ce327b6625

GodKratos avatar Mar 25 '25 12:03 GodKratos