[Ext] BrowseInTab - How to grant permissions to show notifications and enable microphone and camera

I have a question though regarding how to grant permissions for certain websites to do things like this:

  • There are some sites I’d like to use within BrowseInTab that give me the following error message “Permission to show notifications has been denied”. I have searched and searched to see if there was something I needed to tweak in the TB Config Editor but so far no luck. Is there a way to allow notifications when using BrowseInTab ?
  • The second issue has to do with allowing sites like voice.google.com or youmail.com to allows access to the computer’s microphone and cameras.

Basically, outside of the options that your AddOn provides an interface, is there some other method to configure TB and BrowseInTab to tweak these kinds of things?

Thanks in advance for any help…

It would require importing a lot of code from Firefox to provide the UI in the urlbar and in Settings Permissions, and BiT won’t be implementing all that. Fortunately, it can be done manually in Tb as the permissions.sqlite file is shipped and the browser component does check it.

Open the Tools Developer Tools Console. Enter the commands there.

Set up the principal for your site:

principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(“https://example.com”);

Allow permissions for the site:

Services.perms.addFromPrincipal(principal, “desktop-notification”, Services.perms.ALLOW_ACTION);

Services.perms.addFromPrincipal(principal, “microphone”, Services.perms.ALLOW_ACTION);

Deny a permission for a specific site:

Services.perms.addFromPrincipal(principal, “camera”, Services.perms.DENY_ACTION);

Clear the permission; this usually would set it to a state where a prompt would be issued but Tb does not ship that code:

Services.perms.removeFromPrincipal(principal, “camera”);

See what sites have a permission:

Services.perms.getAllWithTypePrefix(“camera”).map(p => [p.type, p.principal.spec]).sort();

See the permissions for a site:

Services.perms.getAllForPrincipal(principal).map(p => [p.principal.spec, p.type]);

You can also set global defaults for permissions (and deny certain sites as above). In Firefox config editor filter by

permissions.default

for a list. Create the desired names in Tb (no pref is the same as 0). A value of 0 is UNKNOWN_ACTION (for prompts), 1 is ALLOW_ACTION, 2 is DENY_ACTION.

Nevermind. I’m an idiot. I didn’t set "principal before issuing other commands… Sorry for the bother…

Ok, now I think I am properly following your instructions. I’m trying to enable desktop notifications for this URL “https://client.pushover.net”. I execute TWO commands as shown below. The first to set principal, and the second to add the ALLOW permission. I get the following. What am I doing wrong…

Ok, the undefined didn’t mean anything. After checking what permissions were set for this site, the command showed that desktop notifications ARE allowed and I was able to proceed with access to this URL.

THANK YOU AGAIN for you help.

No problem. Also, to get all permissions for all sites:

Services.perms.getAllWithTypePrefix("").map(p => [p.type, p.principal.spec]).sort();

One other question… Can I use the permission editor while navigating to a particular website in the FireFox browser to set site-specific permissions and expect those permissions to be respected in Thunderbird under BiT ?

The reason I ask is because I am also trying to run my voicemail program (youmail.com) in a BiT tab under TB. The UI renders just fine, but when I attempt to playback the audio of my voice messages in BiT, i only get silence and after clicking the PLAY button the player never seems to advance. In FireFox natively, it works perfectly. Trying to figure out which permission might control the playback of Audio under BiT…

I have also tried to run GoogleVoice under BiT. After enabling the microphone, I can make phone calls and my headphones and mic work great.

But, the same issue with playback exists when I try to play a recorded voicemail under BiT inside Thunderbird.

I have autoplay permission for audio and video ALLOWED, but I don’t think that is the problem. When I enabled that in FireFox the effect was to cause a recorded voicemail to start playing back immediately when it was clicked on, which makes sense.

So, there is SOME setting or permission that I have not found yet, that prevents BiT from playing back audio on a webpage.

Oddly, YOUTUBE works perfectly under BiT. Audio and Video playback as expected. However, hover-over does not. hover-over a thumbnail is supposed to playback audio and video, but doesn’t

BiT is a cool app. If I can get some of my productivity apps to work fully under TB, then BiT lets me make TB a one-stop shop for all my communications. I am trying to get the following sites to function perfectly under BiT


client.pushover.net
voice.google.com

Sorry if I am annoying you by posting all these messages, but I feel like I am inches away from getting all these sites to work perfectly under TiB. You have opened my eyes on the permissions settings capabilities…

No. You could set up the Fx permissions.sqlite and copy it into the Tb profile though. It would lose whatever perms Tb has set (cookies, remote content prefs are stored here, etc).

There is a media perm, did you look in Fx defaults for it?

It may be due to being logged in, or cookies. Javascript should work there. It could be some third party site perms are required.

As I disclose on the homepage - Tb was not designed to be a browser :wink:

Thanks. Unfortunately, it’s not a given for the next Tb ESR.

Is there a command to list ALL THE POSSIBLE PERMS COMMANDS?

you have shown me desktop-notifications, microphone and camera and I have stumbled on others but I’m trying to find a complete list that will work with the javascript Services.perms object…

You can issue the same command in Fx browser console… A perm is any string so I’m not sure there’s a definitive list, though some are hardcoded in Fx code.

You can also “use the source”
https://searchfox.org/mozilla-central/rev/bb14d901ac16633801b7f4adaa4fb104e6f072e4/browser/base/content/pageinfo/permissions.js#140

Ahhh… Kick ass. The source is good.

If I was looking for official API documentation for the Service.Perms object where would that live? I haven’t figure out where the foundational stuff exists yet.

A while back I did a hello world AddOn following someone’s guidance on the web, and it worked, but I have been too distracted with doing things to feed my family to get back to pushing on that front.

https://searchfox.org/mozilla-central/rev/bb14d901ac16633801b7f4adaa4fb104e6f072e4/netwerk/base/nsIPermissionManager.idl#37

It’s a giant learning curve. At least the old all powerful extensions were, to do interesting things with internal code. Not sure how worth it it is, having done a few serious things in core Tb, and rather done with that.