domain value of cookies set via chrome.cookies.set always have a leading period (.)

2,812 views
Skip to first unread message

Joseph Xu

unread,
Dec 20, 2010, 12:10:05 AM12/20/10
to Chromium-extensions
I've noticed that if you set a cookie with the chrome extension api,
for example by typing into the javascript console a statement such as

chrome.cookies.set({"url" : "http://www.testing.com", "domain" :
"www.testing.com", "name" : "name1", "value": "value1", "path" : "/"})

the domain value of the resulting cookie will always have a leading
period. In the above case the cookie's domain is set to
".www.testing.com". I've tried several variations of the above
statement and each time there is a period prepended to the cookie's
domain. Is this correct behavior? If so, how can I set a cookie
without the prefix period in the domain?

I'm using chromium 8.0.552.215

Adam Barth

unread,
Dec 20, 2010, 4:20:27 AM12/20/10
to Joseph Xu, Chromium-extensions
The dot prefix on the domain is meaningless. I think we add it during
canonicalization at some point.

Adam

> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
>

Zachary Yaro

unread,
May 7, 2013, 11:32:22 PM5/7/13
to chromium-...@chromium.org, Joseph Xu
I just found this thread because I am having the same problem.  Is there any word on if/when this bug will be fixed?

—Zachary “Gamer_Z.” Yaro

On Wednesday, June 13, 2012 3:50:01 PM UTC-4, Aaron Eisenberger wrote:
Actually, it's not meaningless. I was running into a bunch of problems with cookies because of this issue. The browser treats cookies with the leading period separately and then you can get two versions of a cookie set, one by the site without the leading period, and one from the plugin with the leading period.

It is resolved if you just leave the domain out (it gets set from the url) but it seems like it should work properly. 


On Monday, December 20, 2010 1:20:27 AM UTC-8, Adam Barth wrote:
The dot prefix on the domain is meaningless.  I think we add it during
canonicalization at some point.

Adam


On Sun, Dec 19, 2010 at 9:10 PM, Joseph Xu <jose...@gmail.com> wrote:
> I've noticed that if you set a cookie with the chrome extension api,
> for example by typing into the javascript console a statement such as
>
> chrome.cookies.set({"url" : "http://www.testing.com", "domain" :
> "www.testing.com", "name" : "name1", "value": "value1", "path" : "/"})
>
> the domain value of the resulting cookie will always have a leading
> period. In the above case the cookie's domain is set to
> ".www.testing.com". I've tried several variations of the above
> statement and each time there is a period prepended to the cookie's
> domain. Is this correct behavior? If so, how can I set a cookie
> without the prefix period in the domain?
>
> I'm using chromium 8.0.552.215
>
> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.

> To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.

Reply all
Reply to author
Forward
0 new messages