Bug 1353956 - P2. Do not use SHA-256 while loading the V4 prefix files. r=gcp

SHA256 is an expensive operation, we should avoid using them if
possible. SafeBrowsing prefix files are loaded during startup and
verify integrity with SHA256 which may affect the performance
especially on the low-end device.

This patch simply removes the SHA256 integrity check. CRC32 version
integrity check will be introduced in the other patch.

This patch also changes the behavior of recording
"Telemetry::URLCLASSIFIER_VLPS_LOAD_CORRUPT" a little bit.
It used to records only once per session(during startup, the first
time we load prefix set), now it records per update.

Differential Revision: https://phabricator.services.mozilla.com/D21461
This commit is contained in:
dlee
2019-02-28 08:18:46 +00:00
parent 15191963de
commit d8899e5669
3 changed files with 3 additions and 51 deletions

View File

@@ -1579,6 +1579,8 @@ nsresult Classifier::LoadMetadata(nsIFile* aDirectory, nsACString& aResult) {
nsCString state, sha256;
rv = lookupCacheV4->LoadMetadata(state, sha256);
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_VLPS_METADATA_CORRUPT,
rv == NS_ERROR_FILE_CORRUPTED);
if (NS_FAILED(rv)) {
LOG(("Failed to get metadata for table %s", tableName.get()));
continue;