Take scheme in CookieStore::SetCanonicalCookieAsync, not just whether it's secure.

https://chromium-review.googlesource.com/c/chromium/src/+/1450420
This commit is contained in:
deepak1556 2019-02-27 14:31:26 +05:30 committed by Samuel Attard
parent 457abecad6
commit c735116cc3

View file

@ -214,13 +214,13 @@ void FlushCookieStoreOnIOThread(
void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter, void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
std::unique_ptr<base::DictionaryValue> details, std::unique_ptr<base::DictionaryValue> details,
util::Promise promise) { util::Promise promise) {
std::string url, name, value, domain, path; std::string url_string, name, value, domain, path;
bool secure = false; bool secure = false;
bool http_only = false; bool http_only = false;
double creation_date; double creation_date;
double expiration_date; double expiration_date;
double last_access_date; double last_access_date;
details->GetString("url", &url); details->GetString("url", &url_string);
details->GetString("name", &name); details->GetString("name", &name);
details->GetString("value", &value); details->GetString("value", &value);
details->GetString("domain", &domain); details->GetString("domain", &domain);
@ -249,9 +249,10 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
: base::Time::FromDoubleT(last_access_date); : base::Time::FromDoubleT(last_access_date);
} }
GURL url(url_string);
std::unique_ptr<net::CanonicalCookie> canonical_cookie( std::unique_ptr<net::CanonicalCookie> canonical_cookie(
net::CanonicalCookie::CreateSanitizedCookie( net::CanonicalCookie::CreateSanitizedCookie(
GURL(url), name, value, domain, path, creation_time, expiration_time, url, name, value, domain, path, creation_time, expiration_time,
last_access_time, secure, http_only, last_access_time, secure, http_only,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise)); auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise));
@ -259,7 +260,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
std::move(completion_callback).Run(false); std::move(completion_callback).Run(false);
return; return;
} }
if (url.empty()) { if (url.is_empty()) {
std::move(completion_callback).Run(false); std::move(completion_callback).Run(false);
return; return;
} }
@ -268,7 +269,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
return; return;
} }
GetCookieStore(getter)->SetCanonicalCookieAsync( GetCookieStore(getter)->SetCanonicalCookieAsync(
std::move(canonical_cookie), secure, http_only, std::move(canonical_cookie), url.scheme(), http_only,
std::move(completion_callback)); std::move(completion_callback));
} }