stoically / temporary-containers

Firefox Add-on that lets you open automatically managed disposable containers
https://addons.mozilla.org/firefox/addon/temporary-containers/
MIT License
850 stars 58 forks source link

Selectively ignore clicks from extensions? #466

Closed seonwoolee closed 3 years ago

seonwoolee commented 3 years ago

Actual behavior

HTTPZ is an extension that automatically aborts any request made over HTTP and reinitiates a request over HTTPS. If it fails, it can be configured to either silently downgrade to HTTP, or show a page warning you that communicating over HTTPS failed, and provides buttons to either retry over HTTPS or proceed over HTTP. This warning page is (at least for me, I don't know if the extension string is unique per install or not) at moz-extension://3bc1d56b-e672-4314-9336-3a63427c0dcc/pages/error.htm. This warning page is loaded a temporary container tab. When I click on the proceed over HTTP button, it opens a new container tab with a different number, attempts to access the site again over HTTP, fails to do so, and then displays the warning page again.

Desired behavior

I'd like to be able to specify an exception that says don't redirect any clicks from a tab that is currently at moz-extension://3bc1d56b-e672-4314-9336-3a63427c0dcc to a new container tab. I tried entering both 3bc1d56b-e672-4314-9336-3a63427c0dcc and moz-extension://3bc1d56b-e672-4314-9336-3a63427c0dcc into the per domain isolation settings and setting the target domain to never, but it didn't work. I assume this is because Temporary Containers expects actual domains in the domain pattern, not extensions.

Steps to reproduce

  1. Install HTTPZ
  2. Make sure HTTPZ doesn't have "Fall back to HTTP without warning" checked
  3. Go to any HTTP page that doesn't support HTTPS, such as http://neverssl.com
  4. Click Proceed over HTTP
stoically commented 3 years ago

It seems like TC indeed doesn't correctly parse the ID from the extension URL as domain, which seems like a bug. I could've sworn that worked (and manually feeding it to new URL("url") parses it correctly, so it should work). The current incorrect behavior is that TC simply takes the whole URL as string to compare against the pattern, so specifying moz-extension://your-id/pages/error.htm as pattern, and * as Exclusion Pattern for that Per Domain Rule works on my end. However, I would instead use a regular expression like /^moz-extension://your-id/pages/error.htm$/ as pattern, since that is guaranteed to keep working. And yeah, those IDs in the extension URLs are unique per installation.

seonwoolee commented 3 years ago

Thanks, that worked for me.

stoically commented 3 years ago

Glad it works for you. Going to close this as it seems resolved. Opened https://github.com/stoically/temporary-containers/issues/467 to track the issue about the extension ID not getting parsed as domain.

notDavid commented 1 year ago

Hello @stoically , than you for the above solution. I have another question about this i was hoping you can help me with;

  1. I use this extension as Firefox Home Page
  2. I have set /^moz-extension://the_extension_id/index.html$/ as Domain Pattern and excluded *, and this works in most cases when i type some random address in the address-bar.
  3. However, whenever i type an address in the address-bar whose Target Domain is MAC-Always open in assigned to 'some container', it will open in a new tab, and the first tab at moz-extension://the_extension_id/index.html is also left opened.

Can this step 3 be solved, so the first tab will be automatically closed, or re-used or something?

Thank you for any tips :-)