Rename CanonicalCookie::IsSecure to SecureAttribute
CanonicalCookie::IsSecure() is a simple getter that returns if a
cookie's "Secure" attribute was set or not.
I.e.: Set-Cookie: "foo=bar; Secure"
With the introduction of "source_scheme" a cookie could also be
considered secure if their setting scheme was secure. To try and help
reduce potential confusion this CL renames IsSecure() to
SecureAttribute() to hopefully indicate that this is a getter and not a
function which is trying to answer the question "was this cookie created
in a secure context?".
This CL is a simple renaming and does not change any logic.
Bug: 1170548
Change-Id: I01141da043604e793eed2277fe28b4bb8ff58bfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5245913
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Steven Bingler <bingler@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1255100}
diff --git a/chrome/browser/android/cookies/cookies_fetcher_util.cc b/chrome/browser/android/cookies/cookies_fetcher_util.cc
index ecbca57..1574021 100644
--- a/chrome/browser/android/cookies/cookies_fetcher_util.cc
+++ b/chrome/browser/android/cookies/cookies_fetcher_util.cc
@@ -54,7 +54,7 @@
i->ExpiryDate().ToDeltaSinceWindowsEpoch().InMicroseconds(),
i->LastAccessDate().ToDeltaSinceWindowsEpoch().InMicroseconds(),
i->LastUpdateDate().ToDeltaSinceWindowsEpoch().InMicroseconds(),
- i->IsSecure(), i->IsHttpOnly(), static_cast<int>(i->SameSite()),
+ i->SecureAttribute(), i->IsHttpOnly(), static_cast<int>(i->SameSite()),
i->Priority(), base::android::ConvertUTF8ToJavaString(env, pk),
static_cast<int>(i->SourceScheme()), i->SourcePort());
env->SetObjectArrayElement(joa.obj(), index++, java_cookie.obj());
diff --git a/chrome/browser/ash/login/profile_auth_data.cc b/chrome/browser/ash/login/profile_auth_data.cc
index ec53ad35..aec8b31 100644
--- a/chrome/browser/ash/login/profile_auth_data.cc
+++ b/chrome/browser/ash/login/profile_auth_data.cc
@@ -40,8 +40,8 @@
// is *google.<TLD> or *youtube.<TLD>, the cookie is considered to have been set
// by GAIA as well.
bool IsGAIACookie(const net::CanonicalCookie& cookie) {
- GURL cookie_url =
- net::cookie_util::CookieOriginToURL(cookie.Domain(), cookie.IsSecure());
+ GURL cookie_url = net::cookie_util::CookieOriginToURL(
+ cookie.Domain(), cookie.SecureAttribute());
return google_util::IsGoogleDomainUrl(
cookie_url, google_util::ALLOW_SUBDOMAIN,
diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc
index da3736a..fa126a6 100644
--- a/chrome/browser/browsing_data/cookies_tree_model.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model.cc
@@ -1223,7 +1223,7 @@
// static
int CookiesTreeModel::GetSendForMessageID(const net::CanonicalCookie& cookie) {
- if (cookie.IsSecure()) {
+ if (cookie.SecureAttribute()) {
if (!cookie.IsEffectivelySameSiteNone())
return IDS_COOKIES_COOKIE_SENDFOR_SECURE_SAME_SITE;
return IDS_COOKIES_COOKIE_SENDFOR_SECURE;
diff --git a/chrome/browser/browsing_data/counters/site_data_counting_helper.cc b/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
index 0cf4c18..eaf918b 100644
--- a/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
+++ b/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
@@ -144,7 +144,7 @@
for (const net::CanonicalCookie& cookie : cookies) {
if (cookie.CreationDate() >= begin_ && cookie.CreationDate() < end_) {
GURL url = net::cookie_util::CookieOriginToURL(cookie.Domain(),
- cookie.IsSecure());
+ cookie.SecureAttribute());
origins.push_back(url);
}
}
diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc
index f11a9783d..e6cfffe 100644
--- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc
@@ -106,7 +106,7 @@
cookie.path = base::IsStringUTF8(canonical_cookie.Path())
? canonical_cookie.Path()
: std::string();
- cookie.secure = canonical_cookie.IsSecure();
+ cookie.secure = canonical_cookie.SecureAttribute();
cookie.http_only = canonical_cookie.IsHttpOnly();
switch (canonical_cookie.SameSite()) {
@@ -183,7 +183,7 @@
DCHECK(!cookie.Domain().empty());
return net::cookie_util::CookieOriginToURL(cookie.Domain(),
- cookie.IsSecure());
+ cookie.SecureAttribute());
}
void AppendMatchingCookiesFromCookieListToVector(
@@ -312,8 +312,9 @@
if (details_->path && *details_->path != cookie.Path())
return false;
- if (details_->secure && *details_->secure != cookie.IsSecure())
+ if (details_->secure && *details_->secure != cookie.SecureAttribute()) {
return false;
+ }
if (details_->session && *details_->session != !cookie.IsPersistent())
return false;
diff --git a/components/browser_ui/site_settings/android/website_preference_bridge.cc b/components/browser_ui/site_settings/android/website_preference_bridge.cc
index e5ae290..c9d8d89b 100644
--- a/components/browser_ui/site_settings/android/website_preference_bridge.cc
+++ b/components/browser_ui/site_settings/android/website_preference_bridge.cc
@@ -560,9 +560,9 @@
Java_WebsitePreferenceBridge_createCookiesInfoMap(env);
for (const net::CanonicalCookie& cookie : entries) {
- std::string origin =
- net::cookie_util::CookieOriginToURL(cookie.Domain(), cookie.IsSecure())
- .spec();
+ std::string origin = net::cookie_util::CookieOriginToURL(
+ cookie.Domain(), cookie.SecureAttribute())
+ .spec();
ScopedJavaLocalRef<jstring> java_origin =
ConvertUTF8ToJavaString(env, origin);
Java_WebsitePreferenceBridge_insertCookieIntoMap(env, map, java_origin);
diff --git a/components/browsing_data/content/browsing_data_model.cc b/components/browsing_data/content/browsing_data_model.cc
index b48948e..daee233 100644
--- a/components/browsing_data/content/browsing_data_model.cc
+++ b/components/browsing_data/content/browsing_data_model.cc
@@ -347,9 +347,10 @@
void StorageRemoverHelper::Visitor::operator()<net::CanonicalCookie>(
const net::CanonicalCookie& cookie) {
if (types.Has(BrowsingDataModel::StorageType::kCookie)) {
- if (helper->delegate_ && helper->delegate_->IsCookieDeletionDisabled(
- net::cookie_util::CookieOriginToURL(
- cookie.Domain(), cookie.IsSecure()))) {
+ if (helper->delegate_ &&
+ helper->delegate_->IsCookieDeletionDisabled(
+ net::cookie_util::CookieOriginToURL(cookie.Domain(),
+ cookie.SecureAttribute()))) {
// TODO(crbug.com/1500256): Expand test coverage for this block.
return;
}
diff --git a/components/browsing_data/content/cookie_helper.cc b/components/browsing_data/content/cookie_helper.cc
index 7e19e250..bbab1fe1 100644
--- a/components/browsing_data/content/cookie_helper.cc
+++ b/components/browsing_data/content/cookie_helper.cc
@@ -44,7 +44,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (delete_disabled_callback_ &&
delete_disabled_callback_.Run(net::cookie_util::CookieOriginToURL(
- cookie.Domain(), cookie.IsSecure()))) {
+ cookie.Domain(), cookie.SecureAttribute()))) {
return;
}
storage_partition_->GetCookieManagerForBrowserProcess()
diff --git a/components/signin/core/browser/consistency_cookie_manager.cc b/components/signin/core/browser/consistency_cookie_manager.cc
index 429cd85..b58c55e 100644
--- a/components/signin/core/browser/consistency_cookie_manager.cc
+++ b/components/signin/core/browser/consistency_cookie_manager.cc
@@ -121,7 +121,7 @@
// static
bool ConsistencyCookieManager::IsConsistencyCookie(
const net::CanonicalCookie& cookie) {
- return cookie.IsSecure() && cookie.Path() == "/" &&
+ return cookie.SecureAttribute() && cookie.Path() == "/" &&
cookie.DomainWithoutDot() ==
GaiaUrls::GetInstance()->gaia_url().host() &&
cookie.Name() == kCookieName;
diff --git a/components/signin/core/browser/consistency_cookie_manager_unittest.cc b/components/signin/core/browser/consistency_cookie_manager_unittest.cc
index 463d719..c6ebb3f 100644
--- a/components/signin/core/browser/consistency_cookie_manager_unittest.cc
+++ b/components/signin/core/browser/consistency_cookie_manager_unittest.cc
@@ -93,7 +93,7 @@
testing::Property(&net::CanonicalCookie::Domain,
expected_domain),
testing::Property(&net::CanonicalCookie::Path, "/"),
- testing::Property(&net::CanonicalCookie::IsSecure, true),
+ testing::Property(&net::CanonicalCookie::SecureAttribute, true),
testing::Property(&net::CanonicalCookie::IsHttpOnly, false),
testing::Property(&net::CanonicalCookie::SameSite,
net::CookieSameSite::STRICT_MODE)),
diff --git a/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc b/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc
index 437eeaf1..0750622 100644
--- a/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc
+++ b/components/signin/internal/identity_manager/oauth_multilogin_helper_unittest.cc
@@ -131,7 +131,7 @@
// GMock matcher that checks that the cookie has the expected parameters.
MATCHER_P3(CookieMatcher, name, value, domain, "") {
return arg.Name() == name && arg.Value() == value && arg.Domain() == domain &&
- arg.Path() == "/" && arg.IsSecure() && !arg.IsHttpOnly();
+ arg.Path() == "/" && arg.SecureAttribute() && !arg.IsHttpOnly();
}
// Checks that the argument (a GURL) is secure and has the given hostname.
diff --git a/content/browser/attribution_reporting/attribution_cookie_checker_impl.cc b/content/browser/attribution_reporting/attribution_cookie_checker_impl.cc
index 212543f..bd444a5 100644
--- a/content/browser/attribution_reporting/attribution_cookie_checker_impl.cc
+++ b/content/browser/attribution_reporting/attribution_cookie_checker_impl.cc
@@ -30,7 +30,7 @@
base::ranges::any_of(cookies, [](const net::CookieWithAccessResult& c) {
// It is not possible to create a `SameSite: None` cookie insecurely, so
// we only DCHECK this for now.
- DCHECK(c.cookie.IsSecure());
+ DCHECK(c.cookie.SecureAttribute());
return c.cookie.IsHttpOnly() && !c.cookie.IsPartitioned() &&
c.cookie.Name() == "ar_debug";
});
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc
index 1d36a9c..9da3a1c 100644
--- a/content/browser/devtools/protocol/network_handler.cc
+++ b/content/browser/devtools/protocol/network_handler.cc
@@ -185,7 +185,7 @@
: cookie.ExpiryDate().InSecondsFSinceUnixEpoch())
.SetSize(cookie.Name().length() + cookie.Value().length())
.SetHttpOnly(cookie.IsHttpOnly())
- .SetSecure(cookie.IsSecure())
+ .SetSecure(cookie.SecureAttribute())
.SetSession(!cookie.IsPersistent())
.SetPriority(BuildCookiePriority(cookie.Priority()))
.SetSameParty(false)
@@ -257,7 +257,7 @@
}
std::string key = base::StringPrintf(
"%s::%s::%s::%d::%s", cookie.Name().c_str(), cookie.Domain().c_str(),
- cookie.Path().c_str(), cookie.IsSecure(),
+ cookie.Path().c_str(), cookie.SecureAttribute(),
serialized_partition_key.c_str());
all_cookies_.emplace(std::move(key), cookie);
}
@@ -450,7 +450,7 @@
}
net::CookieSourceScheme cookie_source_scheme =
absl::get<net::CookieSourceScheme>(cookie_source_scheme_or_error);
- if (cookie->IsSecure() &&
+ if (cookie->SecureAttribute() &&
cookie_source_scheme == net::CookieSourceScheme::kNonSecure) {
return Response::InvalidParams(
"Secure attribute cannot be set for a cookie with an insecure source "
diff --git a/google_apis/gaia/oauth_multilogin_result_unittest.cc b/google_apis/gaia/oauth_multilogin_result_unittest.cc
index 669a134..c5bd89dc 100644
--- a/google_apis/gaia/oauth_multilogin_result_unittest.cc
+++ b/google_apis/gaia/oauth_multilogin_result_unittest.cc
@@ -139,11 +139,12 @@
Property(&CanonicalCookie::IsHttpOnly, Eq(true)),
Property(&CanonicalCookie::IsHttpOnly, Eq(true)),
Property(&CanonicalCookie::IsHttpOnly, Eq(true))));
- EXPECT_THAT(result.cookies(),
- ElementsAre(Property(&CanonicalCookie::IsSecure, Eq(true)),
- Property(&CanonicalCookie::IsSecure, Eq(false)),
- Property(&CanonicalCookie::IsSecure, Eq(true)),
- Property(&CanonicalCookie::IsSecure, Eq(true))));
+ EXPECT_THAT(
+ result.cookies(),
+ ElementsAre(Property(&CanonicalCookie::SecureAttribute, Eq(true)),
+ Property(&CanonicalCookie::SecureAttribute, Eq(false)),
+ Property(&CanonicalCookie::SecureAttribute, Eq(true)),
+ Property(&CanonicalCookie::SecureAttribute, Eq(true))));
EXPECT_THAT(result.cookies(),
ElementsAre(Property(&CanonicalCookie::SameSite,
Eq(net::CookieSameSite::UNSPECIFIED)),
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
index 1c16a0a..d49450a 100644
--- a/ios/net/cookies/cookie_store_ios.mm
+++ b/ios/net/cookies/cookie_store_ios.mm
@@ -243,7 +243,7 @@
access_result = *cookie_access_result;
}
- if (cookie->IsSecure() &&
+ if (cookie->SecureAttribute() &&
access_scheme == CookieAccessScheme::kNonCryptographic) {
if (!callback.is_null()) {
access_result.status.AddExclusionReason(
diff --git a/ios/net/cookies/system_cookie_util.mm b/ios/net/cookies/system_cookie_util.mm
index a6b3029..d39bc98 100644
--- a/ios/net/cookies/system_cookie_util.mm
+++ b/ios/net/cookies/system_cookie_util.mm
@@ -107,8 +107,9 @@
properties[NSHTTPCookieSameSitePolicy] = same_site;
}
- if (cookie.IsSecure())
+ if (cookie.SecureAttribute()) {
[properties setObject:@"Y" forKey:NSHTTPCookieSecure];
+ }
if (cookie.IsHttpOnly())
[properties setObject:@YES forKey:kNSHTTPCookieHttpOnly];
NSHTTPCookie* system_cookie = [NSHTTPCookie cookieWithProperties:properties];
diff --git a/ios/net/cookies/system_cookie_util_unittest.mm b/ios/net/cookies/system_cookie_util_unittest.mm
index f3f5360..30a64ae 100644
--- a/ios/net/cookies/system_cookie_util_unittest.mm
+++ b/ios/net/cookies/system_cookie_util_unittest.mm
@@ -103,7 +103,7 @@
// Allow 1 second difference as iOS rounds expiry time to the nearest second.
EXPECT_LE(expire_date - base::Seconds(1), chrome_cookie->ExpiryDate());
EXPECT_GE(expire_date + base::Seconds(1), chrome_cookie->ExpiryDate());
- EXPECT_FALSE(chrome_cookie->IsSecure());
+ EXPECT_FALSE(chrome_cookie->SecureAttribute());
EXPECT_TRUE(chrome_cookie->IsHttpOnly());
EXPECT_EQ(net::COOKIE_PRIORITY_DEFAULT, chrome_cookie->Priority());
if (@available(iOS 13, *)) {
@@ -121,7 +121,7 @@
ASSERT_TRUE(system_cookie);
chrome_cookie = CanonicalCookieFromSystemCookie(system_cookie, creation_time);
EXPECT_FALSE(chrome_cookie->IsPersistent());
- EXPECT_TRUE(chrome_cookie->IsSecure());
+ EXPECT_TRUE(chrome_cookie->SecureAttribute());
// Test a non-Canonical cookie does not cause a crash.
system_cookie = [[NSHTTPCookie alloc] initWithProperties:@{
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
index 0263610..ec55013 100644
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
@@ -1103,13 +1103,15 @@
}
switch (cookie_access_scheme) {
case CookieAccessScheme::kNonCryptographic:
- if (IsSecure())
+ if (SecureAttribute()) {
status.AddExclusionReason(CookieInclusionStatus::EXCLUDE_SECURE_ONLY);
+ }
break;
case CookieAccessScheme::kTrustworthy:
is_allowed_to_access_secure_cookies = true;
- if (IsSecure() || (cookie_util::IsSchemeBoundCookiesEnabled() &&
- source_scheme_ == CookieSourceScheme::kSecure)) {
+ if (SecureAttribute() ||
+ (cookie_util::IsSchemeBoundCookiesEnabled() &&
+ source_scheme_ == CookieSourceScheme::kSecure)) {
status.AddWarningReason(
CookieInclusionStatus::
WARN_SECURE_ACCESS_GRANTED_NON_CRYPTOGRAPHIC);
@@ -1247,13 +1249,13 @@
// were created before "SameSite=None requires Secure" was enabled (as
// SameSite=None insecure cookies cannot be set while the options are on).
if (params.access_semantics != CookieAccessSemantics::LEGACY &&
- SameSite() == CookieSameSite::NO_RESTRICTION && !IsSecure()) {
+ SameSite() == CookieSameSite::NO_RESTRICTION && !SecureAttribute()) {
status.AddExclusionReason(
CookieInclusionStatus::EXCLUDE_SAMESITE_NONE_INSECURE);
}
ApplySameSiteCookieWarningToStatus(SameSite(), effective_same_site,
- IsSecure(),
+ SecureAttribute(),
options.same_site_cookie_context(),
&status, false /* is_cookie_being_set */);
@@ -1332,7 +1334,7 @@
switch (access_scheme) {
case CookieAccessScheme::kNonCryptographic:
access_result.is_allowed_to_access_secure_cookies = false;
- if (IsSecure()) {
+ if (SecureAttribute()) {
access_result.status.AddExclusionReason(
CookieInclusionStatus::EXCLUDE_SECURE_ONLY);
}
@@ -1345,7 +1347,7 @@
case CookieAccessScheme::kTrustworthy:
access_result.is_allowed_to_access_secure_cookies = true;
- if (IsSecure()) {
+ if (SecureAttribute()) {
// OK, but want people aware of this.
// Note, we also want to apply this warning to cookies whose source
// scheme is kSecure but are set by non-cryptographic (but trustworthy)
@@ -1370,7 +1372,7 @@
// Unless legacy access semantics are in effect, SameSite=None cookies without
// the Secure attribute will be rejected.
if (params.access_semantics != CookieAccessSemantics::LEGACY &&
- SameSite() == CookieSameSite::NO_RESTRICTION && !IsSecure()) {
+ SameSite() == CookieSameSite::NO_RESTRICTION && !SecureAttribute()) {
DVLOG(net::cookie_util::kVlogSetCookies)
<< "SetCookie() rejecting insecure cookie with SameSite=None.";
access_result.status.AddExclusionReason(
@@ -1426,7 +1428,7 @@
}
ApplySameSiteCookieWarningToStatus(
- SameSite(), access_result.effective_same_site, IsSecure(),
+ SameSite(), access_result.effective_same_site, SecureAttribute(),
options.same_site_cookie_context(), &access_result.status,
true /* is_cookie_being_set */);
@@ -1594,8 +1596,9 @@
cookie_line += "; path=" + cookie.Path();
if (cookie.ExpiryDate() != base::Time())
cookie_line += "; expires=" + HttpUtil::TimeFormatHTTP(cookie.ExpiryDate());
- if (cookie.IsSecure())
+ if (cookie.SecureAttribute()) {
cookie_line += "; secure";
+ }
if (cookie.IsHttpOnly())
cookie_line += "; httponly";
if (cookie.IsPartitioned() &&
diff --git a/net/cookies/canonical_cookie.h b/net/cookies/canonical_cookie.h
index bb7b74b..9524266 100644
--- a/net/cookies/canonical_cookie.h
+++ b/net/cookies/canonical_cookie.h
@@ -236,7 +236,7 @@
const base::Time& LastAccessDate() const { return last_access_date_; }
const base::Time& LastUpdateDate() const { return last_update_date_; }
bool IsPersistent() const { return !expiry_date_.is_null(); }
- bool IsSecure() const { return secure_; }
+ bool SecureAttribute() const { return secure_; }
bool IsHttpOnly() const { return httponly_; }
CookieSameSite SameSite() const { return same_site_; }
CookiePriority Priority() const { return priority_; }
diff --git a/net/cookies/canonical_cookie_unittest.cc b/net/cookies/canonical_cookie_unittest.cc
index 943c14fa..6ba2b65 100644
--- a/net/cookies/canonical_cookie_unittest.cc
+++ b/net/cookies/canonical_cookie_unittest.cc
@@ -63,7 +63,7 @@
EXPECT_EQ("2", cookie1->Value());
EXPECT_EQ("www.example.com", cookie1->Domain());
EXPECT_EQ("/test", cookie1->Path());
- EXPECT_FALSE(cookie1->IsSecure());
+ EXPECT_FALSE(cookie1->SecureAttribute());
EXPECT_FALSE(cookie1->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie1->SameSite());
EXPECT_EQ(CookiePriority::COOKIE_PRIORITY_DEFAULT, cookie1->Priority());
@@ -81,7 +81,7 @@
EXPECT_EQ("2", cookie2->Value());
EXPECT_EQ(".www.example.com", cookie2->Domain());
EXPECT_EQ("/", cookie2->Path());
- EXPECT_FALSE(cookie2->IsSecure());
+ EXPECT_FALSE(cookie2->SecureAttribute());
EXPECT_FALSE(cookie2->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie2->SameSite());
EXPECT_EQ(CookiePriority::COOKIE_PRIORITY_DEFAULT, cookie2->Priority());
@@ -97,7 +97,7 @@
"A", "2", ".www.example.com", "/", current_time, base::Time(),
base::Time(), base::Time(), true /* secure */, false,
CookieSameSite::NO_RESTRICTION, COOKIE_PRIORITY_DEFAULT);
- EXPECT_TRUE(cookie3->IsSecure());
+ EXPECT_TRUE(cookie3->SecureAttribute());
EXPECT_EQ(cookie3->SourceScheme(), CookieSourceScheme::kUnset);
EXPECT_EQ(cookie3->SourcePort(), url::PORT_UNSPECIFIED);
@@ -109,7 +109,7 @@
EXPECT_EQ("2", cookie4->Value());
EXPECT_EQ(".www.example.com", cookie4->Domain());
EXPECT_EQ("/test", cookie4->Path());
- EXPECT_FALSE(cookie4->IsSecure());
+ EXPECT_FALSE(cookie4->SecureAttribute());
EXPECT_FALSE(cookie4->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie4->SameSite());
EXPECT_FALSE(cookie4->IsPartitioned());
@@ -200,7 +200,7 @@
EXPECT_EQ("2", cookie->Value());
EXPECT_EQ("www.example.com", cookie->Domain());
EXPECT_EQ("/test", cookie->Path());
- EXPECT_FALSE(cookie->IsSecure());
+ EXPECT_FALSE(cookie->SecureAttribute());
EXPECT_EQ(cookie->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cookie->SourcePort(), 80);
@@ -211,7 +211,7 @@
EXPECT_EQ("1", cookie->Value());
EXPECT_EQ("www.foo.com", cookie->Domain());
EXPECT_EQ("/", cookie->Path());
- EXPECT_FALSE(cookie->IsSecure());
+ EXPECT_FALSE(cookie->SecureAttribute());
EXPECT_EQ(cookie->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cookie->SourcePort(), 80);
@@ -220,23 +220,23 @@
cookie =
CanonicalCookie::Create(url, "A=2; Secure", creation_time, server_time,
absl::nullopt /* cookie_partition_key */);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
cookie = CanonicalCookie::Create(https_url, "A=2; Secure", creation_time,
server_time,
absl::nullopt /* cookie_partition_key */);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
GURL url3("https://www.foo.com");
cookie =
CanonicalCookie::Create(url3, "A=2; Secure", creation_time, server_time,
absl::nullopt /* cookie_partition_key */);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
EXPECT_EQ(cookie->SourceScheme(), CookieSourceScheme::kSecure);
cookie = CanonicalCookie::Create(url3, "A=2", creation_time, server_time,
absl::nullopt /* cookie_partition_key */);
- EXPECT_FALSE(cookie->IsSecure());
+ EXPECT_FALSE(cookie->SecureAttribute());
EXPECT_EQ(cookie->SourceScheme(), CookieSourceScheme::kSecure);
// Test creating cookie from localhost URL.
@@ -662,7 +662,7 @@
server_time, partition_key, /*block_truncated=*/true, &status);
ASSERT_TRUE(cookie.get());
EXPECT_TRUE(status.IsInclude());
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
EXPECT_TRUE(cookie->IsPartitioned());
EXPECT_EQ(partition_key, cookie->PartitionKey());
EXPECT_EQ(CookieSameSite::UNSPECIFIED, cookie->SameSite());
@@ -757,7 +757,7 @@
partition_key, /*block_truncated=*/true, &status);
ASSERT_TRUE(cookie.get());
EXPECT_TRUE(status.IsInclude());
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
EXPECT_TRUE(cookie->IsPartitioned());
EXPECT_EQ(partition_key, cookie->PartitionKey());
EXPECT_EQ(CookieSameSite::UNSPECIFIED, cookie->SameSite());
@@ -1686,7 +1686,7 @@
cookie = CanonicalCookie::Create(secure_url, "A=2; Secure", creation_time,
server_time,
absl::nullopt /* cookie_partition_key */);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
EXPECT_TRUE(
cookie
->IncludeForRequestURL(
@@ -1709,7 +1709,7 @@
CanonicalCookie::Create(url, "A=2; Secure", creation_time, server_time,
absl::nullopt /* cookie_partition_key */);
ASSERT_TRUE(cookie);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
CookieAccessResult result = cookie->IncludeForRequestURL(
url, options,
CookieAccessParams{net::CookieAccessSemantics::UNKNOWN,
@@ -1724,7 +1724,7 @@
server_time,
absl::nullopt /* cookie_partition_key */);
ASSERT_TRUE(cookie);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
result = cookie->IncludeForRequestURL(
localhost_url, options,
CookieAccessParams{net::CookieAccessSemantics::UNKNOWN,
@@ -1738,7 +1738,7 @@
server_time,
absl::nullopt /* cookie_partition_key */);
ASSERT_TRUE(cookie);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
result = cookie->IncludeForRequestURL(
secure_url, options,
CookieAccessParams{net::CookieAccessSemantics::UNKNOWN,
@@ -2230,7 +2230,7 @@
url, "A=2; SameSite=None", creation_time, server_time,
absl::nullopt /* cookie_partition_key */);
ASSERT_TRUE(cookie.get());
- EXPECT_FALSE(cookie->IsSecure());
+ EXPECT_FALSE(cookie->SecureAttribute());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie->SameSite());
EXPECT_EQ(CookieEffectiveSameSite::NO_RESTRICTION,
cookie->GetEffectiveSameSiteForTesting());
@@ -3811,7 +3811,7 @@
EXPECT_EQ(base::Time(), cc->CreationDate());
EXPECT_EQ(base::Time(), cc->LastAccessDate());
EXPECT_EQ(base::Time(), cc->ExpiryDate());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_FALSE(cc->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cc->SameSite());
EXPECT_EQ(COOKIE_PRIORITY_MEDIUM, cc->Priority());
@@ -3856,7 +3856,7 @@
false /*httponly*/, CookieSameSite::NO_RESTRICTION,
COOKIE_PRIORITY_DEFAULT, absl::nullopt /*partition_key*/, &status);
EXPECT_TRUE(cc);
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_TRUE(status.IsInclude());
// Httponly
@@ -4643,7 +4643,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4654,7 +4654,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4666,7 +4666,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cc->SourcePort(), 80);
@@ -4680,7 +4680,7 @@
EXPECT_TRUE(status.IsInclude());
EXPECT_TRUE(status.HasExactlyWarningReasonsForTesting(
{CookieInclusionStatus::WARN_TENTATIVELY_ALLOWING_SECURE_SOURCE_SCHEME}));
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4692,7 +4692,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cc->SourcePort(), 123);
@@ -4706,7 +4706,7 @@
EXPECT_TRUE(status.IsInclude());
EXPECT_TRUE(status.HasExactlyWarningReasonsForTesting(
{CookieInclusionStatus::WARN_TENTATIVELY_ALLOWING_SECURE_SOURCE_SCHEME}));
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 123);
}
@@ -4731,7 +4731,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4744,7 +4744,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4758,7 +4758,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cc->SourcePort(), 80);
@@ -4774,7 +4774,7 @@
EXPECT_TRUE(status.IsInclude());
EXPECT_TRUE(status.HasExactlyWarningReasonsForTesting(
{CookieInclusionStatus::WARN_TENTATIVELY_ALLOWING_SECURE_SOURCE_SCHEME}));
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 443);
@@ -4788,7 +4788,7 @@
EXPECT_TRUE(cc);
EXPECT_TRUE(status.IsInclude());
EXPECT_FALSE(status.ShouldWarn());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kNonSecure);
EXPECT_EQ(cc->SourcePort(), 123);
@@ -4804,7 +4804,7 @@
EXPECT_TRUE(status.IsInclude());
EXPECT_TRUE(status.HasExactlyWarningReasonsForTesting(
{CookieInclusionStatus::WARN_TENTATIVELY_ALLOWING_SECURE_SOURCE_SCHEME}));
- EXPECT_TRUE(cc->IsSecure());
+ EXPECT_TRUE(cc->SecureAttribute());
EXPECT_EQ(cc->SourceScheme(), CookieSourceScheme::kSecure);
EXPECT_EQ(cc->SourcePort(), 123);
}
@@ -4828,7 +4828,7 @@
EXPECT_EQ(one_hour_ago, cc->LastAccessDate());
EXPECT_EQ(one_hour_from_now, cc->ExpiryDate());
EXPECT_EQ(one_hour_ago, cc->LastUpdateDate());
- EXPECT_FALSE(cc->IsSecure());
+ EXPECT_FALSE(cc->SecureAttribute());
EXPECT_FALSE(cc->IsHttpOnly());
EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cc->SameSite());
EXPECT_EQ(COOKIE_PRIORITY_MEDIUM, cc->Priority());
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 5fd7f5e..7d271d7 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -247,10 +247,11 @@
CookieMonster::CookieItVector* non_secure_cookie_its) {
DCHECK(secure_cookie_its && non_secure_cookie_its);
for (const auto& curit : cookie_its) {
- if (curit->second->IsSecure())
+ if (curit->second->SecureAttribute()) {
secure_cookie_its->push_back(curit);
- else
+ } else {
non_secure_cookie_its->push_back(curit);
+ }
}
}
@@ -314,7 +315,7 @@
bool protect_secure_cookies,
const CanonicalCookie* cookie) {
if (cookie->Priority() == current_priority_level && protect_secure_cookies)
- return !cookie->IsSecure();
+ return !cookie->SecureAttribute();
return cookie->Priority() == current_priority_level;
}
@@ -326,8 +327,9 @@
size_t cookies_count = 0U;
for (const auto& cookie : *cookies) {
if (cookie->second->Priority() == priority) {
- if (!protect_secure_cookies || cookie->second->IsSecure())
+ if (!protect_secure_cookies || cookie->second->SecureAttribute()) {
cookies_count++;
+ }
}
}
return cookies_count;
@@ -343,7 +345,7 @@
int expiration_duration_minutes =
(cookie.ExpiryDate() - creation_time).InMinutes();
- if (cookie.IsSecure()) {
+ if (cookie.SecureAttribute()) {
UMA_HISTOGRAM_CUSTOM_COUNTS("Cookie.ExpirationDurationMinutesSecure",
expiration_duration_minutes, 1,
kMinutesInTenYears, 50);
@@ -1419,7 +1421,8 @@
// equivalence is slightly more inclusive than the usual IsEquivalent() one.
//
// See: https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone
- if (cur_existing_cookie->IsSecure() && !allowed_to_set_secure_cookie &&
+ if (cur_existing_cookie->SecureAttribute() &&
+ !allowed_to_set_secure_cookie &&
cookie_being_set.IsEquivalentForSecureCookieMatching(
*cur_existing_cookie)) {
// Hold onto this for additional Netlogging later if we end up preserving
@@ -1551,7 +1554,7 @@
? 1 << COOKIE_TYPE_SAME_SITE
: 0;
type_sample |= cc->IsHttpOnly() ? 1 << COOKIE_TYPE_HTTPONLY : 0;
- type_sample |= cc->IsSecure() ? 1 << COOKIE_TYPE_SECURE : 0;
+ type_sample |= cc->SecureAttribute() ? 1 << COOKIE_TYPE_SECURE : 0;
UMA_HISTOGRAM_EXACT_LINEAR("Cookie.Type", type_sample,
(1 << COOKIE_TYPE_LAST_ENTRY));
}
@@ -1710,10 +1713,10 @@
// it was added to evaluate has been implemented and standardized.
CookieSource cookie_source_sample =
(source_url.SchemeIsCryptographic()
- ? (cc->IsSecure()
+ ? (cc->SecureAttribute()
? CookieSource::kSecureCookieCryptographicScheme
: CookieSource::kNonsecureCookieCryptographicScheme)
- : (cc->IsSecure()
+ : (cc->SecureAttribute()
? CookieSource::kSecureCookieNoncryptographicScheme
: CookieSource::kNonsecureCookieNoncryptographicScheme));
UMA_HISTOGRAM_ENUMERATION("Cookie.CookieSourceScheme",
diff --git a/net/cookies/cookie_monster_netlog_params.cc b/net/cookies/cookie_monster_netlog_params.cc
index 6679203..ec330bc 100644
--- a/net/cookies/cookie_monster_netlog_params.cc
+++ b/net/cookies/cookie_monster_netlog_params.cc
@@ -28,7 +28,7 @@
dict.Set("domain", cookie->Domain());
dict.Set("path", cookie->Path());
dict.Set("httponly", cookie->IsHttpOnly());
- dict.Set("secure", cookie->IsSecure());
+ dict.Set("secure", cookie->SecureAttribute());
dict.Set("priority", CookiePriorityToString(cookie->Priority()));
dict.Set("same_site", CookieSameSiteToString(cookie->SameSite()));
dict.Set("is_persistent", cookie->IsPersistent());
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index bc46935..89a941c 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -360,7 +360,7 @@
for (auto& cookie : cookies) {
GURL source_url = cookie_util::SimulatedCookieSource(
- *cookie, cookie->IsSecure() ? "https" : "http");
+ *cookie, cookie->SecureAttribute() ? "https" : "http");
EXPECT_TRUE(this->SetCanonicalCookie(cm, std::move(cookie), source_url,
true /* modify_httponly */));
}
@@ -645,10 +645,11 @@
size_t total_secure_cookies = 0;
size_t total_non_secure_cookies = 0;
for (const auto& cookie : cookies) {
- if (cookie.IsSecure())
+ if (cookie.SecureAttribute()) {
++total_secure_cookies;
- else
+ } else {
++total_non_secure_cookies;
+ }
}
EXPECT_EQ(expected_secure_cookies, total_secure_cookies);
@@ -934,7 +935,7 @@
c.ExpiryDate() == cookie.ExpiryDate() &&
c.LastAccessDate() == cookie.LastAccessDate() &&
c.LastUpdateDate() == cookie.LastUpdateDate() &&
- c.IsSecure() == cookie.IsSecure() &&
+ c.SecureAttribute() == cookie.SecureAttribute() &&
c.IsHttpOnly() == cookie.IsHttpOnly() &&
c.Priority() == cookie.Priority()) {
return true;
@@ -1641,7 +1642,7 @@
EXPECT_EQ(2u, DeleteMatchingCookies(
cm.get(),
base::BindRepeating([](const net::CanonicalCookie& cookie) {
- return !cookie.IsSecure();
+ return !cookie.SecureAttribute();
})));
EXPECT_THAT(GetAllCookies(cm.get()),
ElementsAre(MatchesCookieNameDomain("a1", "a.com"),
@@ -2742,7 +2743,7 @@
EXPECT_EQ(input->path, output->Path());
EXPECT_LE(current.ToInternalValue(),
output->CreationDate().ToInternalValue());
- EXPECT_EQ(input->secure, output->IsSecure());
+ EXPECT_EQ(input->secure, output->SecureAttribute());
EXPECT_EQ(input->http_only, output->IsHttpOnly());
EXPECT_EQ(input->same_site, output->SameSite());
EXPECT_TRUE(output->IsPersistent());
@@ -4003,7 +4004,7 @@
callback.WaitUntilDone();
EXPECT_EQ(2u, callback.cookies_with_access_results().size());
for (const auto& cookie_item : callback.cookies_with_access_results()) {
- EXPECT_TRUE(cookie_item.cookie.IsSecure());
+ EXPECT_TRUE(cookie_item.cookie.SecureAttribute());
EXPECT_TRUE(cookie_item.access_result.status.IsInclude());
EXPECT_TRUE(
cookie_item.access_result.status.HasExactlyWarningReasonsForTesting(
@@ -4021,7 +4022,7 @@
callback.WaitUntilDone();
EXPECT_EQ(2u, callback.cookies_with_access_results().size());
for (const auto& cookie_item : callback.cookies_with_access_results()) {
- EXPECT_TRUE(cookie_item.cookie.IsSecure());
+ EXPECT_TRUE(cookie_item.cookie.SecureAttribute());
EXPECT_EQ(CookieInclusionStatus(), cookie_item.access_result.status);
}
}
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h
index 2354234..2e98201 100644
--- a/net/cookies/cookie_store_unittest.h
+++ b/net/cookies/cookie_store_unittest.h
@@ -528,7 +528,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(one_hour_ago, it->LastAccessDate());
- EXPECT_FALSE(it->IsSecure());
+ EXPECT_FALSE(it->SecureAttribute());
EXPECT_FALSE(it->IsHttpOnly());
ASSERT_TRUE(++it == cookies.end());
@@ -559,7 +559,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(one_hour_ago, it->LastAccessDate());
- EXPECT_FALSE(it->IsSecure());
+ EXPECT_FALSE(it->SecureAttribute());
EXPECT_TRUE(it->IsHttpOnly());
EXPECT_TRUE(++it == cookies.end());
@@ -579,7 +579,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(it->CreationDate(), it->LastAccessDate());
- EXPECT_TRUE(it->IsSecure());
+ EXPECT_TRUE(it->SecureAttribute());
EXPECT_FALSE(it->IsHttpOnly());
EXPECT_TRUE(++it == cookies.end());
@@ -631,7 +631,7 @@
this->http_www_foo_.url(), "foo=1; Secure", base::Time::Now(),
/*server_time=*/absl::nullopt, /*cookie_partition_key=*/absl::nullopt,
/*block_truncated=*/true, &status);
- EXPECT_TRUE(cookie->IsSecure());
+ EXPECT_TRUE(cookie->SecureAttribute());
EXPECT_TRUE(status.IsInclude());
EXPECT_TRUE(this->SetCanonicalCookieReturnAccessResult(
cs, std::move(cookie), this->http_www_foo_.url(), true)
@@ -741,7 +741,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(one_hour_ago, it->LastAccessDate());
- EXPECT_FALSE(it->IsSecure());
+ EXPECT_FALSE(it->SecureAttribute());
EXPECT_FALSE(it->IsHttpOnly());
// Get the cookie using the wide open |options|:
@@ -758,7 +758,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(one_hour_ago, it->LastAccessDate());
- EXPECT_FALSE(it->IsSecure());
+ EXPECT_FALSE(it->SecureAttribute());
EXPECT_TRUE(it->IsHttpOnly());
cookies = this->GetAllCookiesForURL(cs, this->https_www_foo_.url());
@@ -776,7 +776,7 @@
// Some CookieStores don't store last access date.
if (!it->LastAccessDate().is_null())
EXPECT_EQ(it->CreationDate(), it->LastAccessDate());
- EXPECT_TRUE(it->IsSecure());
+ EXPECT_TRUE(it->SecureAttribute());
EXPECT_FALSE(it->IsHttpOnly());
}
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
index 07f409e..90c1b40 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
@@ -1280,7 +1280,7 @@
}
add_statement.BindString(6, po->cc().Path());
add_statement.BindTime(7, po->cc().ExpiryDate());
- add_statement.BindBool(8, po->cc().IsSecure());
+ add_statement.BindBool(8, po->cc().SecureAttribute());
add_statement.BindBool(9, po->cc().IsHttpOnly());
add_statement.BindTime(10, po->cc().LastAccessDate());
add_statement.BindBool(11, po->cc().IsPersistent());
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
index 3261226..a5d818e 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
@@ -1711,7 +1711,7 @@
statement.BindBlob(5, base::span<uint8_t>()); // encrypted_value
statement.BindString(6, cookie.Path());
statement.BindTime(7, cookie.ExpiryDate());
- statement.BindInt(8, cookie.IsSecure());
+ statement.BindInt(8, cookie.SecureAttribute());
statement.BindInt(9, cookie.IsHttpOnly());
// Note that this, Priority(), and SourceScheme() below nominally rely on
// the enums in sqlite_persistent_cookie_store.cc having the same values as
@@ -1770,7 +1770,7 @@
statement.BindBlob(5, base::span<uint8_t>()); // encrypted_value
statement.BindString(6, cookie.Path());
statement.BindTime(7, std::min(cookie.ExpiryDate(), max_expiration));
- statement.BindInt(8, cookie.IsSecure());
+ statement.BindInt(8, cookie.SecureAttribute());
statement.BindInt(9, cookie.IsHttpOnly());
// Note that this, Priority(), and SourceScheme() below nominally rely on
// the enums in sqlite_persistent_cookie_store.cc having the same values as
@@ -1813,7 +1813,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/", read_in_cookies[i]->Path());
- EXPECT_TRUE(read_in_cookies[i]->IsSecure());
+ EXPECT_TRUE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
@@ -1826,7 +1826,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/path", read_in_cookies[i]->Path());
- EXPECT_FALSE(read_in_cookies[i]->IsSecure());
+ EXPECT_FALSE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
@@ -1839,7 +1839,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example2.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/", read_in_cookies[i]->Path());
- EXPECT_TRUE(read_in_cookies[i]->IsSecure());
+ EXPECT_TRUE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
@@ -1852,7 +1852,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/", read_in_cookies[i]->Path());
- EXPECT_TRUE(read_in_cookies[i]->IsSecure());
+ EXPECT_TRUE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
@@ -1865,7 +1865,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/path", read_in_cookies[i]->Path());
- EXPECT_FALSE(read_in_cookies[i]->IsSecure());
+ EXPECT_FALSE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
@@ -1881,7 +1881,7 @@
EXPECT_EQ("B", read_in_cookies[i]->Value());
EXPECT_EQ("example2.com", read_in_cookies[i]->Domain());
EXPECT_EQ("/", read_in_cookies[i]->Path());
- EXPECT_FALSE(read_in_cookies[i]->IsSecure());
+ EXPECT_FALSE(read_in_cookies[i]->SecureAttribute());
EXPECT_EQ(CookieSourceScheme::kUnset, read_in_cookies[i]->SourceScheme());
EXPECT_EQ(read_in_cookies[i]->LastUpdateDate(),
expect_last_update_date ? read_in_cookies[i]->CreationDate()
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 3afc5526..f4002a8 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -831,7 +831,7 @@
if (may_set_sec_cookie_deprecation_header &&
c.cookie.Name() == "receive-cookie-deprecation" &&
- c.cookie.IsHttpOnly() && c.cookie.IsSecure()) {
+ c.cookie.IsHttpOnly() && c.cookie.SecureAttribute()) {
request_info_.extra_headers.SetHeader(
"Sec-Cookie-Deprecation",
*request_->context()->cookie_deprecation_label());
diff --git a/services/network/cookie_manager.cc b/services/network/cookie_manager.cc
index 3597198..d0f230b5 100644
--- a/services/network/cookie_manager.cc
+++ b/services/network/cookie_manager.cc
@@ -140,7 +140,7 @@
cookie_ptr = net::CanonicalCookie::FromStorage(
cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(),
cookie.CreationDate(), adjusted_expiry_date, cookie.LastAccessDate(),
- cookie.LastUpdateDate(), cookie.IsSecure(), cookie.IsHttpOnly(),
+ cookie.LastUpdateDate(), cookie.SecureAttribute(), cookie.IsHttpOnly(),
cookie.SameSite(), cookie.Priority(), cookie_partition_key,
cookie.SourceScheme(), cookie.SourcePort());
if (!cookie_ptr) {
diff --git a/services/network/cookie_manager_unittest.cc b/services/network/cookie_manager_unittest.cc
index d62ab40..6b85e07 100644
--- a/services/network/cookie_manager_unittest.cc
+++ b/services/network/cookie_manager_unittest.cc
@@ -441,7 +441,7 @@
EXPECT_EQ(cookies[0].LastAccessDate(), base::Time());
EXPECT_EQ(cookies[0].ExpiryDate(), base::Time());
EXPECT_FALSE(cookies[0].IsPersistent());
- EXPECT_FALSE(cookies[0].IsSecure());
+ EXPECT_FALSE(cookies[0].SecureAttribute());
EXPECT_FALSE(cookies[0].IsHttpOnly());
EXPECT_EQ(net::CookieSameSite::LAX_MODE, cookies[0].SameSite());
EXPECT_EQ(net::COOKIE_PRIORITY_MEDIUM, cookies[0].Priority());
@@ -455,7 +455,7 @@
EXPECT_EQ(cookies[1].LastAccessDate(), base::Time());
EXPECT_EQ(cookies[1].ExpiryDate(), base::Time());
EXPECT_FALSE(cookies[1].IsPersistent());
- EXPECT_FALSE(cookies[1].IsSecure());
+ EXPECT_FALSE(cookies[1].SecureAttribute());
EXPECT_FALSE(cookies[1].IsHttpOnly());
EXPECT_EQ(net::CookieSameSite::LAX_MODE, cookies[1].SameSite());
EXPECT_EQ(net::COOKIE_PRIORITY_MEDIUM, cookies[1].Priority());
@@ -469,7 +469,7 @@
EXPECT_EQ(cookies[2].LastAccessDate(), base::Time());
EXPECT_EQ(cookies[2].ExpiryDate(), base::Time());
EXPECT_FALSE(cookies[2].IsPersistent());
- EXPECT_FALSE(cookies[2].IsSecure());
+ EXPECT_FALSE(cookies[2].SecureAttribute());
EXPECT_TRUE(cookies[2].IsHttpOnly());
EXPECT_EQ(net::CookieSameSite::LAX_MODE, cookies[2].SameSite());
EXPECT_EQ(net::COOKIE_PRIORITY_MEDIUM, cookies[2].Priority());
@@ -483,7 +483,7 @@
EXPECT_EQ(cookies[3].LastAccessDate(), base::Time());
EXPECT_EQ(cookies[3].ExpiryDate(), base::Time());
EXPECT_FALSE(cookies[3].IsPersistent());
- EXPECT_TRUE(cookies[3].IsSecure());
+ EXPECT_TRUE(cookies[3].SecureAttribute());
EXPECT_FALSE(cookies[3].IsHttpOnly());
EXPECT_EQ(net::CookieSameSite::NO_RESTRICTION, cookies[3].SameSite());
EXPECT_EQ(net::COOKIE_PRIORITY_MEDIUM, cookies[3].Priority());
@@ -1022,7 +1022,7 @@
EXPECT_EQ("http_localhost", http_localhost_cookies[0].Name());
EXPECT_EQ(net::CookieSourceScheme::kSecure,
http_localhost_cookies[0].SourceScheme());
- EXPECT_TRUE(http_localhost_cookies[0].IsSecure());
+ EXPECT_TRUE(http_localhost_cookies[0].SecureAttribute());
GURL http_other_url("http://other.test/path");
auto http_other_cookie = net::CanonicalCookie::Create(
@@ -1066,7 +1066,7 @@
EXPECT_EQ("http_other", http_other_cookies[0].Name());
EXPECT_EQ(net::CookieSourceScheme::kSecure,
http_other_cookies[0].SourceScheme());
- EXPECT_TRUE(http_other_cookies[0].IsSecure());
+ EXPECT_TRUE(http_other_cookies[0].SecureAttribute());
}
TEST_F(CookieManagerTest, ConfirmHttpOnlySetFails) {
diff --git a/services/network/public/cpp/cookie_manager_mojom_traits.h b/services/network/public/cpp/cookie_manager_mojom_traits.h
index 4ce6961..dae49bd5 100644
--- a/services/network/public/cpp/cookie_manager_mojom_traits.h
+++ b/services/network/public/cpp/cookie_manager_mojom_traits.h
@@ -259,7 +259,9 @@
static base::Time last_update(const net::CanonicalCookie& c) {
return c.LastUpdateDate();
}
- static bool secure(const net::CanonicalCookie& c) { return c.IsSecure(); }
+ static bool secure(const net::CanonicalCookie& c) {
+ return c.SecureAttribute();
+ }
static bool httponly(const net::CanonicalCookie& c) { return c.IsHttpOnly(); }
static net::CookieSameSite site_restrictions(const net::CanonicalCookie& c) {
return c.SameSite();
diff --git a/services/network/public/cpp/cookie_manager_mojom_traits_unittest.cc b/services/network/public/cpp/cookie_manager_mojom_traits_unittest.cc
index 0343778..9e908ce 100644
--- a/services/network/public/cpp/cookie_manager_mojom_traits_unittest.cc
+++ b/services/network/public/cpp/cookie_manager_mojom_traits_unittest.cc
@@ -40,7 +40,7 @@
EXPECT_EQ(original->LastAccessDate(), copied.LastAccessDate());
EXPECT_EQ(original->ExpiryDate(), copied.ExpiryDate());
EXPECT_EQ(original->LastUpdateDate(), copied.LastUpdateDate());
- EXPECT_EQ(original->IsSecure(), copied.IsSecure());
+ EXPECT_EQ(original->SecureAttribute(), copied.SecureAttribute());
EXPECT_EQ(original->IsHttpOnly(), copied.IsHttpOnly());
EXPECT_EQ(original->SameSite(), copied.SameSite());
EXPECT_EQ(original->Priority(), copied.Priority());
@@ -137,7 +137,7 @@
EXPECT_EQ(original.cookie.LastAccessDate(), copied.cookie.LastAccessDate());
EXPECT_EQ(original.cookie.ExpiryDate(), copied.cookie.ExpiryDate());
EXPECT_EQ(original.cookie.LastUpdateDate(), copied.cookie.LastUpdateDate());
- EXPECT_EQ(original.cookie.IsSecure(), copied.cookie.IsSecure());
+ EXPECT_EQ(original.cookie.SecureAttribute(), copied.cookie.SecureAttribute());
EXPECT_EQ(original.cookie.IsHttpOnly(), copied.cookie.IsHttpOnly());
EXPECT_EQ(original.cookie.SameSite(), copied.cookie.SameSite());
EXPECT_EQ(original.cookie.Priority(), copied.cookie.Priority());
@@ -169,7 +169,8 @@
EXPECT_EQ(original.cookie->LastAccessDate(), copied.cookie->LastAccessDate());
EXPECT_EQ(original.cookie->ExpiryDate(), copied.cookie->ExpiryDate());
EXPECT_EQ(original.cookie->LastUpdateDate(), copied.cookie->LastUpdateDate());
- EXPECT_EQ(original.cookie->IsSecure(), copied.cookie->IsSecure());
+ EXPECT_EQ(original.cookie->SecureAttribute(),
+ copied.cookie->SecureAttribute());
EXPECT_EQ(original.cookie->IsHttpOnly(), copied.cookie->IsHttpOnly());
EXPECT_EQ(original.cookie->SameSite(), copied.cookie->SameSite());
EXPECT_EQ(original.cookie->Priority(), copied.cookie->Priority());
@@ -508,7 +509,7 @@
EXPECT_EQ(original.cookie.LastAccessDate(), copied.cookie.LastAccessDate());
EXPECT_EQ(original.cookie.ExpiryDate(), copied.cookie.ExpiryDate());
EXPECT_EQ(original.cookie.LastUpdateDate(), copied.cookie.LastUpdateDate());
- EXPECT_EQ(original.cookie.IsSecure(), copied.cookie.IsSecure());
+ EXPECT_EQ(original.cookie.SecureAttribute(), copied.cookie.SecureAttribute());
EXPECT_EQ(original.cookie.IsHttpOnly(), copied.cookie.IsHttpOnly());
EXPECT_EQ(original.cookie.SameSite(), copied.cookie.SameSite());
EXPECT_EQ(original.cookie.Priority(), copied.cookie.Priority());
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc
index f3f52f1..07678d3 100644
--- a/services/network/restricted_cookie_manager.cc
+++ b/services/network/restricted_cookie_manager.cc
@@ -854,9 +854,9 @@
std::unique_ptr<net::CanonicalCookie> sanitized_cookie =
net::CanonicalCookie::FromStorage(
cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now,
- cookie.ExpiryDate(), now, now, cookie.IsSecure(), cookie.IsHttpOnly(),
- cookie.SameSite(), cookie.Priority(), cookie_partition_key,
- source_scheme, origin_.port());
+ cookie.ExpiryDate(), now, now, cookie.SecureAttribute(),
+ cookie.IsHttpOnly(), cookie.SameSite(), cookie.Priority(),
+ cookie_partition_key, source_scheme, origin_.port());
DCHECK(sanitized_cookie);
// FromStorage() uses a less strict version of IsCanonical(), we need to check
// the stricter version as well here.
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc
index 0a922d5..6f7db1d8 100644
--- a/services/network/url_loader_unittest.cc
+++ b/services/network/url_loader_unittest.cc
@@ -5612,7 +5612,8 @@
devtools_observer.WaitUntilRawResponse(1u);
EXPECT_EQ(204, devtools_observer.raw_response_http_status_code());
// On these failures the cookie object is created but not included.
- EXPECT_TRUE(devtools_observer.raw_response_cookies()[0].cookie->IsSecure());
+ EXPECT_TRUE(
+ devtools_observer.raw_response_cookies()[0].cookie->SecureAttribute());
EXPECT_TRUE(devtools_observer.raw_response_cookies()[0]
.access_result.status.HasExactlyExclusionReasonsForTesting(
{net::CookieInclusionStatus::EXCLUDE_SECURE_ONLY}));
@@ -5692,7 +5693,8 @@
EXPECT_EQ(401, devtools_observer.raw_response_http_status_code());
devtools_observer.WaitUntilRawResponse(1u);
// On these failures the cookie object is created but not included.
- EXPECT_TRUE(devtools_observer.raw_response_cookies()[0].cookie->IsSecure());
+ EXPECT_TRUE(
+ devtools_observer.raw_response_cookies()[0].cookie->SecureAttribute());
EXPECT_TRUE(devtools_observer.raw_response_cookies()[0]
.access_result.status.HasExactlyExclusionReasonsForTesting(
{net::CookieInclusionStatus::EXCLUDE_SECURE_ONLY}));
diff --git a/third_party/blink/renderer/core/testing/internals_cookies.cc b/third_party/blink/renderer/core/testing/internals_cookies.cc
index 88d5ae6..ec126d7 100644
--- a/third_party/blink/renderer/core/testing/internals_cookies.cc
+++ b/third_party/blink/renderer/core/testing/internals_cookies.cc
@@ -15,7 +15,7 @@
result->setValue(cookie->cookie.Value().c_str());
result->setPath(cookie->cookie.Path().c_str());
result->setDomain(cookie->cookie.Domain().c_str());
- result->setSecure(cookie->cookie.IsSecure());
+ result->setSecure(cookie->cookie.SecureAttribute());
result->setHttpOnly(cookie->cookie.IsHttpOnly());
if (!cookie->cookie.ExpiryDate().is_null()) {
// Expiry is omitted if unspecified.
diff --git a/third_party/blink/renderer/modules/cookie_store/cookie_change_event.cc b/third_party/blink/renderer/modules/cookie_store/cookie_change_event.cc
index 3542526..4dd114b 100644
--- a/third_party/blink/renderer/modules/cookie_store/cookie_change_event.cc
+++ b/third_party/blink/renderer/modules/cookie_store/cookie_change_event.cc
@@ -90,7 +90,7 @@
list_item->setName(String::FromUTF8(canonical_cookie.Name()));
list_item->setPath(String::FromUTF8(canonical_cookie.Path()));
- list_item->setSecure(canonical_cookie.IsSecure());
+ list_item->setSecure(canonical_cookie.SecureAttribute());
// Use effective same site if available, otherwise use same site.
auto&& same_site = ToCookieListItemEffectiveSameSite(effective_same_site);
if (same_site.IsNull())