summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 23:51:44 +0000
committerpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 23:51:44 +0000
commitcb1cdf49dfef2a86f5616be04f07381ec00ce1b9 (patch)
tree2025f963a18865310e35935f4b654748b5aaee64
parent4b311b6608df484304a6524c2870b9b49ea020f4 (diff)
downloadchromium_src-cb1cdf49dfef2a86f5616be04f07381ec00ce1b9.zip
chromium_src-cb1cdf49dfef2a86f5616be04f07381ec00ce1b9.tar.gz
chromium_src-cb1cdf49dfef2a86f5616be04f07381ec00ce1b9.tar.bz2
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
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc30
1 files 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;