Bug 1386013 - Log an error when Safe Browsing times out. r?hchang
MozReview-Commit-ID: A99ov9T7rtm
--- 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);