Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: components/signin/core/browser/gaia_cookie_manager_service.cc

Issue 1264143003: Fix possible reconcilor loop when the primary account is in an auth error state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix possible reconcilor loop when the primary account is in an auth error state. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/browser/gaia_cookie_manager_service.cc
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc
index dcc74aefbeeb8347f378533f0793128ffcecea8d..b0b86971cc64cf709d525fe5246c644ac034d088 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service.cc
@@ -427,40 +427,22 @@ void GaiaCookieManagerService::CancelAll() {
fetcher_timer_.Stop();
}
-// It is unknown if the cookie was changed because of processing initiated by
-// this class or other (such as the user clearing all cookies or a cookie being
-// evicted).
void GaiaCookieManagerService::OnCookieChanged(
const net::CanonicalCookie& cookie,
bool removed) {
DCHECK_EQ("APISID", cookie.Name());
DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain());
+ // Ignore changes to the cookie while requests are pending. These changes
+ // are caused by the service itself as it adds accounts. A side effects is
+ // that any changes to the gaia cookie outside of this class, while requests
+ // are pending, will be lost. However, trying to process these changes could
+ // cause an endless loop (see crbug.com/516070).
if (requests_.empty()) {
requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest());
fetcher_retries_ = 0;
signin_client_->DelayNetworkCall(
base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
base::Unretained(this)));
- } else {
- // Remove all pending ListAccount calls; for efficiency, only call
- // after all pending requests are processed.
- // Track requests to keep; all other unstarted requests will be removed.
- std::vector<GaiaCookieRequest> requests_to_keep;
-
- // Check all pending, non-executing requests.
- for (auto it = requests_.begin() + 1; it != requests_.end(); ++it) {
- // Keep all requests except for LIST_ACCOUNTS.
- if (it->request_type() != GaiaCookieRequestType::LIST_ACCOUNTS)
- requests_to_keep.push_back(*it);
- }
-
- // Remove all but the executing request. Re-add all requests being kept.
- if (requests_.size() > 1) {
- requests_.erase(requests_.begin() + 1, requests_.end());
- requests_.insert(
- requests_.end(), requests_to_keep.begin(), requests_to_keep.end());
- }
- requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698