Bug 418752: don't bother fetching forwards on a failed safebrowsing update. r=tony, a=beltzner
authordcamp@mozilla.com
Tue, 26 Feb 2008 09:47:05 -0800
changeset 12269 87661fe84265c75a834538f67e61a2732e50c95a
parent 12268 624cbd0e90bef8366beb822cf38f60cc6a6ed243
child 12270 d6350d079c6ab014fb39d36cea1ea2fd54e6725d
push idunknown
push userunknown
push dateunknown
reviewerstony, beltzner
bugs418752
milestone1.9b4pre
Bug 418752: don't bother fetching forwards on a failed safebrowsing update. r=tony, a=beltzner
toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl
toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp
--- a/toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl
+++ b/toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl
@@ -64,18 +64,22 @@ interface nsIUrlClassifierUpdateObserver
    * and sent to the classifier as a new stream.
    *
    * @param url The url that was requested.
    * @param table The table name that this URL's contents will be associated
    *              with.
    */
   void updateUrlRequested(in ACString url, in ACString table);
 
-  /* A stream update has completed */
-  void streamFinished();
+  /**
+   * A stream update has completed.
+   *
+   * @param status The state of the update process.
+   */
+  void streamFinished(in nsresult status);
 
   /* The update has encountered an error and should be cancelled */
   void updateError(in nsresult error);
 
   /**
    * The update has completed successfully.
    *
    * @param requestedTimeout The number of seconds that the caller should
--- a/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
@@ -2531,17 +2531,17 @@ NS_IMETHODIMP
 nsUrlClassifierDBServiceWorker::FinishStream()
 {
   if (gShuttingDownThread)
     return NS_ERROR_NOT_INITIALIZED;
 
   NS_ENSURE_STATE(mInStream);
   NS_ENSURE_STATE(mUpdateObserver);
 
-  mUpdateObserver->StreamFinished();
+  mUpdateObserver->StreamFinished(mUpdateStatus);
 
   ResetStream();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsUrlClassifierDBServiceWorker::FinishUpdate()
--- a/toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp
@@ -244,22 +244,22 @@ nsUrlClassifierStreamUpdater::UpdateUrlR
     update->mUrl = NS_LITERAL_CSTRING("http://") + aUrl;
   }
   update->mTable = aTable;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsUrlClassifierStreamUpdater::StreamFinished()
+nsUrlClassifierStreamUpdater::StreamFinished(nsresult status)
 {
   nsresult rv;
 
   // Pop off a pending URL and update it.
-  if (mPendingUpdates.Length() > 0) {
+  if (NS_SUCCEEDED(status) && mPendingUpdates.Length() > 0) {
     PendingUpdate &update = mPendingUpdates[0];
     rv = FetchUpdate(update.mUrl, EmptyCString(), update.mTable);
     if (NS_FAILED(rv)) {
       LOG(("Error fetching update url: %s\n", update.mUrl.get()));
       mDBService->CancelUpdate();
       return rv;
     }