Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Wrong iteration style in read function #1

Open
hgeist opened this issue Apr 7, 2015 · 2 comments
Open

Wrong iteration style in read function #1

hgeist opened this issue Apr 7, 2015 · 2 comments

Comments

@hgeist
Copy link

hgeist commented Apr 7, 2015

"cookies" in the read function is an array but gets iterated like object properties. This leads to an error in js console when iteration over array fields is done it tries to split a function object afterwards. If you iterate via for(var i; i < cookies.length; i++) then it will only try to split real array fields

@jonathan-piat
Copy link
Member

Hello,

Thanks for your report, can you provide me the value of "document.cookie" with which you get this issue?

Jonathan

@hgeist
Copy link
Author

hgeist commented Apr 7, 2015

Im sorry i cant reproduce it anymore. But as split() always returns an array and you already split the cookie in line 46 in current code "cookies" will then be an array and imho it is safer to iterate said array in line 54 in the style i proposed.

http://www.w3schools.com/jsref/jsref_split.asp

http://stackoverflow.com/questions/6565281/iterating-over-array-of-objects-javascript-odd-behaviour -> second answer

The problem showed up in a current version of Opera, which is based on Webkit, OS was W7 64bit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants