Where would it be best to control an addons allowed domains from a user specified list?

I want to control the domains accessible by addons which work on all pages by extending them with additional code which looks up a list of domains updatable by the user and disables the addon from proceeding further if the current page is not on the list.

For many addons where would be the best place in the call cycles to insert such code? I assume that there are some common calls most addons use where it would be a good idea to call such code.

eg. uBlock Origin allows the user to disable it on certain pages, so I am sure other addons can be modified to do the same.

1 Like

I suspect you would only be able to modify extensions that inject content scripts programmatically, for example, using browser.tabs.executeScript(). If the content script is listed in the manifest, then I assume Firefox will inject it automatically with no opportunity to intervene.

As exemplars, you might also look at Greasemonkey and ViolentMonkey.

1 Like