browser.cookies.set givs error for cyrillic domain name, like xn--j1ail.xn--p1ai




WebExtensions: General
10 months ago
6 months ago


(Reporter: vanillycpp, Unassigned)


Dependency tree / graph

Firefox Tracking Flags

(Not tracked)


(Whiteboard: triaged, investigate)



10 months ago
User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce:

I want to set a cookie from cyrillic domain name

I do it like this
var cook = { url:"http://xn--j1ail.xn--p1ai", name: "tst", value: "s:l:aaaa49d4e0:1493647639723", domain: "xn--j1ail.xn--p1ai", path: "/", secure: false, httpOnly: false, expirationDate: 2148584400, storeId: "firefox-default" }
let sp = browser.cookies.set(cook);

Actual results:

i have an error

Error: Permission denied to set cookie {"url":"http://xn--j1ail.xn--p1ai","name":"tst","value":"s:l:aaaa49d4e0:1493647639723","domain":"xn--j1ail.xn--p1ai","path":"/","secure":false,"httpOnly":false,"expirationDate":2148584400,"storeId":"firefox-default"}

Expected results:

if I change 
url from "http://xn--j1ail.xn--p1ai" to "http://xn-j1ail.xn-p1a"
domain to "xn--j1ail.xn--p1ai" to "xn-j1ail.xn-p1a"

and cookie set works succesfully

so, there is some troubles with `--` symbols

please help me to understand how to set cookie for cyrillic named domain, in firefox webextensions addon?


10 months ago
Flags: needinfo?(amckay)

Comment 1

10 months ago
Hi! Thanks for replay!
I didn`n understand what kind of info you need?

Comment 2

10 months ago
Do you have a copy of the manifest, or an example add-on with this problem? We are curious if its possible to set the correct domain name in your manifest.
Flags: needinfo?(amckay)


9 months ago
webextensions: --- → ?

Comment 3

9 months ago
trying to repro - there is a bug in platform somewhere about changing this area that potentially impacts
Flags: needinfo?(amckay)

Comment 4

9 months ago
We are thinking that bug 945240 will fix this. I'd like to try and get a reproducable test case in the mean time to see if it does fix it.
Depends on: 945240
Flags: needinfo?(amckay)

Comment 5

9 months ago
Sorry for late answer...

hear is test addon for this problem

here is my mainfest
  "browser_action": {
    "browser_style": true,
    "default_title": "Cyrilic domain cookie test",
    "default_popup": "index.html",
    "default_icon": {
      "19": "icons/default19.png",
      "38": "icons/default38.png"
  "description": "Cyrilic domain cookie test",
  "icons": {
    "48": "icons/cookie.png",
    "96": "icons/cookie@2x.png"
  "homepage_url": "",
  "manifest_version": 2,
  "name": "Cyrilic domain cookie test",
  "version": "1.1",
  "permissions": ["cookies","<all_urls>"]

here is main.js

// works fine
//var host_domain = "";

// got error
var host_domain = "xn--j1ail.xn--p1ai";

// works fine
//var host_domain = "xn-j1ail.xn-p1ai";
cook = { url:"http://"+host_domain, name: "tst", value: "s:l:aaaa49d4e0:1493647639723", domain: host_domain, path: "/", secure: false, httpOnly: false, expirationDate: 2148584400, storeId: "firefox-default" }

browser.cookies.set(cook).then(() => 
  var gettingAllCookies = browser.cookies.getAll({domain:host_domain});
  gettingAllCookies.then((cookies) => {console.log(cookies)});     



9 months ago
Priority: -- → P2
Whiteboard: triaged
Depends on: 1380617

Comment 6

6 months ago
Can you investigate if this is still the case please, we landed a few changes that might have fixed this around punycode and the urlspec.
Flags: needinfo?(mstriemer)
Whiteboard: triaged → triaged, investigate
I can see the cookie getting set using this extension on Nightly and it gets send when navigating to that domain. Something may have fixed this, as suggested.
Last Resolved: 6 months ago
Flags: needinfo?(mstriemer)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.