зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1353956 - P5. Remove old v4 prefix files after new files are stored. r=gcp
This patch is to cleanup old SafeBrowsing v4 prefix files. Differential Revision: https://phabricator.services.mozilla.com/D21464 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
28063a4595
Коммит
885f2b0cca
|
@ -308,6 +308,39 @@ nsresult LookupCacheV4::StoreToFile(nsCOMPtr<nsIFile>& aFile) {
|
|||
}
|
||||
|
||||
LOG(("[%s] Storing PrefixSet successful", mTableName.get()));
|
||||
|
||||
// This is to remove old ".pset" files if exist
|
||||
Unused << CleanOldPrefixSet();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult LookupCacheV4::CleanOldPrefixSet() {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv = mStoreDirectory->Clone(getter_AddRefs(file));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = file->AppendNative(mTableName + NS_LITERAL_CSTRING(".pset"));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool exists;
|
||||
rv = file->Exists(&exists);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
rv = file->Remove(false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
LOG(("[%s] Old PrefixSet is succuessfully removed!", mTableName.get()));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ class LookupCacheV4 final : public LookupCache {
|
|||
|
||||
nsresult SanityCheck(const Header& aHeader);
|
||||
nsresult VerifyCRC32(nsCOMPtr<nsIInputStream>& aIn);
|
||||
nsresult CleanOldPrefixSet();
|
||||
|
||||
RefPtr<VariableLengthPrefixSet> mVLPrefixSet;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче