Host permission for Fetch api

Hello !

I’m moving my “Chromium” extension to the webextension polyfill (Thanks for this awesome lib btw !) and I want to allow Firefox users to use it.

In my extension, i have the following optional permissions in my manifest.

optional_permissions": ["<all_urls>"]

Then, when the user setup the extension, he can allow one particular hostname to be added to the host permissions by using the permission API

browser.permissions.request({
    origins: ['https://user-myspecific-domain.com/*'],
  });

On Chromium, when I do that, the extension is now allowed to use the Fetch API to call this specific domain … But with firefox, even with this permission, the browser do not allows the API to be called (NS_ERROR_DOM_BAD_URI).

The only way to get it work is to ask for the permission “<all_urls>” when the user accept the permission …But it’s not what I want ! I just want my domain to be allowed and not the whole internet :smiley:

I’m missing something here but I don’t find out what !

2 Likes