Bug 1346196 - URLCLASSIFIER_UPDATE_REMOTE_STATUS2 records values using empty keys. r=francois

mTelemetryProvider might be empty if |CancelUpdate| is called during update.
In that scenario, the call flow will look like:
CancelUpdate -> UpdateError -> DownloadDone -> set mTelemetryProvider to empty ->
OnStartRequest -> record telemetry with empty key.

So in this patch, move mTelemetryProvider.Truncate() to OnStopRequest.

MozReview-Commit-ID: JDgNUqR4SKa

--HG--
extra : rebase_source : 42aa4c898f403a1189e67e355246ebed5aa4af44
This commit is contained in:
dimi 2017-03-16 14:42:46 +08:00
Родитель 9a6e19ebfb
Коммит b98b77568d
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -99,7 +99,6 @@ nsUrlClassifierStreamUpdater::DownloadDone()
mSuccessCallback = nullptr;
mUpdateErrorCallback = nullptr;
mDownloadErrorCallback = nullptr;
mTelemetryProvider.Truncate();
}
///////////////////////////////////////////////////////////////////////////////
@ -781,6 +780,7 @@ nsUrlClassifierStreamUpdater::OnStopRequest(nsIRequest *request, nsISupports* co
rv = mDBService->FinishUpdate();
}
mTelemetryProvider.Truncate();
mChannel = nullptr;
// If the fetch failed, return the network status rather than NS_OK, the