Closed Bug 1361135 Opened 7 years ago Closed 7 years ago

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

Categories

(WebExtensions :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME
webextensions ?

People

(Reporter: vanillycpp, Unassigned)

References

Details

(Whiteboard: triaged, investigate)

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
http://кто.рф/

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?
Flags: needinfo?(amckay)
Hi! Thanks for replay!
I didn`n understand what kind of info you need?
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)
webextensions: --- → ?
trying to repro - there is a bug in platform somewhere about changing this area that potentially impacts
Flags: needinfo?(amckay)
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)
Hi!
Sorry for late answer...

hear is test addon for this problem http://tilesearth.com/tmp/cyrilic_domai_cookie_bug.zip

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": "https://test.com/",
  "manifest_version": 2,
  "name": "Cyrilic domain cookie test",
  "version": "1.1",
  "permissions": ["cookies","<all_urls>"]
}
-------------------------------------

here is main.js
-------------------------------------

// works fine
//var host_domain = "example.com";

// 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" }
  
//console.log(cook);

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

-------------------------------------
Priority: -- → P2
Whiteboard: triaged
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.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mstriemer)
Resolution: --- → WORKSFORME
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.