From cb1cdf49dfef2a86f5616be04f07381ec00ce1b9 Mon Sep 17 00:00:00 2001 From: "paulg@google.com" Date: Fri, 16 Jan 2009 23:51:44 +0000 Subject: End the SafeBrowsing update cycle when the update response contains no chunk URLs (i.e. the client is up to date). We currently don't handle this case properly, which results in a DCHECK being hit. BUG=6049 (http://crbug.com/6049) Review URL: http://codereview.chromium.org/18181 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8244 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/safe_browsing/protocol_manager.cc | 30 +++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 13b4968..5086e22 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -222,15 +222,29 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( UpdateFinished(false); } - if (request_type_ == CHUNK_REQUEST && parsed_ok) { - chunk_request_urls_.pop_front(); - } else if (request_type_ == GETKEY_REQUEST && initial_request_) { - // This is the first request we've made this session. Now that we have - // the keys, do the regular update request. - initial_request_ = false; - GetNextUpdate(); - return; + switch (request_type_) { + case CHUNK_REQUEST: + if (parsed_ok) + chunk_request_urls_.pop_front(); + break; + case GETKEY_REQUEST: + if (initial_request_) { + // This is the first request we've made this session. Now that we + // have the keys, do the regular update request. + initial_request_ = false; + GetNextUpdate(); + return; + } + break; + case UPDATE_REQUEST: + if (chunk_request_urls_.empty() && parsed_ok) { + // We are up to date since the servers gave us nothing new, so we + // are done with this update cycle. + UpdateFinished(true); + } + break; } + } else if (response_code >= 300) { // The SafeBrowsing service error: back off. must_back_off = true; -- cgit v1.1