ContainerScript: Firefox Addon for programmatically assigning URLs to containers
github.com
github.com
if (url.hostname === "github.com") {
if (/.*foo.*/.test(url.pathname)) {
return "My Foo Conatiner"
}
if (/.*bar.*/.test(url.pathname)) {
return "My Bar Container"
}
}I'm curious, for such a straight-forwarded added functionality, why you would:
1. add a very heavy editor framework (monaco) for a configuration page?
2. use actual javascript to check partial urls one at a time?
For 2. this would be better handled by a json or similar that just maps Firefox's approved url match patterns[1]? Using javascript adds potential execution vulnerabilities and possibly parsing complexity that isnt needed.
Also a word on partial urls. Given that many sites will use subdomains and redirects as a norm, expecting a site to be like "www.amazon.com" seems like it would generate a lot of excess code in order to maintain url targeting. This comes from working on a macOS plugin that did similar javascript injection based on url targeting (BeardedSpice[2]) and would have regular targeting errors, especially with more complex SPAs.
Either way, keep up the good work! Love to see projects like this attempt to improve the QoL around the browsing experience.
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
It's a configuration page which requires editing code, so I added a code editor.
> 2. use actual javascript to check partial urls one at a time?
> For 2. this would be better handled by a json or similar that just maps Firefox's approved url match patterns[1]? Using javascript adds potential execution vulnerabilities and possibly parsing complexity that isnt needed.
There are other addons which work like that:
* https://addons.mozilla.org/en-CA/firefox/addon/containerise/ * https://addons.mozilla.org/en-CA/firefox/addon/multi-account...
This addon is for more complex use-cases. For example:
return url.searchParams.get("x-SessionName");However, there is no possibility to adjust matching rules, so this script offers a bit more customization options.
I've been using https://addons.mozilla.org/en-CA/firefox/addon/containerise to handle this for me.
Was all or part of the program written in another language and compiled to Javascript?
My Javascript is not the good but it looks that way to me, or perhaps was constructed from some table driven system.
That would be great.
return url.hostname;
But your container list would get pretty messy.The list should exist only when a deviation from the default is required. There definitely are use cases for it.