Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement loose cooking parsing #1255

Merged
merged 1 commit into from Oct 7, 2015
Merged

Conversation

Sebmaster
Copy link
Member

This enables correct execution of code like document.cookie = 'foo'.

Blocked on either request/request#1811 or salesforce/tough-cookie#56.

@domenic
Copy link
Member

domenic commented Oct 5, 2015

LGTM except for the commit message (s/cooking/cookie), so once one of the prereqs gets merged feel free to merge.

@Sebmaster Sebmaster force-pushed the fix/malformatted-cookies branch 3 times, most recently from bd46d8d to 14bee1c Compare October 7, 2015 00:24
@Sebmaster
Copy link
Member Author

@domenic Added loose mode to the constructor too now. The problem right now is (without request merging the PR), if a user of jsdom provides a cookie jar without loose mode, we'll handle malformatted cookies in document.cookie differently, than if we get the cookie from a resource request, which kind of sucks. We could set jar.enableLooseMode, but I'm not sure if it's considered public API.

The alternative would be to provide it just to the jars we create ourselves, so the behaviour is consistent across doc.cookie and requests, but not browser-like (malformed cookies are refused), unless users properly create the jar.

This enables correct execution of code like `document.cookie = 'foo'`.
@Sebmaster
Copy link
Member Author

Modified to only set loose mode on jars we create ourselves. If a user passes us a jar without loose mode, we'll behave strict and refuse malformed cookies.

@domenic
Copy link
Member

domenic commented Oct 7, 2015

LGTM!

@Sebmaster Sebmaster merged commit eb02458 into master Oct 7, 2015
@Sebmaster Sebmaster deleted the fix/malformatted-cookies branch October 7, 2015 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants