ScottHamper / Cookies

JavaScript Client-Side Cookie Manipulation Library
The Unlicense
1.77k stars 170 forks source link

Cookies named after default properties are not detected #29

Closed stash closed 9 years ago

stash commented 9 years ago

Not sure if this is by design, but cookies named after properties of Object.prototype are not placed into the resulting set of cookies.

For example, this means that if one has a cookie named constructor, this cannot be accessed by this library. Other less likely examples are to be found at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype

stash commented 9 years ago

There's a few ways to approach this that come to my mind:

ScottHamper commented 9 years ago

Oh man, this is a really good catch.

I'll fix the issue by prefixing/namespacing keys before caching cookie KVPs, unless something better comes to mind.

Thanks for this! This bug has existed since the initial commit on April 26, 2012. Nuts.