title: Error parsing and setting cookies on Chrome extension
body: <p>I'm currently trying to parse my session cookies from python requests and sending them to my chrome extension. I'm facing some issues with more complicated cookies like this one:</p>
  
  <p><a href="https://i.stack.imgur.com/CQF2D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CQF2D.png" alt="python cookies"></a></p>
  
  <p>My python code looks like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>cookieStr = ''
              cookies = [
              {'name': c.name, 'value': c.value, 'domain': c.domain, 'path': c.path, 'url': ''} for c in cookiesGet]
  
              for cookie in cookies:
                  if cookie['domain'][0] == ".":
                      cookie['url'] = cookie['domain'][1:]
                  else:
                      cookie['url'] = cookie['domain']
                      cookie['url'] = "https://"+cookie['url']
  
                  cookies = json.dumps(cookies)
                  print(cookies)
                  cookieStr = urllib.parse.quote(base64.b64encode(bytes(cookies, 'utf-8')).decode())
                  if not cookieStr:
                      print('')
                  url = urllib.parse.quote(base64.b64encode(bytes(redirectUrl, 'utf-8')).decode())
  
  </code></pre>
  
  <p>Facing issues on extension with this error:
  <a href="https://i.stack.imgur.com/qcZfl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qcZfl.png" alt="CHROME EXTENSION ERROR"></a></p>
  
  <p>And of course extension JS code looks like this:</p>
  
  <pre><code>function setCookie(cookieName, cookieDomain, cookieUrl, cookieVal) {
      // console.log(cookieName,cookieDomain, cookieVal,cookieUrl);
      chrome.cookies.set({
          "name": cookieName,
          "domain": cookieDomain,
          "url": cookieUrl,
          "value": cookieVal
      }, function (cookie) {
          console.log(JSON.stringify(cookie));
          console.log(chrome.extension.lastError);
          console.log(chrome.runtime.lastError);
      });
  }
  
  function parseCookie(cookie) {
      setCookie(cookie['name'], cookie['domain'], cookie['url'], cookie['value']);
  }
  
  function init() {
  ......
  .....
  var cookieStr = decodeURIComponent(url.searchParams.get("cookie"))//.replace(" ", "+");
  cookieStr = atob(cookieStr);
  console.log(cookieStr);
  var cookies = JSON.parse(cookieStr);
  var redirect = atob(url.searchParams.get("redirect").toString());
  
  for (var cookie of cookies) {
     parseCookie(cookie)
  }
  
  </code></pre>