Commit fcc40170 authored by Dylan Cutler's avatar Dylan Cutler Committed by Commit Bot

Use CanonicalCookie::FromStorage in

SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement.

This factory method is used when creating a CanonicalCookie from a
cookie that has already entered the user agent storage model.

Bug: 1102874
Change-Id: Ie6792b0348a40edb760e7da0192e4879952c415a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495802Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarLily Chen <chlily@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/master@{#820843}
parent 1e8054b9
...@@ -944,7 +944,8 @@ bool SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement( ...@@ -944,7 +944,8 @@ bool SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
} else { } else {
value = smt.ColumnString(3); value = smt.ColumnString(3);
} }
std::unique_ptr<CanonicalCookie> cc(std::make_unique<CanonicalCookie>( // Returns nullptr if the resulting cookie is not canonical.
std::unique_ptr<net::CanonicalCookie> cc = CanonicalCookie::FromStorage(
smt.ColumnString(2), // name smt.ColumnString(2), // name
value, // value value, // value
smt.ColumnString(1), // domain smt.ColumnString(1), // domain
...@@ -958,10 +959,10 @@ bool SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement( ...@@ -958,10 +959,10 @@ bool SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
static_cast<DBCookieSameSite>(smt.ColumnInt(9))), // samesite static_cast<DBCookieSameSite>(smt.ColumnInt(9))), // samesite
DBCookiePriorityToCookiePriority( DBCookiePriorityToCookiePriority(
static_cast<DBCookiePriority>(smt.ColumnInt(13))), // priority static_cast<DBCookiePriority>(smt.ColumnInt(13))), // priority
DBToCookieSourceScheme(smt.ColumnInt(14)))); // source_scheme DBToCookieSourceScheme(smt.ColumnInt(14))); // source_scheme
DLOG_IF(WARNING, cc->CreationDate() > Time::Now()) if (cc) {
<< L"CreationDate too recent"; DLOG_IF(WARNING, cc->CreationDate() > Time::Now())
if (cc->IsCanonical()) { << L"CreationDate too recent";
cookies->push_back(std::move(cc)); cookies->push_back(std::move(cc));
} else { } else {
RecordCookieLoadProblem(COOKIE_LOAD_PROBLEM_NON_CANONICAL); RecordCookieLoadProblem(COOKIE_LOAD_PROBLEM_NON_CANONICAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment