diff options
author | Roger Tawa <rogerta@google.com> | 2015-09-14 15:15:47 -0400 |
---|---|---|
committer | Roger Tawa <rogerta@google.com> | 2015-09-14 19:16:45 +0000 |
commit | f9d1508df355a4d68577421e39451a894480eb3e (patch) | |
tree | a36b8f54166cc72036cf86845b85af02240f7c5e | |
parent | c4aed78e09fd375790475b88704c05a87e513e85 (diff) | |
download | chromium_src-f9d1508df355a4d68577421e39451a894480eb3e.zip chromium_src-f9d1508df355a4d68577421e39451a894480eb3e.tar.gz chromium_src-f9d1508df355a4d68577421e39451a894480eb3e.tar.bz2 |
[Merge m45] Fix possible reconcilor loop when the primary account is in an auth error state.
BUG=516070,529439
TBR=rogerta@chromium.org, nyquist@chromium.org
Review URL: https://codereview.chromium.org/1264143003
Cr-Commit-Position: refs/heads/master@{#348441}
(cherry picked from commit b32365ef9d9117c4b78cbee77361fd401e8841a2)
Review URL: https://codereview.chromium.org/1336393002 .
Cr-Commit-Position: refs/branch-heads/2454@{#472}
Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
-rw-r--r-- | components/signin/core/browser/gaia_cookie_manager_service.cc | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc index 4beff36..607c2a2 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()); } } |