Bug 1386013 - Log an error when Safe Browsing times out. r=hchang
authorFrancois Marier <francois@mozilla.com>
Mon, 31 Jul 2017 20:29:25 -0700
changeset 420832 576d291d94492f2e47c9f38d129fddf3fb46562a
parent 420831 1eea95104a3a6c4ead53e8ff70f8dc25dfc078aa
child 420833 8d09df72c2e9b923bb84fe9741a668988834c393
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershchang
bugs1386013
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1386013 - Log an error when Safe Browsing times out. r=hchang MozReview-Commit-ID: A99ov9T7rtm
toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
+++ b/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
@@ -411,17 +411,17 @@ HashCompleterRequest.prototype = {
     });
   },
 
   notify: function HCR_notify() {
     // If we haven't gotten onStopRequest, just cancel. This will call us
     // with onStopRequest since we implement nsIStreamListener on the
     // channel.
     if (this._channel && this._channel.isPending()) {
-      log("cancelling request to " + this.gethashUrl + "\n");
+      log("cancelling request to " + this.gethashUrl + " (timeout)\n");
       Services.telemetry.getKeyedHistogramById("URLCLASSIFIER_COMPLETE_TIMEOUT2").
         add(this.telemetryProvider, 1);
       this._channel.cancel(Cr.NS_BINDING_ABORTED);
     }
   },
 
   // Creates an nsIChannel for the request and fills the body.
   openChannel: function HCR_openChannel() {
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -972,25 +972,29 @@ nsUrlClassifierStreamUpdater::Notify(nsI
   if (timer == mResponseTimeoutTimer) {
     mResponseTimeoutTimer = nullptr;
     if (mTimeoutTimer) {
       mTimeoutTimer->Cancel();
       mTimeoutTimer = nullptr;
     }
     mDownloadError = true; // Trigger backoff
     updateFailed = true;
+    MOZ_LOG(gUrlClassifierStreamUpdaterLog, mozilla::LogLevel::Error,
+            ("Safe Browsing timed out while waiting for the update server to respond."));
     mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_TIMEOUT,
                                    mTelemetryProvider,
                                    static_cast<uint8_t>(eResponseTimeout));
   }
 
   if (timer == mTimeoutTimer) {
     mTimeoutTimer = nullptr;
     // No backoff since the connection may just be temporarily slow.
     updateFailed = true;
+    MOZ_LOG(gUrlClassifierStreamUpdaterLog, mozilla::LogLevel::Error,
+            ("Safe Browsing timed out while waiting for the update server to finish."));
     mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_TIMEOUT,
                                    mTelemetryProvider,
                                    static_cast<uint8_t>(eDownloadTimeout));
   }
 
   if (updateFailed) {
     // Cancelling the channel will trigger OnStopRequest.
     mozilla::Unused << mChannel->Cancel(NS_ERROR_ABORT);