Bug 1553963 - Fix Safe Browsing doesn't cache the gethash result for V4 tables. r=gcp

We use ".pset" to find active tables, but in Bug 1353956, v4 prefix files
are renamed to ".vlpset".

This patches include both 'pset' and 'vlpset' to ScanStoreDir.

Differential Revision: https://phabricator.services.mozilla.com/D32433
This commit is contained in:
dlee
2019-05-24 19:42:00 +00:00
parent 981f6143d7
commit 37e164a767

View File

@@ -922,17 +922,17 @@ nsresult Classifier::ScanStoreDir(nsIFile* aDirectory,
continue;
}
nsCString leafName;
nsAutoCString leafName;
rv = file->GetNativeLeafName(leafName);
NS_ENSURE_SUCCESS(rv, rv);
// Both v2 and v4 contain .pset file
nsCString suffix(NS_LITERAL_CSTRING(".pset"));
int32_t dot = leafName.RFind(suffix);
if (dot != -1) {
leafName.Cut(dot, suffix.Length());
aTables.AppendElement(leafName);
// Check both V2 and V4 prefix files
if (StringEndsWith(leafName, NS_LITERAL_CSTRING(".pset"))) {
aTables.AppendElement(
Substring(leafName, 0, leafName.Length() - strlen(".pset")));
} else if (StringEndsWith(leafName, NS_LITERAL_CSTRING(".vlpset"))) {
aTables.AppendElement(
Substring(leafName, 0, leafName.Length() - strlen(".vlpset")));
}
}
NS_ENSURE_SUCCESS(rv, rv);