Required permissions for core functionality in MV3? How!?

Hello devs, I’m migrating an addon from Manifest Version 2 -> 3 and I am stuck.

Background

The current addon runs a content-script on a domain https://www.example.com/* and https://m.example.com/* that does some logic on the page.
My manifest.json looks like this -

"content_scripts": [
    {
      "run_at": "document_start",
      "matches": ["https://www.example.com/*", "https://m.example.com/*"],
      "js": ["script.js"],
      "css": ["userstyle.css"]
    }
  ],

The addon requires activeTab and storage permissions and does DOM manipulation. It uses no API from the website.


Used to work like this

Currently with MV2 - at installation, the addon asks user for permission to access both domains to enable core functionality. After installation, it displays them prominently like so :
Required permissions for core functionality:
Access your data for www.example.com
Access your data for m.example.com


Problem

When I test with MV3 using web-ext run, at installation the addon doesn’t ask for access to both domains. Inside addon-manager, its permissions page says :
Optional permissions for added functionality:
Access your data for www.example.com
Access your data for m.example.com
and you have to manually enable both for addon to start working.


  • Should I be worried that every user who installs the addon will have to MANUALLY find and approve these permissions to enable functionality? People are not tech-savvy. These permissions were displayed upfront at install-time when using MV3.

  • Is there a way I can enable both domain-permissions by default like before?

Please help me figure this out!
Daniel

3 Likes

I have a similar issue. You can execute this when the use clicks on your addon button.

  browser.permissions.request({
    origins: [your urls]
  })

… to request a dialog for permissions.

But it’s not great.

1 Like