title: Permission denied when trying to set cookie in a firefox web extension on a local file
body: <p>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:</p>
  <blockquote>
  <p>Permission denied to set cookie {&quot;domain&quot;:&quot;&quot;,&quot;expirationDate&quot;:null,&quot;firstPartyDomain&quot;:&quot;&quot;,&quot;httpOnly&quot;:null,&quot;name&quot;:&quot;myCookie&quot;,&quot;path&quot;:null,&quot;secure&quot;:null,&quot;storeId&quot;:null,&quot;url&quot;:&quot;file:///E:/folder/mypage.html&quot;,&quot;value&quot;:&quot;myvalue&quot;}</p>
  </blockquote>
  <p>This is the script that I am using to insert the cookie:</p>
  <pre><code>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);
      });
  </code></pre>
  <p>And those are the permissions configured in the manifest.json:</p>
  <pre><code>&quot;permissions&quot;: [
      &quot;cookies&quot;,
      &quot;&lt;all_urls&gt;&quot;,
      &quot;tabs&quot;
  ],
  </code></pre>
  <p>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 protocol.</p>
  <p>I am able to create cookies manually in the devTools by using simple code like that
  document.cookie = &quot;myCookie=myValue&quot;;</p>
  <p>And I am also able to inject a cookie in the page by using a content script injected like that
  browser.tabs.executeScript({ code: <code>document.cookie = &quot;${newCookie.name}=${newCookie.value}&quot;</code> });</p>
  <p>But this feels like a hack and I feel like I should be able to use the browser.cookies API for that.</p>
  <p>What am I doing wrong here?</p>