зеркало из https://github.com/mozilla/gecko-dev.git
bug 1439002 - remove useless debug spew from nsSiteSecurityService r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D25489 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
99da408e98
Коммит
f8da648dbc
|
@ -336,8 +336,7 @@ TRRService::Observe(nsISupports *aSubject, const char *aTopic,
|
|||
MutexAutoLock lock(mLock);
|
||||
mTRRBLStorage = DataStorage::Get(DataStorageClass::TRRBlacklist);
|
||||
if (mTRRBLStorage) {
|
||||
bool storageWillPersist = true;
|
||||
if (NS_FAILED(mTRRBLStorage->Init(storageWillPersist))) {
|
||||
if (NS_FAILED(mTRRBLStorage->Init(nullptr))) {
|
||||
mTRRBLStorage = nullptr;
|
||||
}
|
||||
if (mClearTRRBLStorage) {
|
||||
|
|
|
@ -1005,8 +1005,7 @@ already_AddRefed<AltSvcMapping> AltSvcCache::GetAltServiceMapping(
|
|||
// on another thread
|
||||
mStorage = DataStorage::Get(DataStorageClass::AlternateServices);
|
||||
if (mStorage) {
|
||||
bool storageWillPersist = false;
|
||||
if (NS_FAILED(mStorage->Init(storageWillPersist))) {
|
||||
if (NS_FAILED(mStorage->Init(nullptr))) {
|
||||
mStorage = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,8 +241,7 @@ void DataStorage::GetAllChildProcessData(
|
|||
if (!storage->mInitCalled) {
|
||||
// Perhaps no consumer has initialized the DataStorage object yet,
|
||||
// so do that now!
|
||||
bool dataWillPersist = false;
|
||||
nsresult rv = storage->Init(dataWillPersist);
|
||||
nsresult rv = storage->Init(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
@ -284,8 +283,7 @@ void DataStorage::SetCachedStorageEntries(
|
|||
for (auto& entry : entries) {
|
||||
RefPtr<DataStorage> storage =
|
||||
DataStorage::GetFromRawFileName(entry.filename());
|
||||
bool dataWillPersist = false;
|
||||
storage->Init(dataWillPersist, &entry.items());
|
||||
storage->Init(&entry.items());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +298,6 @@ size_t DataStorage::SizeOfIncludingThis(
|
|||
}
|
||||
|
||||
nsresult DataStorage::Init(
|
||||
bool& aDataWillPersist,
|
||||
const InfallibleTArray<mozilla::dom::DataStorageItem>* aItems) {
|
||||
// Don't access the observer service or preferences off the main thread.
|
||||
if (!NS_IsMainThread()) {
|
||||
|
@ -335,7 +332,7 @@ nsresult DataStorage::Init(
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = AsyncReadData(aDataWillPersist, lock);
|
||||
rv = AsyncReadData(lock);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -345,7 +342,6 @@ nsresult DataStorage::Init(
|
|||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
MOZ_ASSERT(aItems);
|
||||
|
||||
aDataWillPersist = false;
|
||||
for (auto& item : *aItems) {
|
||||
Entry entry;
|
||||
entry.mValue = item.value();
|
||||
|
@ -599,10 +595,8 @@ nsresult DataStorage::Reader::ParseLine(nsDependentCSubstring& aLine,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult DataStorage::AsyncReadData(bool& aHaveProfileDir,
|
||||
const MutexAutoLock& /*aProofOfLock*/) {
|
||||
nsresult DataStorage::AsyncReadData(const MutexAutoLock& /*aProofOfLock*/) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
aHaveProfileDir = false;
|
||||
// Allocate a Reader so that even if it isn't dispatched,
|
||||
// the data-storage-ready notification will be fired and Get
|
||||
// will be able to proceed (this happens in its destructor).
|
||||
|
@ -627,7 +621,6 @@ nsresult DataStorage::AsyncReadData(bool& aHaveProfileDir,
|
|||
return rv;
|
||||
}
|
||||
|
||||
aHaveProfileDir = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,13 +112,10 @@ class DataStorage : public nsIObserver {
|
|||
static already_AddRefed<DataStorage> Get(DataStorageClass aFilename);
|
||||
|
||||
// Initializes the DataStorage. Must be called before using.
|
||||
// aDataWillPersist returns whether or not data can be persistently saved.
|
||||
// aItems is used in the content process to initialize a cache of the items
|
||||
// received from the parent process over IPC. nullptr must be passed for the
|
||||
// parent process.
|
||||
nsresult Init(
|
||||
/*out*/ bool& aDataWillPersist,
|
||||
const InfallibleTArray<mozilla::dom::DataStorageItem>* aItems = nullptr);
|
||||
nsresult Init(const InfallibleTArray<mozilla::dom::DataStorageItem>* aItems);
|
||||
// Given a key and a type of data, returns a value. Returns an empty string if
|
||||
// the key is not present for that type of data. If Get is called before the
|
||||
// "data-storage-ready" event is observed, it will block. NB: It is not
|
||||
|
@ -186,8 +183,7 @@ class DataStorage : public nsIObserver {
|
|||
|
||||
void WaitForReady();
|
||||
nsresult AsyncWriteData(const MutexAutoLock& aProofOfLock);
|
||||
nsresult AsyncReadData(bool& aHaveProfileDir,
|
||||
const MutexAutoLock& aProofOfLock);
|
||||
nsresult AsyncReadData(const MutexAutoLock& aProofOfLock);
|
||||
nsresult AsyncSetTimer(const MutexAutoLock& aProofOfLock);
|
||||
nsresult DispatchShutdownTimer(const MutexAutoLock& aProofOfLock);
|
||||
|
||||
|
|
|
@ -489,22 +489,14 @@ nsresult nsSiteSecurityService::Init() {
|
|||
mozilla::DataStorage::Get(DataStorageClass::SiteSecurityServiceState);
|
||||
mPreloadStateStorage =
|
||||
mozilla::DataStorage::Get(DataStorageClass::SecurityPreloadState);
|
||||
bool storageWillPersist = false;
|
||||
bool preloadStorageWillPersist = false;
|
||||
nsresult rv = mSiteStateStorage->Init(storageWillPersist);
|
||||
nsresult rv = mSiteStateStorage->Init(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = mPreloadStateStorage->Init(preloadStorageWillPersist);
|
||||
rv = mPreloadStateStorage->Init(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
// This is not fatal. There are some cases where there won't be a
|
||||
// profile directory (e.g. running xpcshell). There isn't the
|
||||
// expectation that site information will be presisted in those cases.
|
||||
if (!storageWillPersist || !preloadStorageWillPersist) {
|
||||
NS_WARNING("site security information will not be persisted");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,10 @@ class psm_DataStorageTest : public ::testing::Test {
|
|||
::testing::UnitTest::GetInstance()->current_test_info();
|
||||
NS_ConvertUTF8toUTF16 testName(testInfo->name());
|
||||
storage = DataStorage::GetFromRawFileName(testName);
|
||||
storage->Init(dataWillPersist);
|
||||
storage->Init(nullptr);
|
||||
}
|
||||
|
||||
RefPtr<DataStorage> storage;
|
||||
bool dataWillPersist;
|
||||
};
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(testKey, "test");
|
||||
|
@ -35,8 +34,6 @@ NS_NAMED_LITERAL_CSTRING(testValue, "value");
|
|||
NS_NAMED_LITERAL_CSTRING(privateTestValue, "private");
|
||||
|
||||
TEST_F(psm_DataStorageTest, GetPutRemove) {
|
||||
EXPECT_TRUE(dataWillPersist);
|
||||
|
||||
// Test Put/Get on Persistent data
|
||||
EXPECT_EQ(NS_OK, storage->Put(testKey, testValue, DataStorage_Persistent));
|
||||
// Don't re-use testKey / testValue here, to make sure that this works as
|
||||
|
@ -90,8 +87,6 @@ TEST_F(psm_DataStorageTest, GetPutRemove) {
|
|||
}
|
||||
|
||||
TEST_F(psm_DataStorageTest, InputValidation) {
|
||||
EXPECT_TRUE(dataWillPersist);
|
||||
|
||||
// Keys may not have tabs or newlines
|
||||
EXPECT_EQ(NS_ERROR_INVALID_ARG,
|
||||
storage->Put(NS_LITERAL_CSTRING("key\thas tab"), testValue,
|
||||
|
@ -151,8 +146,6 @@ TEST_F(psm_DataStorageTest, InputValidation) {
|
|||
}
|
||||
|
||||
TEST_F(psm_DataStorageTest, Eviction) {
|
||||
EXPECT_TRUE(dataWillPersist);
|
||||
|
||||
// Eviction is on a per-table basis. Tables shouldn't affect each other.
|
||||
EXPECT_EQ(NS_OK, storage->Put(testKey, testValue, DataStorage_Persistent));
|
||||
for (int i = 0; i < 1025; i++) {
|
||||
|
@ -178,8 +171,6 @@ TEST_F(psm_DataStorageTest, Eviction) {
|
|||
}
|
||||
|
||||
TEST_F(psm_DataStorageTest, ClearPrivateData) {
|
||||
EXPECT_TRUE(dataWillPersist);
|
||||
|
||||
EXPECT_EQ(NS_OK,
|
||||
storage->Put(testKey, privateTestValue, DataStorage_Private));
|
||||
nsCString result = storage->Get(testKey, DataStorage_Private);
|
||||
|
@ -190,8 +181,6 @@ TEST_F(psm_DataStorageTest, ClearPrivateData) {
|
|||
}
|
||||
|
||||
TEST_F(psm_DataStorageTest, Shutdown) {
|
||||
EXPECT_TRUE(dataWillPersist);
|
||||
|
||||
EXPECT_EQ(NS_OK, storage->Put(testKey, testValue, DataStorage_Persistent));
|
||||
nsCString result = storage->Get(testKey, DataStorage_Persistent);
|
||||
EXPECT_STREQ("value", result.get());
|
||||
|
|
Загрузка…
Ссылка в новой задаче