closes #567: support SameSite=None on cookies

This commit is contained in:
Cameron Kaiser 2019-08-13 17:30:04 -07:00
parent 2591f0e266
commit 09a4a8bfc7

View File

@ -3633,6 +3633,7 @@ nsCookieService::ParseAttributes(nsDependentCString &aCookieHeader,
static const char kHttpOnly[] = "httponly";
static const char kSameSite[] = "samesite";
static const char kSameSiteLax[] = "lax";
static const char kSameSiteNone[] = "none";
static const char kSameSiteStrict[] = "strict";
nsASingleFragmentCString::const_char_iterator tempBegin, tempEnd;
@ -3693,7 +3694,11 @@ nsCookieService::ParseAttributes(nsDependentCString &aCookieHeader,
aCookieAttributes.isHttpOnly = true;
else if (tokenString.LowerCaseEqualsLiteral(kSameSite)) {
if (tokenValue.LowerCaseEqualsLiteral(kSameSiteLax)) {
if (tokenValue.LowerCaseEqualsLiteral(kSameSiteNone)) {
// Currently redundant, but may be necessary if the default
// changes in the future. TenFourFox issue 567.
aCookieAttributes.sameSite = nsICookie2::SAMESITE_UNSET;
} else if (tokenValue.LowerCaseEqualsLiteral(kSameSiteLax)) {
aCookieAttributes.sameSite = nsICookie2::SAMESITE_LAX;
} else if (tokenValue.LowerCaseEqualsLiteral(kSameSiteStrict)) {
aCookieAttributes.sameSite = nsICookie2::SAMESITE_STRICT;