How does contentSettings API work?

186 views
Skip to first unread message

Daniel Ivaniš

unread,
Oct 31, 2022, 7:58:16 AM10/31/22
to Chromium Extensions
Hi all,
I have a simple MV3 extension with contentSettings permission and code like this
chrome.contentSettings.microphone.set({
  primaryPattern: "https://meet.google.com:443/*",
  setting: "ask",
});

I expect, that it should override my content setting for given address (no matter if it was previously set to Ask, Allow or Block) and when I visit address from pattern, it should ask me for access to microphone and allow/block it based on my choice.

It really ask me for access, but because extension 'Ask' setting override user setting, it doesn't change extension 'Ask' to user 'Allow' or 'Block' and result is undefined/random behavior.
meet.google.com ask twice and even 2 permits doesn't allow browser to access to microphone Maybe it was temporary allowed for some specific URL, microphone icon also changed, but it doesn't work. Other websites behave smilar non-functionally. I tested especially microphone and notifications permission.

So how can I change my (any) contentSettings to ask (when default Ask was changed by user)? I don't want to do it via chrome://settings/content, I want to do it programmatically via extension.

And one more question, how can I clear setting for specific address? clear method doesn't support address as parameter.

Thanks

Daniel
permissions.PNG
Reply all
Reply to author
Forward
0 new messages