summaryrefslogtreecommitdiff
path: root/chromium/net/cookies
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 17:15:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:47:18 +0000
commit7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch)
treea3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/net/cookies
parent6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff)
downloadqtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/net/cookies')
-rw-r--r--chromium/net/cookies/OWNERS2
-rw-r--r--chromium/net/cookies/canonical_cookie.cc6
-rw-r--r--chromium/net/cookies/canonical_cookie.h1
-rw-r--r--chromium/net/cookies/canonical_cookie_unittest.cc79
-rw-r--r--chromium/net/cookies/cookie_monster.cc134
-rw-r--r--chromium/net/cookies/cookie_monster.h38
-rw-r--r--chromium/net/cookies/cookie_monster_store_test.cc9
-rw-r--r--chromium/net/cookies/cookie_monster_unittest.cc208
-rw-r--r--chromium/net/cookies/cookie_options.cc1
-rw-r--r--chromium/net/cookies/cookie_options.h6
-rw-r--r--chromium/net/cookies/cookie_store.h18
-rw-r--r--chromium/net/cookies/cookie_store_test_helpers.cc1
-rw-r--r--chromium/net/cookies/cookie_store_test_helpers.h1
-rw-r--r--chromium/net/cookies/cookie_store_unittest.h16
-rw-r--r--chromium/net/cookies/cookie_util_unittest.cc4
15 files changed, 202 insertions, 322 deletions
diff --git a/chromium/net/cookies/OWNERS b/chromium/net/cookies/OWNERS
index b8c909d7dcc..c97305e856e 100644
--- a/chromium/net/cookies/OWNERS
+++ b/chromium/net/cookies/OWNERS
@@ -1,2 +1,4 @@
jww@chromium.org
mkwst@chromium.org
+
+# COMPONENT: Internals>Network>Cookies
diff --git a/chromium/net/cookies/canonical_cookie.cc b/chromium/net/cookies/canonical_cookie.cc
index de2fbbe6c65..2b53e4ee497 100644
--- a/chromium/net/cookies/canonical_cookie.cc
+++ b/chromium/net/cookies/canonical_cookie.cc
@@ -195,8 +195,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
// origins", if the cookie's "secure-only-flag" is "true" and the requesting
// URL does not have a secure scheme, the cookie should be thrown away.
// https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone
- if (options.enforce_strict_secure() && parsed_cookie.IsSecure() &&
- !url.SchemeIsCryptographic()) {
+ if (parsed_cookie.IsSecure() && !url.SchemeIsCryptographic()) {
VLOG(kVlogSetCookies)
<< "Create() is trying to create a secure cookie from an insecure URL";
return nullptr;
@@ -240,7 +239,6 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority) {
// Expect valid attribute tokens and values, as defined by the ParsedCookie
// logic, otherwise don't create the cookie.
@@ -260,7 +258,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
return nullptr;
}
- if (enforce_strict_secure && secure && !url.SchemeIsCryptographic())
+ if (secure && !url.SchemeIsCryptographic())
return nullptr;
std::string parsed_path = ParsedCookie::ParseValueString(path);
diff --git a/chromium/net/cookies/canonical_cookie.h b/chromium/net/cookies/canonical_cookie.h
index 2ef9131e1a6..18d9302e66b 100644
--- a/chromium/net/cookies/canonical_cookie.h
+++ b/chromium/net/cookies/canonical_cookie.h
@@ -52,7 +52,6 @@ class NET_EXPORT CanonicalCookie {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority);
// Creates a canonical cookie from unparsed attribute values.
diff --git a/chromium/net/cookies/canonical_cookie_unittest.cc b/chromium/net/cookies/canonical_cookie_unittest.cc
index fa9eb6caa83..2386e850cc5 100644
--- a/chromium/net/cookies/canonical_cookie_unittest.cc
+++ b/chromium/net/cookies/canonical_cookie_unittest.cc
@@ -20,7 +20,7 @@ TEST(CanonicalCookieTest, Constructor) {
std::unique_ptr<CanonicalCookie> cookie(CanonicalCookie::Create(
url, "A", "2", std::string(), "/test", current_time, base::Time(), false,
- false, CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
EXPECT_EQ("A", cookie->Name());
EXPECT_EQ("2", cookie->Value());
EXPECT_EQ("www.example.com", cookie->Domain());
@@ -31,7 +31,7 @@ TEST(CanonicalCookieTest, Constructor) {
std::unique_ptr<CanonicalCookie> cookie2(CanonicalCookie::Create(
url, "A", "2", ".www.example.com", std::string(), current_time,
- base::Time(), false, false, CookieSameSite::DEFAULT_MODE, false,
+ base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
COOKIE_PRIORITY_DEFAULT));
EXPECT_EQ("A", cookie2->Name());
EXPECT_EQ("2", cookie2->Value());
@@ -64,11 +64,11 @@ TEST(CanonicalCookieTest, Create) {
EXPECT_EQ("/", cookie->Path());
EXPECT_FALSE(cookie->IsSecure());
- // Test creating secure cookies. RFC 6265 allows insecure urls to set secure
- // cookies.
+ // Test creating secure cookies.
+ // https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone disallows
+ // insecure URLs from setting secure cookies.
cookie = CanonicalCookie::Create(url, "A=2; Secure", creation_time, options);
- EXPECT_TRUE(cookie.get());
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_FALSE(cookie.get());
// Test creating http only cookies.
cookie =
@@ -93,10 +93,9 @@ TEST(CanonicalCookieTest, Create) {
// Test the creating cookies using specific parameter instead of a cookie
// string.
- cookie = CanonicalCookie::Create(url, "A", "2", "www.example.com", "/test",
- creation_time, base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false,
- COOKIE_PRIORITY_DEFAULT);
+ cookie = CanonicalCookie::Create(
+ url, "A", "2", "www.example.com", "/test", creation_time, base::Time(),
+ false, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT);
EXPECT_EQ("A", cookie->Name());
EXPECT_EQ("2", cookie->Value());
EXPECT_EQ(".www.example.com", cookie->Domain());
@@ -105,10 +104,9 @@ TEST(CanonicalCookieTest, Create) {
EXPECT_FALSE(cookie->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie->SameSite());
- cookie = CanonicalCookie::Create(url, "A", "2", ".www.example.com", "/test",
- creation_time, base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false,
- COOKIE_PRIORITY_DEFAULT);
+ cookie = CanonicalCookie::Create(
+ url, "A", "2", ".www.example.com", "/test", creation_time, base::Time(),
+ false, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT);
EXPECT_EQ("A", cookie->Name());
EXPECT_EQ("2", cookie->Value());
EXPECT_EQ(".www.example.com", cookie->Domain());
@@ -167,7 +165,7 @@ TEST(CanonicalCookieTest, EmptyExpiry) {
}
TEST(CanonicalCookieTest, IsEquivalent) {
- GURL url("http://www.example.com/");
+ GURL url("https://www.example.com/");
std::string cookie_name = "A";
std::string cookie_value = "2EDA-EF";
std::string cookie_domain = ".www.example.com";
@@ -181,25 +179,22 @@ TEST(CanonicalCookieTest, IsEquivalent) {
// Test that a cookie is equivalent to itself.
std::unique_ptr<CanonicalCookie> cookie(CanonicalCookie::Create(
url, cookie_name, cookie_value, cookie_domain, cookie_path, creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM));
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsEquivalent(*cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*cookie));
// Test that two identical cookies are equivalent.
std::unique_ptr<CanonicalCookie> other_cookie(CanonicalCookie::Create(
url, cookie_name, cookie_value, cookie_domain, cookie_path, creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM));
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM));
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
// Tests that use different variations of attribute values that
// DON'T affect cookie equivalence.
- other_cookie =
- CanonicalCookie::Create(url, cookie_name, "2", cookie_domain, cookie_path,
- creation_time, expiration_time, secure, httponly,
- same_site, false, COOKIE_PRIORITY_HIGH);
+ other_cookie = CanonicalCookie::Create(
+ url, cookie_name, "2", cookie_domain, cookie_path, creation_time,
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_HIGH);
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_TRUE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
@@ -208,29 +203,28 @@ TEST(CanonicalCookieTest, IsEquivalent) {
creation_time + base::TimeDelta::FromMinutes(2);
other_cookie = CanonicalCookie::Create(
url, cookie_name, "2", cookie_domain, cookie_path, other_creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM);
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM);
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_TRUE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_name, cookie_domain, cookie_path, creation_time,
- expiration_time, true, httponly, same_site, false, COOKIE_PRIORITY_LOW);
+ expiration_time, true, httponly, same_site, COOKIE_PRIORITY_LOW);
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_TRUE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_name, cookie_domain, cookie_path, creation_time,
- expiration_time, secure, true, same_site, false, COOKIE_PRIORITY_LOW);
+ expiration_time, secure, true, same_site, COOKIE_PRIORITY_LOW);
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_TRUE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_name, cookie_domain, cookie_path, creation_time,
- expiration_time, secure, httponly, CookieSameSite::STRICT_MODE, false,
+ expiration_time, secure, httponly, CookieSameSite::STRICT_MODE,
COOKIE_PRIORITY_LOW);
EXPECT_TRUE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
@@ -239,8 +233,7 @@ TEST(CanonicalCookieTest, IsEquivalent) {
// Cookies whose names mismatch are not equivalent.
other_cookie = CanonicalCookie::Create(
url, "B", cookie_value, cookie_domain, cookie_path, creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM);
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM);
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
EXPECT_FALSE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_FALSE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
@@ -250,8 +243,7 @@ TEST(CanonicalCookieTest, IsEquivalent) {
// rules of 'IsEquivalentForSecureCookieMatching'.
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_value, std::string(), cookie_path, creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM);
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM);
EXPECT_TRUE(cookie->IsDomainCookie());
EXPECT_FALSE(other_cookie->IsDomainCookie());
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
@@ -262,7 +254,7 @@ TEST(CanonicalCookieTest, IsEquivalent) {
// 'www.example.com', but they are equivalent for secure cookie matching.
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_value, ".example.com", cookie_path,
- creation_time, expiration_time, secure, httponly, same_site, false,
+ creation_time, expiration_time, secure, httponly, same_site,
COOKIE_PRIORITY_MEDIUM);
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
@@ -275,15 +267,14 @@ TEST(CanonicalCookieTest, IsEquivalent) {
// equivalent for secure cookie matching to |other_cookie| set on '/'.
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_value, cookie_domain, "/test", creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM);
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM);
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
EXPECT_FALSE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_FALSE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_value, cookie_domain, cookie_path + "/subpath",
- creation_time, expiration_time, secure, httponly, same_site, false,
+ creation_time, expiration_time, secure, httponly, same_site,
COOKIE_PRIORITY_MEDIUM);
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
EXPECT_FALSE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
@@ -291,8 +282,7 @@ TEST(CanonicalCookieTest, IsEquivalent) {
other_cookie = CanonicalCookie::Create(
url, cookie_name, cookie_value, cookie_domain, "/", creation_time,
- expiration_time, secure, httponly, same_site, false,
- COOKIE_PRIORITY_MEDIUM);
+ expiration_time, secure, httponly, same_site, COOKIE_PRIORITY_MEDIUM);
EXPECT_FALSE(cookie->IsEquivalent(*other_cookie));
EXPECT_TRUE(cookie->IsEquivalentForSecureCookieMatching(*other_cookie));
EXPECT_FALSE(other_cookie->IsEquivalentForSecureCookieMatching(*cookie));
@@ -563,8 +553,8 @@ TEST(CanonicalCookieTest, HostCookiePrefix) {
// Rules don't apply for a typoed prefix.
EXPECT_TRUE(CanonicalCookie::Create(
- http_url, "__host-A=B; Domain=" + domain + "; Path=/; Secure;",
- creation_time, options));
+ http_url, "__host-A=B; Domain=" + domain + "; Path=/;", creation_time,
+ options));
EXPECT_TRUE(CanonicalCookie::Create(
https_url, "__HostA=B; Domain=" + domain + "; Secure;", creation_time,
options));
@@ -575,7 +565,6 @@ TEST(CanonicalCookieTest, EnforceSecureCookiesRequireSecureScheme) {
GURL https_url("https://www.example.com");
base::Time creation_time = base::Time::Now();
CookieOptions options;
- options.set_enforce_strict_secure();
std::unique_ptr<CanonicalCookie> http_cookie_no_secure(
CanonicalCookie::Create(http_url, "a=b", creation_time, options));
@@ -594,19 +583,19 @@ TEST(CanonicalCookieTest, EnforceSecureCookiesRequireSecureScheme) {
std::unique_ptr<CanonicalCookie> http_cookie_no_secure_extended(
CanonicalCookie::Create(
http_url, "a", "b", "", "", creation_time, creation_time, false,
- false, CookieSameSite::STRICT_MODE, true, COOKIE_PRIORITY_DEFAULT));
+ false, CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> http_cookie_secure_extended(
CanonicalCookie::Create(
http_url, "a", "b", "", "", creation_time, creation_time, true, false,
- CookieSameSite::STRICT_MODE, true, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> https_cookie_no_secure_extended(
CanonicalCookie::Create(
https_url, "a", "b", "", "", creation_time, creation_time, false,
- false, CookieSameSite::STRICT_MODE, true, COOKIE_PRIORITY_DEFAULT));
+ false, CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> https_cookie_secure_extended(
CanonicalCookie::Create(
https_url, "a", "b", "", "", creation_time, creation_time, true,
- false, CookieSameSite::STRICT_MODE, true, COOKIE_PRIORITY_DEFAULT));
+ false, CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT));
EXPECT_TRUE(http_cookie_no_secure_extended.get());
EXPECT_FALSE(http_cookie_secure_extended.get());
diff --git a/chromium/net/cookies/cookie_monster.cc b/chromium/net/cookies/cookie_monster.cc
index 1b812c1d028..2272d7b08ab 100644
--- a/chromium/net/cookies/cookie_monster.cc
+++ b/chromium/net/cookies/cookie_monster.cc
@@ -274,7 +274,7 @@ typedef struct ChangeCausePair_struct {
} ChangeCausePair;
const ChangeCausePair kChangeCauseMapping[] = {
// DELETE_COOKIE_EXPLICIT
- {CookieStore::ChangeCause::EXPLICIT_DELETE, true},
+ {CookieStore::ChangeCause::EXPLICIT, true},
// DELETE_COOKIE_OVERWRITE
{CookieStore::ChangeCause::OVERWRITE, true},
// DELETE_COOKIE_EXPIRED
@@ -282,9 +282,9 @@ const ChangeCausePair kChangeCauseMapping[] = {
// DELETE_COOKIE_EVICTED
{CookieStore::ChangeCause::EVICTED, true},
// DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE
- {CookieStore::ChangeCause::EXPLICIT_DUPLICATE_IN_BACKING_STORE, false},
+ {CookieStore::ChangeCause::EXPLICIT, false},
// DELETE_COOKIE_DONT_RECORD
- {CookieStore::ChangeCause::EXPLICIT_DONT_RECORD, false},
+ {CookieStore::ChangeCause::EXPLICIT, false},
// DELETE_COOKIE_EVICTED_DOMAIN
{CookieStore::ChangeCause::EVICTED, true},
// DELETE_COOKIE_EVICTED_GLOBAL
@@ -299,8 +299,16 @@ const ChangeCausePair kChangeCauseMapping[] = {
{CookieStore::ChangeCause::EVICTED, true},
// DELETE_COOKIE_NON_SECURE
{CookieStore::ChangeCause::EVICTED, true},
+ // DELETE_COOKIE_CREATED_BETWEEN
+ {CookieStore::ChangeCause::EXPLICIT_DELETE_BETWEEN, true},
+ // DELETE_COOKIE_CREATED_BETWEEN_WITH_PREDICATE
+ {CookieStore::ChangeCause::EXPLICIT_DELETE_PREDICATE, true},
+ // DELETE_COOKIE_SINGLE
+ {CookieStore::ChangeCause::EXPLICIT_DELETE_SINGLE, true},
+ // DELETE_COOKIE_CANONICAL
+ {CookieStore::ChangeCause::EXPLICIT_DELETE_CANONICAL, true},
// DELETE_COOKIE_LAST_ENTRY
- {CookieStore::ChangeCause::EXPLICIT_LAST_ENTRY, false}};
+ {CookieStore::ChangeCause::EXPLICIT, false}};
void RunAsync(scoped_refptr<base::TaskRunner> proxy,
const CookieStore::CookieChangedCallback& callback,
@@ -406,7 +414,6 @@ class CookieMonster::SetCookieWithDetailsTask : public CookieMonsterTask {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback)
: CookieMonsterTask(cookie_monster),
@@ -421,7 +428,6 @@ class CookieMonster::SetCookieWithDetailsTask : public CookieMonsterTask {
secure_(secure),
http_only_(http_only),
same_site_(same_site),
- enforce_strict_secure_(enforce_strict_secure),
priority_(priority),
callback_(callback) {}
@@ -443,7 +449,6 @@ class CookieMonster::SetCookieWithDetailsTask : public CookieMonsterTask {
bool secure_;
bool http_only_;
CookieSameSite same_site_;
- bool enforce_strict_secure_;
CookiePriority priority_;
SetCookiesCallback callback_;
@@ -453,8 +458,7 @@ class CookieMonster::SetCookieWithDetailsTask : public CookieMonsterTask {
void CookieMonster::SetCookieWithDetailsTask::Run() {
bool success = this->cookie_monster()->SetCookieWithDetails(
url_, name_, value_, domain_, path_, creation_time_, expiration_time_,
- last_access_time_, secure_, http_only_, same_site_,
- enforce_strict_secure_, priority_);
+ last_access_time_, secure_, http_only_, same_site_, priority_);
if (!callback_.is_null())
callback_.Run(success);
}
@@ -847,13 +851,11 @@ void CookieMonster::SetCookieWithDetailsAsync(
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback) {
scoped_refptr<SetCookieWithDetailsTask> task = new SetCookieWithDetailsTask(
this, url, name, value, domain, path, creation_time, expiration_time,
- last_access_time, secure, http_only, same_site, enforce_strict_secure,
- priority, callback);
+ last_access_time, secure, http_only, same_site, priority, callback);
DoCookieTaskForURL(task, url);
}
@@ -1040,7 +1042,6 @@ bool CookieMonster::SetCookieWithDetails(const GURL& url,
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -1059,7 +1060,7 @@ bool CookieMonster::SetCookieWithDetails(const GURL& url,
std::unique_ptr<CanonicalCookie> cc(CanonicalCookie::Create(
url, name, value, domain, path, actual_creation_time, expiration_time,
- secure, http_only, same_site, enforce_strict_secure, priority));
+ secure, http_only, same_site, priority));
if (!cc.get())
return false;
@@ -1071,8 +1072,6 @@ bool CookieMonster::SetCookieWithDetails(const GURL& url,
options.set_include_httponly();
options.set_same_site_cookie_mode(
CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX);
- if (enforce_strict_secure)
- options.set_enforce_strict_secure();
return SetCanonicalCookie(std::move(cc), url, options);
}
@@ -1100,7 +1099,7 @@ CookieList CookieMonster::GetAllCookies() {
CookieList cookie_list;
cookie_list.reserve(cookie_ptrs.size());
- for (const auto& cookie_ptr : cookie_ptrs)
+ for (auto* cookie_ptr : cookie_ptrs)
cookie_list.push_back(*cookie_ptr);
return cookie_list;
@@ -1140,7 +1139,7 @@ int CookieMonster::DeleteAllCreatedBetween(const Time& delete_begin,
if (cc->CreationDate() >= delete_begin &&
(delete_end.is_null() || cc->CreationDate() < delete_end)) {
InternalDeleteCookie(curit, true, /*sync_to_store*/
- DELETE_COOKIE_EXPLICIT);
+ DELETE_COOKIE_CREATED_BETWEEN);
++num_deleted;
}
}
@@ -1164,7 +1163,7 @@ int CookieMonster::DeleteAllCreatedBetweenWithPredicate(
(delete_end.is_null() || cc->CreationDate() < delete_end) &&
predicate.Run(*cc)) {
InternalDeleteCookie(curit, true, /*sync_to_store*/
- DELETE_COOKIE_EXPLICIT);
+ DELETE_COOKIE_CREATED_BETWEEN_WITH_PREDICATE);
++num_deleted;
}
}
@@ -1230,7 +1229,7 @@ void CookieMonster::DeleteCookie(const GURL& url,
CookieMap::iterator curit = it;
++it;
if (matching_cookies.find(curit->second.get()) != matching_cookies.end()) {
- InternalDeleteCookie(curit, true, DELETE_COOKIE_EXPLICIT);
+ InternalDeleteCookie(curit, true, DELETE_COOKIE_SINGLE);
}
}
}
@@ -1242,7 +1241,7 @@ int CookieMonster::DeleteCanonicalCookie(const CanonicalCookie& cookie) {
its.first != its.second; ++its.first) {
// The creation date acts as the unique index...
if (its.first->second->CreationDate() == cookie.CreationDate()) {
- InternalDeleteCookie(its.first, true, DELETE_COOKIE_EXPLICIT);
+ InternalDeleteCookie(its.first, true, DELETE_COOKIE_CANONICAL);
return 1;
}
}
@@ -1608,8 +1607,7 @@ bool CookieMonster::DeleteAnyEquivalentCookie(const std::string& key,
const CanonicalCookie& ecc,
const GURL& source_url,
bool skip_httponly,
- bool already_expired,
- bool enforce_strict_secure) {
+ bool already_expired) {
DCHECK(thread_checker_.CalledOnValidThread());
bool found_equivalent_cookie = false;
@@ -1624,15 +1622,13 @@ bool CookieMonster::DeleteAnyEquivalentCookie(const std::string& key,
CanonicalCookie* cc = curit->second.get();
++its.first;
- // If strict secure cookies is being enforced, then the equivalency
- // requirements are looser. If the cookie is being set from an insecure
- // scheme, then if a cookie already exists with the same name and it is
- // Secure, then the cookie should *not* be updated if they domain-match and
- // ignoring the path attribute.
+ // If the cookie is being set from an insecure scheme, then if a cookie
+ // already exists with the same name and it is Secure, then the cookie
+ // should *not* be updated if they domain-match and ignoring the path
+ // attribute.
//
- // See: https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone
- if (enforce_strict_secure && cc->IsSecure() &&
- !source_url.SchemeIsCryptographic() &&
+ // See: https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone
+ if (cc->IsSecure() && !source_url.SchemeIsCryptographic() &&
ecc.IsEquivalentForSecureCookieMatching(*cc)) {
skipped_secure_cookie = true;
histogram_cookie_delete_equivalent_->Add(
@@ -1757,16 +1753,11 @@ bool CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc,
bool already_expired = cc->IsExpired(creation_time);
if (DeleteAnyEquivalentCookie(key, *cc, source_url,
- options.exclude_httponly(), already_expired,
- options.enforce_strict_secure())) {
+ options.exclude_httponly(), already_expired)) {
std::string error;
- if (options.enforce_strict_secure()) {
- error =
- "SetCookie() not clobbering httponly cookie or secure cookie for "
- "insecure scheme";
- } else {
- error = "SetCookie() not clobbering httponly cookie";
- }
+ error =
+ "SetCookie() not clobbering httponly cookie or secure cookie for "
+ "insecure scheme";
VLOG(kVlogSetCookies) << error;
return false;
@@ -1794,7 +1785,7 @@ bool CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc,
// make sure that we garbage collect... We can also make the assumption that
// if a cookie was set, in the common case it will be used soon after,
// and we will purge the expired cookies in GetCookies().
- GarbageCollect(creation_time, key, options.enforce_strict_secure());
+ GarbageCollect(creation_time, key);
return true;
}
@@ -1846,8 +1837,13 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
"kChangeCauseMapping size should match DeletionCause size");
// See InitializeHistograms() for details.
+ DeletionCause deletion_cause_to_record = deletion_cause;
+ if (deletion_cause >= DELETE_COOKIE_CREATED_BETWEEN &&
+ deletion_cause <= DELETE_COOKIE_CANONICAL) {
+ deletion_cause_to_record = DELETE_COOKIE_EXPLICIT;
+ }
if (deletion_cause != DELETE_COOKIE_DONT_RECORD)
- histogram_cookie_deletion_cause_->Add(deletion_cause);
+ histogram_cookie_deletion_cause_->Add(deletion_cause_to_record);
CanonicalCookie* cc = it->second.get();
VLOG(kVlogSetCookies) << "InternalDeleteCookie()"
@@ -1867,8 +1863,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
// Domain expiry behavior is unchanged by key/expiry scheme (the
// meaning of the key is different, but that's not visible to this routine).
size_t CookieMonster::GarbageCollect(const Time& current,
- const std::string& key,
- bool enforce_strict_secure) {
+ const std::string& key) {
DCHECK(thread_checker_.CalledOnValidThread());
size_t num_deleted = 0;
@@ -1926,11 +1921,6 @@ size_t CookieMonster::GarbageCollect(const Time& current,
size_t quota = 0;
for (const auto& purge_round : purge_rounds) {
- // Only observe the non-secure purge rounds if strict secure cookies is
- // enabled.
- if (!enforce_strict_secure && purge_round.protect_secure_cookies)
- continue;
-
// Adjust quota according to the priority of cookies. Each round should
// protect certain number of cookies in order to avoid starvation.
// For example, when each round starts to remove cookies, the number of
@@ -1949,11 +1939,9 @@ size_t CookieMonster::GarbageCollect(const Time& current,
break;
}
size_t just_deleted = 0u;
- // Purge up to |purge_goal| for all cookies at the given priority. This
- // path will always execute if strict secure cookies is disabled since
- // |purge_goal| must be positive because of the for-loop guard. If
- // strict secure cookies is enabled, this path will be taken only if the
- // initial non-secure purge did not evict enough cookies.
+ // Purge up to |purge_goal| for all cookies at the given priority. This
+ // path will be taken only if the initial non-secure purge did not evict
+ // enough cookies.
if (purge_goal > 0) {
just_deleted = PurgeLeastRecentMatches(
cookie_its, purge_round.priority, quota, purge_goal,
@@ -1983,27 +1971,22 @@ size_t CookieMonster::GarbageCollect(const Time& current,
size_t purge_goal = cookie_its.size() - (kMaxCookies - kPurgeCookies);
DCHECK(purge_goal > kPurgeCookies);
- if (enforce_strict_secure) {
- CookieItVector secure_cookie_its;
- CookieItVector non_secure_cookie_its;
- SplitCookieVectorIntoSecureAndNonSecure(cookie_its, &secure_cookie_its,
- &non_secure_cookie_its);
- size_t non_secure_purge_goal =
- std::min<size_t>(purge_goal, non_secure_cookie_its.size() - 1);
-
- size_t just_deleted = GarbageCollectLeastRecentlyAccessed(
- current, safe_date, non_secure_purge_goal, non_secure_cookie_its);
- num_deleted += just_deleted;
-
- if (just_deleted < purge_goal) {
- size_t secure_purge_goal = std::min<size_t>(
- purge_goal - just_deleted, secure_cookie_its.size() - 1);
- num_deleted += GarbageCollectLeastRecentlyAccessed(
- current, safe_date, secure_purge_goal, secure_cookie_its);
- }
- } else {
+ CookieItVector secure_cookie_its;
+ CookieItVector non_secure_cookie_its;
+ SplitCookieVectorIntoSecureAndNonSecure(cookie_its, &secure_cookie_its,
+ &non_secure_cookie_its);
+ size_t non_secure_purge_goal =
+ std::min<size_t>(purge_goal, non_secure_cookie_its.size() - 1);
+
+ size_t just_deleted = GarbageCollectLeastRecentlyAccessed(
+ current, safe_date, non_secure_purge_goal, non_secure_cookie_its);
+ num_deleted += just_deleted;
+
+ if (just_deleted < purge_goal && secure_cookie_its.size() > 0) {
+ size_t secure_purge_goal = std::min<size_t>(
+ purge_goal - just_deleted, secure_cookie_its.size() - 1);
num_deleted += GarbageCollectLeastRecentlyAccessed(
- current, safe_date, purge_goal, cookie_its);
+ current, safe_date, secure_purge_goal, secure_cookie_its);
}
}
}
@@ -2113,8 +2096,7 @@ size_t CookieMonster::GarbageCollectLeastRecentlyAccessed(
// Find boundary to cookies older than safe_date.
CookieItVector::iterator global_purge_it = LowerBoundAccessDate(
cookie_its.begin(), cookie_its.begin() + purge_goal, safe_date);
- // Only delete the old cookies, and if strict secure is enabled, delete
- // non-secure ones first.
+ // Only delete the old cookies and delete non-secure ones first.
size_t num_deleted =
GarbageCollectDeleteRange(current, DELETE_COOKIE_EVICTED_GLOBAL,
cookie_its.begin(), global_purge_it);
diff --git a/chromium/net/cookies/cookie_monster.h b/chromium/net/cookies/cookie_monster.h
index d509c41203d..ff7c47f8b0a 100644
--- a/chromium/net/cookies/cookie_monster.h
+++ b/chromium/net/cookies/cookie_monster.h
@@ -164,7 +164,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback) override;
void GetCookiesWithOptionsAsync(const GURL& url,
@@ -265,13 +264,11 @@ class NET_EXPORT CookieMonster : public CookieStore {
FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, CookieSourceHistogram);
// For kSafeFromGlobalPurgeDays in CookieStore.
- FRIEND_TEST_ALL_PREFIXES(CookieMonsterStrictSecureTest, EvictSecureCookies);
+ FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, EvictSecureCookies);
// For CookieDeleteEquivalent histogram enum.
FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest,
CookieDeleteEquivalentHistogramTest);
- FRIEND_TEST_ALL_PREFIXES(CookieMonsterStrictSecureTest,
- CookieDeleteEquivalentHistogramTest);
// Internal reasons for deletion, used to populate informative histograms
// and to provide a public cause for onCookieChange notifications.
@@ -280,8 +277,11 @@ class NET_EXPORT CookieMonster : public CookieStore {
// the CookieStore::ChangeCause mapping inside ChangeCauseMapping.
// Moreover, these are used as array indexes, so avoid reordering to keep the
// histogram buckets consistent. New items (if necessary) should be added
- // at the end of the list, just before DELETE_COOKIE_LAST_ENTRY.
+ // at the end of the list, before DELETE_COOKIE_LAST_ENTRY and the temporary
+ // values added for debugging.
enum DeletionCause {
+ // DELETE_COOKIE_EXPLICIT is temporarily unused (except for logging to the
+ // histogram) - see values 13-16 below.
DELETE_COOKIE_EXPLICIT = 0,
DELETE_COOKIE_OVERWRITE = 1,
DELETE_COOKIE_EXPIRED = 2,
@@ -313,7 +313,18 @@ class NET_EXPORT CookieMonster : public CookieStore {
// right after expired cookies.
DELETE_COOKIE_NON_SECURE = 12,
- DELETE_COOKIE_LAST_ENTRY = 13
+ // The following values are temporary and being used to track down a bug.
+ // They should be treated the same as DELETE_COOKIE_EXPLICIT, and are logged
+ // to the histogram as DELETE_COOKIE_EXPLICIT.
+ DELETE_COOKIE_CREATED_BETWEEN = 13,
+ DELETE_COOKIE_CREATED_BETWEEN_WITH_PREDICATE = 14,
+ DELETE_COOKIE_SINGLE = 15,
+ DELETE_COOKIE_CANONICAL = 16,
+
+ // Do not add new values between DELETE_COOKIE_CREATED_BETWEEN and
+ // DELETE_COOKIE_LAST_ENTRY, as the above values are temporary. Instead, new
+ // values should go before DELETE_COOKIE_CREATED_BETWEEN.
+ DELETE_COOKIE_LAST_ENTRY = 17
};
// This enum is used to generate a histogramed bitmask measureing the types
@@ -398,7 +409,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority);
CookieList GetAllCookies();
@@ -494,17 +504,15 @@ class NET_EXPORT CookieMonster : public CookieStore {
// |source_url| is the URL that is attempting to set the cookie.
// If |skip_httponly| is true, httponly cookies will not be deleted. The
// return value will be true if |skip_httponly| skipped an httponly cookie or
- // |enforce_strict_secure| is true and the cookie to
- // delete was Secure and the scheme of |ecc| is insecure. |key| is the key to
- // find the cookie in cookies_; see the comment before the CookieMap typedef
- // for details.
+ // the cookie to delete was Secure and the scheme of |ecc| is insecure. |key|
+ // is the key to find the cookie in cookies_; see the comment before the
+ // CookieMap typedef for details.
// NOTE: There should never be more than a single matching equivalent cookie.
bool DeleteAnyEquivalentCookie(const std::string& key,
const CanonicalCookie& ecc,
const GURL& source_url,
bool skip_httponly,
- bool already_expired,
- bool enforce_strict_secure);
+ bool already_expired);
// Inserts |cc| into cookies_. Returns an iterator that points to the inserted
// cookie in cookies_. Guarantee: all iterators to cookies_ remain valid.
@@ -548,9 +556,7 @@ class NET_EXPORT CookieMonster : public CookieStore {
// constants for details.
//
// Returns the number of cookies deleted (useful for debugging).
- size_t GarbageCollect(const base::Time& current,
- const std::string& key,
- bool enforce_strict_secure);
+ size_t GarbageCollect(const base::Time& current, const std::string& key);
// Helper for GarbageCollect(). Deletes up to |purge_goal| cookies with a
// priority less than or equal to |priority| from |cookies|, while ensuring
diff --git a/chromium/net/cookies/cookie_monster_store_test.cc b/chromium/net/cookies/cookie_monster_store_test.cc
index 1375134a16c..558d4bc02c3 100644
--- a/chromium/net/cookies/cookie_monster_store_test.cc
+++ b/chromium/net/cookies/cookie_monster_store_test.cc
@@ -133,7 +133,7 @@ std::unique_ptr<CanonicalCookie> BuildCanonicalCookie(
return CanonicalCookie::Create(url, pc.Name(), pc.Value(), url.host(),
cookie_path, creation_time, cookie_expires,
pc.IsSecure(), pc.IsHttpOnly(), pc.SameSite(),
- false, pc.Priority());
+ pc.Priority());
}
void AddCookieToList(const GURL& url,
@@ -235,10 +235,13 @@ std::unique_ptr<CookieMonster> CreateMonsterFromStoreForGC(
? current - base::TimeDelta::FromDays(days_old)
: current;
+ // The URL must be HTTPS since |secure| can be true or false, and because
+ // strict secure cookies are enforced, the cookie will fail to be created if
+ // |secure| is true but the URL is an insecure scheme.
std::unique_ptr<CanonicalCookie> cc(CanonicalCookie::Create(
- GURL(base::StringPrintf("http://h%05d.izzle/", i)), "a", "1",
+ GURL(base::StringPrintf("https://h%05d.izzle/", i)), "a", "1",
std::string(), "/path", creation_time, expiration_time, secure, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
cc->SetLastAccessDate(last_access_time);
store->AddCookie(*cc);
}
diff --git a/chromium/net/cookies/cookie_monster_unittest.cc b/chromium/net/cookies/cookie_monster_unittest.cc
index 52812d332da..706c75f6202 100644
--- a/chromium/net/cookies/cookie_monster_unittest.cc
+++ b/chromium/net/cookies/cookie_monster_unittest.cc
@@ -108,31 +108,12 @@ struct CookieMonsterTestTraits {
static const bool filters_schemes = true;
static const bool has_path_prefix_bug = false;
static const int creation_time_granularity_in_ms = 0;
- static const bool enforce_strict_secure = false;
-};
-
-struct CookieMonsterEnforcingStrictSecure {
- static std::unique_ptr<CookieStore> Create() {
- return base::MakeUnique<CookieMonster>(nullptr, nullptr);
- }
-
- static const bool supports_http_only = true;
- static const bool supports_non_dotted_domains = true;
- static const bool preserves_trailing_dots = true;
- static const bool filters_schemes = true;
- static const bool has_path_prefix_bug = false;
- static const int creation_time_granularity_in_ms = 0;
- static const bool enforce_strict_secure = true;
};
INSTANTIATE_TYPED_TEST_CASE_P(CookieMonster,
CookieStoreTest,
CookieMonsterTestTraits);
-INSTANTIATE_TYPED_TEST_CASE_P(CookieMonsterStrictSecure,
- CookieStoreTest,
- CookieMonsterEnforcingStrictSecure);
-
template <typename T>
class CookieMonsterTestBase : public CookieStoreTest<T> {
public:
@@ -805,8 +786,6 @@ class CookieMonsterTestBase : public CookieStoreTest<T> {
};
using CookieMonsterTest = CookieMonsterTestBase<CookieMonsterTestTraits>;
-using CookieMonsterStrictSecureTest =
- CookieMonsterTestBase<CookieMonsterEnforcingStrictSecure>;
// TODO(erikwright): Replace the other callbacks and synchronous helper methods
// in this test suite with these Mocks.
@@ -864,7 +843,7 @@ ACTION_P3(SetCookieWithDetailsAction, cookie_monster, cc, callback) {
cookie_monster->SetCookieWithDetailsAsync(
cc.url, cc.name, cc.value, cc.domain, cc.path, base::Time(),
cc.expiration_time, base::Time(), cc.secure, cc.http_only, cc.same_site,
- false /* enforces strict secure cookies */, cc.priority, callback->Get());
+ cc.priority, callback->Get());
}
ACTION_P2(GetAllCookiesAction, cookie_monster, callback) {
@@ -1063,11 +1042,11 @@ TEST_F(DeferredCookieTaskTest, DeferredSetAllCookies) {
list.push_back(*CanonicalCookie::Create(
http_www_google_.url(), "A", "B", http_www_google_.domain(), "/",
base::Time::Now(), base::Time(), false, true,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::Create(
http_www_google_.url(), "C", "D", http_www_google_.domain(), "/",
base::Time::Now(), base::Time(), false, true,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
BeginWith(
SetAllCookiesAction(&cookie_monster(), list, &set_cookies_callback));
@@ -1565,7 +1544,7 @@ TEST_F(CookieMonsterTest, TestPriorityAwareGarbageCollectionSecure) {
TestPriorityAwareGarbageCollectHelperSecure();
}
-TEST_F(CookieMonsterStrictSecureTest, TestPriorityAwareGarbageCollectionMixed) {
+TEST_F(CookieMonsterTest, TestPriorityAwareGarbageCollectionMixed) {
TestPriorityAwareGarbageCollectHelperMixed();
}
@@ -2557,15 +2536,15 @@ TEST_F(CookieMonsterTest, SetAllCookies) {
list.push_back(*CanonicalCookie::Create(
http_www_google_.url(), "A", "B", http_www_google_.url().host(), "/",
base::Time::Now(), base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::Create(
http_www_google_.url(), "W", "X", http_www_google_.url().host(), "/bar",
base::Time::Now(), base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
list.push_back(*CanonicalCookie::Create(
http_www_google_.url(), "Y", "Z", http_www_google_.url().host(), "/",
base::Time::Now(), base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
// SetAllCookies must not flush.
ASSERT_EQ(0, store->flush_count());
@@ -2600,51 +2579,51 @@ TEST_F(CookieMonsterTest, ComputeCookieDiff) {
std::unique_ptr<CanonicalCookie> cookie1(CanonicalCookie::Create(
http_www_google_.url(), "A", "B", http_www_google_.url().host(), "/",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie2(CanonicalCookie::Create(
http_www_google_.url(), "C", "D", http_www_google_.url().host(), "/",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie3(CanonicalCookie::Create(
http_www_google_.url(), "E", "F", http_www_google_.url().host(), "/",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie4(CanonicalCookie::Create(
http_www_google_.url(), "G", "H", http_www_google_.url().host(), "/",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie4_with_new_value(
CanonicalCookie::Create(
http_www_google_.url(), "G", "iamnew", http_www_google_.url().host(),
"/", creation_time, base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie5(CanonicalCookie::Create(
http_www_google_.url(), "I", "J", http_www_google_.url().host(), "/",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie5_with_new_creation_time(
CanonicalCookie::Create(
http_www_google_.url(), "I", "J", http_www_google_.url().host(), "/",
- now, base::Time(), false, false, CookieSameSite::DEFAULT_MODE, false,
+ now, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie6(CanonicalCookie::Create(
http_www_google_.url(), "K", "L", http_www_google_.url().host(), "/foo",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie6_with_new_path(
CanonicalCookie::Create(
http_www_google_.url(), "K", "L", http_www_google_.url().host(),
"/bar", creation_time, base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie7(CanonicalCookie::Create(
http_www_google_.url(), "M", "N", http_www_google_.url().host(), "/foo",
creation_time, base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT));
+ COOKIE_PRIORITY_DEFAULT));
std::unique_ptr<CanonicalCookie> cookie7_with_new_path(
CanonicalCookie::Create(
http_www_google_.url(), "M", "N", http_www_google_.url().host(),
"/bar", creation_time, base::Time(), false, false,
- CookieSameSite::DEFAULT_MODE, false, COOKIE_PRIORITY_DEFAULT));
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
CookieList old_cookies;
old_cookies.push_back(*cookie1);
@@ -2861,7 +2840,7 @@ TEST_F(CookieMonsterTest, ControlCharacterPurge) {
"\x05"
"boo",
domain, path, now2, later, false, false, CookieSameSite::DEFAULT_MODE,
- false, COOKIE_PRIORITY_DEFAULT);
+ COOKIE_PRIORITY_DEFAULT);
initial_cookies.push_back(std::move(cc));
AddCookieToList(url, "hello=world; path=" + path, now3, &initial_cookies);
@@ -2900,48 +2879,47 @@ TEST_F(CookieMonsterTest, CookieSourceHistogram) {
CookieMonster::COOKIE_SOURCE_NONSECURE_COOKIE_CRYPTOGRAPHIC_SCHEME, 1);
// Set a secure cookie on a non-cryptographic scheme.
- EXPECT_TRUE(
+ EXPECT_FALSE(
SetCookie(cm.get(), http_www_google_.url(), "D=E; path=/; Secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 3);
+ histograms.ExpectTotalCount(cookie_source_histogram, 2);
histograms.ExpectBucketCount(
cookie_source_histogram,
- CookieMonster::COOKIE_SOURCE_SECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME, 1);
+ CookieMonster::COOKIE_SOURCE_SECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME, 0);
// Overwrite a secure cookie (set by a cryptographic scheme) on a
// non-cryptographic scheme.
- EXPECT_TRUE(
+ EXPECT_FALSE(
SetCookie(cm.get(), http_www_google_.url(), "A=B; path=/; Secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 4);
+ histograms.ExpectTotalCount(cookie_source_histogram, 2);
histograms.ExpectBucketCount(
cookie_source_histogram,
CookieMonster::COOKIE_SOURCE_SECURE_COOKIE_CRYPTOGRAPHIC_SCHEME, 1);
histograms.ExpectBucketCount(
cookie_source_histogram,
- CookieMonster::COOKIE_SOURCE_SECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME, 2);
+ CookieMonster::COOKIE_SOURCE_SECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME, 0);
- // Test that clearing a secure cookie on a http:// URL does not get
- // counted.
+ // Test that attempting to clear a secure cookie on a http:// URL does
+ // nothing.
EXPECT_TRUE(
SetCookie(cm.get(), https_www_google_.url(), "F=G; path=/; Secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 5);
+ histograms.ExpectTotalCount(cookie_source_histogram, 3);
std::string cookies1 = GetCookies(cm.get(), https_www_google_.url());
EXPECT_NE(std::string::npos, cookies1.find("F=G"));
- EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(),
- "F=G; path=/; Expires=Thu, 01-Jan-1970 00:00:01 GMT"));
+ EXPECT_FALSE(SetCookie(cm.get(), http_www_google_.url(),
+ "F=G; path=/; Expires=Thu, 01-Jan-1970 00:00:01 GMT"));
std::string cookies2 = GetCookies(cm.get(), https_www_google_.url());
- EXPECT_EQ(std::string::npos, cookies2.find("F=G"));
- histograms.ExpectTotalCount(cookie_source_histogram, 5);
+ EXPECT_NE(std::string::npos, cookies2.find("F=G"));
+ histograms.ExpectTotalCount(cookie_source_histogram, 3);
// Set a non-secure cookie on a non-cryptographic scheme.
EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "H=I; path=/"));
- histograms.ExpectTotalCount(cookie_source_histogram, 6);
+ histograms.ExpectTotalCount(cookie_source_histogram, 4);
histograms.ExpectBucketCount(
cookie_source_histogram,
CookieMonster::COOKIE_SOURCE_NONSECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME, 1);
}
-// Test that cookie delete equivalent histograms are recorded correctly when
-// strict secure cookies are not enabled.
+// Test that cookie delete equivalent histograms are recorded correctly.
TEST_F(CookieMonsterTest, CookieDeleteEquivalentHistogramTest) {
base::HistogramTester histograms;
const std::string cookie_source_histogram = "Cookie.CookieDeleteEquivalent";
@@ -2971,47 +2949,57 @@ TEST_F(CookieMonsterTest, CookieDeleteEquivalentHistogramTest) {
// Set a non-secure cookie from an insecure origin that matches the name of an
// already existing cookie and additionally is equivalent to the existing
- // cookie.
- EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=B;"));
- histograms.ExpectTotalCount(cookie_source_histogram, 5);
+ // cookie. This should fail since it's trying to overwrite a secure cookie.
+ EXPECT_FALSE(SetCookie(cm.get(), http_www_google_.url(), "A=B;"));
+ histograms.ExpectTotalCount(cookie_source_histogram, 6);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
4);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_FOUND,
- 1);
+ 0);
+ histograms.ExpectBucketCount(
+ cookie_source_histogram,
+ CookieMonster::COOKIE_DELETE_EQUIVALENT_SKIPPING_SECURE, 1);
+ histograms.ExpectBucketCount(
+ cookie_source_histogram,
+ CookieMonster::COOKIE_DELETE_EQUIVALENT_WOULD_HAVE_DELETED, 1);
// Set a non-secure cookie from an insecure origin that matches the name of an
- // already existing cookie but is not equivalent.
- EXPECT_TRUE(
+ // already existing cookie but is not equivalent. This should fail since it's
+ // trying to shadow a secure cookie.
+ EXPECT_FALSE(
SetCookie(cm.get(), http_www_google_.url(), "A=C; path=/some/path"));
- histograms.ExpectTotalCount(cookie_source_histogram, 6);
+ histograms.ExpectTotalCount(cookie_source_histogram, 8);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
5);
+ histograms.ExpectBucketCount(
+ cookie_source_histogram,
+ CookieMonster::COOKIE_DELETE_EQUIVALENT_SKIPPING_SECURE, 2);
// Set a secure cookie from a secure origin that matches the name of an
// already existing cookies and is equivalent.
EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(), "A=D; secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 8);
+ histograms.ExpectTotalCount(cookie_source_histogram, 10);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
6);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_FOUND,
- 2);
+ 1);
// Set a secure cookie from a secure origin that matches the name of an
// already existing cookie and is not equivalent.
EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(),
"A=E; secure; path=/some/other/path"));
- histograms.ExpectTotalCount(cookie_source_histogram, 9);
+ histograms.ExpectTotalCount(cookie_source_histogram, 11);
histograms.ExpectBucketCount(cookie_source_histogram,
CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
7);
}
-TEST_F(CookieMonsterStrictSecureTest, SetSecureCookies) {
+TEST_F(CookieMonsterTest, SetSecureCookies) {
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
GURL http_url("http://www.google.com");
GURL http_superdomain_url("http://google.com");
@@ -3077,7 +3065,6 @@ TEST_F(CookieMonsterStrictSecureTest, SetSecureCookies) {
// version of the cookie still does not overwrite it.
CookieOptions include_httponly;
include_httponly.set_include_httponly();
- include_httponly.set_enforce_strict_secure();
EXPECT_TRUE(SetCookieWithOptions(cm.get(), https_url, "C=D; httponly",
include_httponly));
// Note that the lack of an explicit options object below uses the default,
@@ -3085,8 +3072,8 @@ TEST_F(CookieMonsterStrictSecureTest, SetSecureCookies) {
EXPECT_FALSE(SetCookie(cm.get(), https_url, "C=E; Secure"));
}
-// Tests for behavior if strict secure cookies is enabled.
-TEST_F(CookieMonsterStrictSecureTest, EvictSecureCookies) {
+// Tests for behavior for strict secure cookies.
+TEST_F(CookieMonsterTest, EvictSecureCookies) {
// Hard-coding limits in the test, but use DCHECK_EQ to enforce constraint.
DCHECK_EQ(180U, CookieMonster::kDomainMaxCookies);
DCHECK_EQ(150U, CookieMonster::kDomainMaxCookies -
@@ -3215,7 +3202,7 @@ TEST_F(CookieMonsterStrictSecureTest, EvictSecureCookies) {
// Tests that strict secure cookies doesn't trip equivalent cookie checks
// accidentally. Regression test for https://crbug.com/569943.
-TEST_F(CookieMonsterStrictSecureTest, EquivalentCookies) {
+TEST_F(CookieMonsterTest, EquivalentCookies) {
std::unique_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr));
GURL http_url("http://www.google.com");
GURL http_superdomain_url("http://google.com");
@@ -3234,83 +3221,6 @@ TEST_F(CookieMonsterStrictSecureTest, EquivalentCookies) {
EXPECT_FALSE(SetCookie(cm.get(), http_url, "A=D; domain=google.com"));
}
-// Test that cookie delete equivalent histograms are recorded correctly for
-// strict secure cookies.
-TEST_F(CookieMonsterStrictSecureTest, CookieDeleteEquivalentHistogramTest) {
- base::HistogramTester histograms;
- const std::string cookie_source_histogram = "Cookie.CookieDeleteEquivalent";
-
- scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore);
- std::unique_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr));
-
- // Set a secure cookie from a secure origin
- EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(), "A=B; Secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 1);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 1);
-
- // Set a new cookie with a different name from a variety of origins (including
- // the same one).
- EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(), "B=A;"));
- histograms.ExpectTotalCount(cookie_source_histogram, 2);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 2);
- EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "C=A;"));
- histograms.ExpectTotalCount(cookie_source_histogram, 3);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 3);
-
- // Set a non-secure cookie from an insecure origin that matches the name of an
- // already existing cookie and additionally is equivalent to the existing
- // cookie.
- EXPECT_FALSE(SetCookie(cm.get(), http_www_google_.url(), "A=B;"));
- histograms.ExpectTotalCount(cookie_source_histogram, 6);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 4);
- histograms.ExpectBucketCount(
- cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_SKIPPING_SECURE, 1);
- histograms.ExpectBucketCount(
- cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_WOULD_HAVE_DELETED, 1);
-
- // Set a non-secure cookie from an insecure origin that matches the name of an
- // already existing cookie but is not equivalent.
- EXPECT_FALSE(
- SetCookie(cm.get(), http_www_google_.url(), "A=B; path=/some/path"));
- histograms.ExpectTotalCount(cookie_source_histogram, 8);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 5);
- histograms.ExpectBucketCount(
- cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_SKIPPING_SECURE, 2);
-
- // Set a secure cookie from a secure origin that matches the name of an
- // already existing cookies and is equivalent.
- EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(), "A=B; secure"));
- histograms.ExpectTotalCount(cookie_source_histogram, 10);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 6);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_FOUND,
- 1);
-
- // Set a secure cookie from a secure origin that matches the name of an
- // already existing cookie and is not equivalent.
- EXPECT_TRUE(SetCookie(cm.get(), https_www_google_.url(),
- "A=C; secure; path=/some/path"));
- histograms.ExpectTotalCount(cookie_source_histogram, 11);
- histograms.ExpectBucketCount(cookie_source_histogram,
- CookieMonster::COOKIE_DELETE_EQUIVALENT_ATTEMPT,
- 7);
-}
-
class CookieMonsterNotificationTest : public CookieMonsterTest {
public:
CookieMonsterNotificationTest()
@@ -3398,7 +3308,7 @@ TEST_F(CookieMonsterNotificationTest, NotifyOnDelete) {
EXPECT_EQ("abc", cookies[1].Name());
EXPECT_EQ("def", cookies[1].Value());
- EXPECT_EQ(CookieStore::ChangeCause::EXPLICIT_DELETE, causes[1]);
+ EXPECT_EQ(CookieStore::ChangeCause::EXPLICIT_DELETE_SINGLE, causes[1]);
}
TEST_F(CookieMonsterNotificationTest, NotifyOnUpdate) {
diff --git a/chromium/net/cookies/cookie_options.cc b/chromium/net/cookies/cookie_options.cc
index 8698afdbd7b..3a4e584ec62 100644
--- a/chromium/net/cookies/cookie_options.cc
+++ b/chromium/net/cookies/cookie_options.cc
@@ -11,7 +11,6 @@ namespace net {
CookieOptions::CookieOptions()
: exclude_httponly_(true),
same_site_cookie_mode_(SameSiteCookieMode::DO_NOT_INCLUDE),
- enforce_strict_secure_(false),
update_access_time_(true),
server_time_() {}
diff --git a/chromium/net/cookies/cookie_options.h b/chromium/net/cookies/cookie_options.h
index d1c6afc6371..53a4d0f0c0e 100644
--- a/chromium/net/cookies/cookie_options.h
+++ b/chromium/net/cookies/cookie_options.h
@@ -50,11 +50,6 @@ class NET_EXPORT CookieOptions {
return same_site_cookie_mode_;
}
- // TODO(jww): Remove once we decide whether to ship modifying 'secure' cookies
- // only from secure schemes. https://crbug.com/546820
- void set_enforce_strict_secure() { enforce_strict_secure_ = true; }
- bool enforce_strict_secure() const { return enforce_strict_secure_; }
-
// |server_time| indicates what the server sending us the Cookie thought the
// current time was when the cookie was produced. This is used to adjust for
// clock skew between server and host.
@@ -70,7 +65,6 @@ class NET_EXPORT CookieOptions {
private:
bool exclude_httponly_;
SameSiteCookieMode same_site_cookie_mode_;
- bool enforce_strict_secure_;
bool update_access_time_;
base::Time server_time_;
};
diff --git a/chromium/net/cookies/cookie_store.h b/chromium/net/cookies/cookie_store.h
index 63241b5e59a..a2be2550dd7 100644
--- a/chromium/net/cookies/cookie_store.h
+++ b/chromium/net/cookies/cookie_store.h
@@ -36,14 +36,15 @@ class NET_EXPORT CookieStore {
// The cookie was inserted.
INSERTED,
// The cookie was changed directly by a consumer's action.
- // The following enum values all have the same meaning, but are being used
- // to track down where a bug came from.
- // TODO(nharper): Remove all but one of these and rename to EXPLICIT once
- // the one of interest has been found.
- EXPLICIT_DELETE,
- EXPLICIT_DUPLICATE_IN_BACKING_STORE,
- EXPLICIT_DONT_RECORD,
- EXPLICIT_LAST_ENTRY,
+ EXPLICIT,
+ // The following four values have the same meaning as EXPLICIT, but are
+ // being used to track down where a bug is coming from.
+ // TODO(nharper): Remove the following four values once the one of interest
+ // has been found.
+ EXPLICIT_DELETE_BETWEEN,
+ EXPLICIT_DELETE_PREDICATE,
+ EXPLICIT_DELETE_SINGLE,
+ EXPLICIT_DELETE_CANONICAL,
// The cookie was deleted, but no more details are known.
UNKNOWN_DELETION,
// The cookie was automatically removed due to an insert operation that
@@ -123,7 +124,6 @@ class NET_EXPORT CookieStore {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback) = 0;
diff --git a/chromium/net/cookies/cookie_store_test_helpers.cc b/chromium/net/cookies/cookie_store_test_helpers.cc
index 5ae3629ae19..bed506f1808 100644
--- a/chromium/net/cookies/cookie_store_test_helpers.cc
+++ b/chromium/net/cookies/cookie_store_test_helpers.cc
@@ -87,7 +87,6 @@ void DelayedCookieMonster::SetCookieWithDetailsAsync(
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback) {
NOTREACHED();
diff --git a/chromium/net/cookies/cookie_store_test_helpers.h b/chromium/net/cookies/cookie_store_test_helpers.h
index 687261ec7bc..bb6d656b140 100644
--- a/chromium/net/cookies/cookie_store_test_helpers.h
+++ b/chromium/net/cookies/cookie_store_test_helpers.h
@@ -42,7 +42,6 @@ class DelayedCookieMonster : public CookieStore {
bool secure,
bool http_only,
CookieSameSite same_site,
- bool enforce_strict_secure,
CookiePriority priority,
const SetCookiesCallback& callback) override;
diff --git a/chromium/net/cookies/cookie_store_unittest.h b/chromium/net/cookies/cookie_store_unittest.h
index f7ba3d8a6b3..48d9d8c54e2 100644
--- a/chromium/net/cookies/cookie_store_unittest.h
+++ b/chromium/net/cookies/cookie_store_unittest.h
@@ -65,9 +65,6 @@ const char kValidCookieLine[] = "A=B; path=/";
// // Time to wait between two cookie insertions to ensure that cookies have
// // different creation times.
// static const int creation_time_granularity_in_ms;
-//
-// // The cookie store enforces secure flag requires a secure scheme.
-// static const bool enforce_strict_secure;
// };
template <class CookieStoreTestTraits>
@@ -177,8 +174,7 @@ class CookieStoreTest : public testing::Test {
ResultSavingCookieCallback<bool> callback;
cs->SetCookieWithDetailsAsync(
url, name, value, domain, path, creation_time, expiration_time,
- last_access_time, secure, http_only, same_site,
- false /* enforces strict secure cookies */, priority,
+ last_access_time, secure, http_only, same_site, priority,
base::Bind(&ResultSavingCookieCallback<bool>::Run,
base::Unretained(&callback)));
callback.WaitUntilDone();
@@ -202,8 +198,6 @@ class CookieStoreTest : public testing::Test {
CookieOptions options;
if (!CookieStoreTestTraits::supports_http_only)
options.set_include_httponly();
- if (CookieStoreTestTraits::enforce_strict_secure)
- options.set_enforce_strict_secure();
return SetCookieWithOptions(cs, url, cookie_line, options);
}
@@ -355,10 +349,16 @@ TYPED_TEST_P(CookieStoreTest, SetCookieWithDetailsAsync) {
cs, this->www_google_bar_.url(), "C", "D", this->www_google_bar_.domain(),
"/bar", two_hours_ago, base::Time(), one_hour_ago, false, true,
CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
- EXPECT_TRUE(this->SetCookieWithDetails(
+ // Because of strict secure cookies, a cookie made by an HTTP URL should fail
+ // to create a cookie with a the secure attribute.
+ EXPECT_FALSE(this->SetCookieWithDetails(
cs, this->http_www_google_.url(), "E", "F", std::string(), std::string(),
base::Time(), base::Time(), base::Time(), true, false,
CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
+ EXPECT_TRUE(this->SetCookieWithDetails(
+ cs, this->https_www_google_.url(), "E", "F", std::string(), std::string(),
+ base::Time(), base::Time(), base::Time(), true, false,
+ CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
// Test that malformed attributes fail to set the cookie.
EXPECT_FALSE(this->SetCookieWithDetails(
diff --git a/chromium/net/cookies/cookie_util_unittest.cc b/chromium/net/cookies/cookie_util_unittest.cc
index 8ca3acafe43..384527a0da5 100644
--- a/chromium/net/cookies/cookie_util_unittest.cc
+++ b/chromium/net/cookies/cookie_util_unittest.cc
@@ -158,7 +158,7 @@ TEST(CookieUtilTest, ParseCookieExpirationTimeBeyond2038) {
"2039 April 15 21:01:22", "2038 April 15 21:01:22",
};
- for (const auto& test : kTests) {
+ for (auto* test : kTests) {
base::Time parsed_time = cookie_util::ParseCookieExpirationTime(test);
EXPECT_FALSE(parsed_time.is_null());
@@ -183,7 +183,7 @@ TEST(CookieUtilTest, ParseCookieExpirationTimeBefore1970) {
"1969 March 3 21:01:22", "1600 April 15 21:01:22",
};
- for (const auto& test : kTests) {
+ for (auto* test : kTests) {
base::Time parsed_time = cookie_util::ParseCookieExpirationTime(test);
EXPECT_FALSE(parsed_time.is_null());