|
@@ -226,13 +226,13 @@ void FlushCookieStoreOnIOThread(
|
|
|
void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
|
|
std::unique_ptr<base::DictionaryValue> details,
|
|
|
util::Promise promise) {
|
|
|
- std::string url, name, value, domain, path;
|
|
|
+ std::string url_string, name, value, domain, path;
|
|
|
bool secure = false;
|
|
|
bool http_only = false;
|
|
|
double creation_date;
|
|
|
double expiration_date;
|
|
|
double last_access_date;
|
|
|
- details->GetString("url", &url);
|
|
|
+ details->GetString("url", &url_string);
|
|
|
details->GetString("name", &name);
|
|
|
details->GetString("value", &value);
|
|
|
details->GetString("domain", &domain);
|
|
@@ -261,21 +261,24 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
|
|
: base::Time::FromDoubleT(last_access_date);
|
|
|
}
|
|
|
|
|
|
- std::unique_ptr<net::CanonicalCookie> canonical_cookie(
|
|
|
- net::CanonicalCookie::CreateSanitizedCookie(
|
|
|
- GURL(url), name, value, domain, path, creation_time, expiration_time,
|
|
|
- last_access_time, secure, http_only,
|
|
|
- net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
|
|
|
auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise));
|
|
|
- if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
|
|
+ GURL url(url_string);
|
|
|
+ if (!url.is_valid()) {
|
|
|
std::move(completion_callback).Run(false);
|
|
|
return;
|
|
|
}
|
|
|
- if (url.empty()) {
|
|
|
+
|
|
|
+ if (name.empty()) {
|
|
|
std::move(completion_callback).Run(false);
|
|
|
return;
|
|
|
}
|
|
|
- if (name.empty()) {
|
|
|
+
|
|
|
+ std::unique_ptr<net::CanonicalCookie> canonical_cookie(
|
|
|
+ net::CanonicalCookie::CreateSanitizedCookie(
|
|
|
+ url, name, value, domain, path, creation_time, expiration_time,
|
|
|
+ last_access_time, secure, http_only,
|
|
|
+ net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
|
|
|
+ if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
|
|
std::move(completion_callback).Run(false);
|
|
|
return;
|
|
|
}
|