opal / opal-browser

Browser support for Opal.
MIT License
115 stars 36 forks source link

Refactor the cookie module #95

Closed hmdne closed 2 years ago

hmdne commented 2 years ago

The old logic was a bit silly at least.

cookies = $document.cookies
cookies['x'] = 'test'
cookies['x'] # JSON::ParserError

There was a test if a set value is a String and if it is, then it wasn't serialized with JSON. But when reading, it always used JSON.parse.

While this in theory breaks compatibility, it doesn't, because it didn't work before.

hmdne commented 2 years ago

Interesting error with Opal v1.4.0. Let's ignore it for now, but we will need to iron out this issue before Opal v1.4.0 release.