I am trying to set a new cookie in firefox from a web extension on a page that is a local file (with the file protocol: file:///[…]) and I get the following error:
Permission denied to set cookie {“domain”:“”,“expirationDate”:null,“firstPartyDomain”:“”,“httpOnly”:null,“name”:“myCookie”,“path”:null,“secure”:null,“storeId”:null,“url”:“file:///E:/folder/mypage.html”,“value”:“myvalue”}
This is the script that I am using to insert the cookie:
var newCookie = {
domain: '',
name: 'myCookie',
value: 'myValue',
path: null,
secure: null,
httpOnly: null,
expirationDate: null,
storeId: null,
url: 'file:///E:/folder/mypage.html',
};
if (cookie.hostOnly) {
newCookie.domain = null;
}
browser.cookies.set(newCookie).then(function (e) {
console.log('success!');
}, function (e) {
console.error(e);
});
And those are the permissions configured in the manifest.json:
"permissions": [
"cookies",
"<all_urls>",
"tabs"
],
I supposed I must need an extra permission, but I couldn’t find anything related to that in the documentation. all_urls should include every protocols.
What am I doing wrong here?