mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1382688 - Do not allow to enable old disk cache backend, r=honzab
This commit is contained in:
parent
eb53891d73
commit
8030ac3f2d
@ -36,14 +36,6 @@ pref("general.warnOnAboutConfig", true);
|
||||
// maximum number of dated backups to keep at any time
|
||||
pref("browser.bookmarks.max_backups", 5);
|
||||
|
||||
// Delete HTTP cache v1 data
|
||||
pref("browser.cache.auto_delete_cache_version", 0);
|
||||
// Preference for switching the cache backend, can be changed freely at runtime
|
||||
// 0 - use the old (Darin's) cache
|
||||
// 1 - use the new cache back-end (cache v2)
|
||||
pref("browser.cache.use_new_backend", 0);
|
||||
pref("browser.cache.use_new_backend_temp", true);
|
||||
|
||||
pref("browser.cache.disk.enable", true);
|
||||
// Is this the first-time smartsizing has been introduced?
|
||||
pref("browser.cache.disk.smart_size.first_run", true);
|
||||
|
@ -963,25 +963,13 @@ nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
|
||||
} \
|
||||
\
|
||||
if (!cacheReadStart.IsNull() && !cacheReadEnd.IsNull()) { \
|
||||
if (!CacheObserver::UseNewCache()) { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE, \
|
||||
asyncOpen, cacheReadStart); \
|
||||
} else { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE_V2, \
|
||||
asyncOpen, cacheReadStart); \
|
||||
} \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE_V2, \
|
||||
asyncOpen, cacheReadStart); \
|
||||
\
|
||||
if (!CacheObserver::UseNewCache()) { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_CACHE_READ_TIME, \
|
||||
cacheReadStart, cacheReadEnd); \
|
||||
} else { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_CACHE_READ_TIME_V2, \
|
||||
cacheReadStart, cacheReadEnd); \
|
||||
} \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_CACHE_READ_TIME_V2, \
|
||||
cacheReadStart, cacheReadEnd); \
|
||||
\
|
||||
if (!requestStart.IsNull() && !responseEnd.IsNull()) { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
@ -991,38 +979,20 @@ nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
|
||||
} \
|
||||
\
|
||||
if (!cacheReadEnd.IsNull()) { \
|
||||
if (!CacheObserver::UseNewCache()) { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
} else { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED_V2, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
} \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED_V2, \
|
||||
asyncOpen, cacheReadEnd); \
|
||||
} \
|
||||
else if (!responseEnd.IsNull()) { \
|
||||
if (!CacheObserver::UseNewCache()) { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
|
||||
asyncOpen, responseEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET, \
|
||||
asyncOpen, responseEnd); \
|
||||
} else { \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
|
||||
asyncOpen, responseEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET_V2, \
|
||||
asyncOpen, responseEnd); \
|
||||
} \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
|
||||
asyncOpen, responseEnd); \
|
||||
Telemetry::AccumulateTimeDelta( \
|
||||
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET_V2, \
|
||||
asyncOpen, responseEnd); \
|
||||
}
|
||||
|
||||
if (aDefaultRequest) {
|
||||
|
43
netwerk/cache/nsCacheService.cpp
vendored
43
netwerk/cache/nsCacheService.cpp
vendored
@ -1314,10 +1314,7 @@ nsCacheService::CreateSession(const char * clientID,
|
||||
{
|
||||
*result = nullptr;
|
||||
|
||||
if (net::CacheObserver::UseNewCache())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return CreateSessionInternal(clientID, storagePolicy, streamBased, result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1475,10 +1472,7 @@ nsCacheService::IsStorageEnabledForPolicy_Locked(nsCacheStoragePolicy storagePo
|
||||
|
||||
NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
|
||||
{
|
||||
if (net::CacheObserver::UseNewCache())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return VisitEntriesInternal(visitor);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsCacheService::VisitEntriesInternal(nsICacheVisitor *visitor)
|
||||
@ -1537,10 +1531,7 @@ void nsCacheService::FireClearNetworkCacheStoredAnywhereNotification()
|
||||
|
||||
NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
|
||||
{
|
||||
if (net::CacheObserver::UseNewCache())
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return EvictEntriesInternal(storagePolicy);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsCacheService::EvictEntriesInternal(nsCacheStoragePolicy storagePolicy)
|
||||
@ -3108,33 +3099,7 @@ nsCacheService::SetDiskSmartSize()
|
||||
nsresult
|
||||
nsCacheService::SetDiskSmartSize_Locked()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mozilla::net::CacheObserver::UseNewCache()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!mObserver->DiskCacheParentDirectory())
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (!mDiskDevice)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (!mObserver->SmartSizeEnabled())
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsAutoString cachePath;
|
||||
rv = mObserver->DiskCacheParentDirectory()->GetPath(cachePath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new nsGetSmartSizeEvent(cachePath, mDiskDevice->getCacheSize(),
|
||||
mObserver->ShouldUseOldMaxSmartSize());
|
||||
DispatchToCacheIOThread(event);
|
||||
} else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4265,10 +4265,6 @@ CacheFileIOManager::UpdateSmartCacheSize(int64_t aFreeSpace)
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!CacheObserver::UseNewCache()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (!CacheObserver::SmartCacheSizeEnabled()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -23,14 +23,6 @@ namespace net {
|
||||
|
||||
CacheObserver* CacheObserver::sSelf = nullptr;
|
||||
|
||||
static uint32_t const kDefaultUseNewCache = 1; // Use the new cache by default
|
||||
uint32_t CacheObserver::sUseNewCache = kDefaultUseNewCache;
|
||||
|
||||
static bool sUseNewCacheTemp = false; // Temp trigger to not lose early adopters
|
||||
|
||||
static int32_t const kAutoDeleteCacheVersion = -1; // Auto-delete off by default
|
||||
static int32_t sAutoDeleteCacheVersion = kAutoDeleteCacheVersion;
|
||||
|
||||
static int32_t const kDefaultHalfLifeExperiment = -1; // Disabled
|
||||
int32_t CacheObserver::sHalfLifeExperiment = kDefaultHalfLifeExperiment;
|
||||
|
||||
@ -150,14 +142,6 @@ CacheObserver::Shutdown()
|
||||
void
|
||||
CacheObserver::AttachToPreferences()
|
||||
{
|
||||
sAutoDeleteCacheVersion = mozilla::Preferences::GetInt(
|
||||
"browser.cache.auto_delete_cache_version", kAutoDeleteCacheVersion);
|
||||
|
||||
mozilla::Preferences::AddUintVarCache(
|
||||
&sUseNewCache, "browser.cache.use_new_backend", kDefaultUseNewCache);
|
||||
mozilla::Preferences::AddBoolVarCache(
|
||||
&sUseNewCacheTemp, "browser.cache.use_new_backend_temp", false);
|
||||
|
||||
mozilla::Preferences::AddBoolVarCache(
|
||||
&sUseDiskCache, "browser.cache.disk.enable", kDefaultUseDiskCache);
|
||||
mozilla::Preferences::AddBoolVarCache(
|
||||
@ -292,25 +276,6 @@ uint32_t CacheObserver::MemoryCacheCapacity()
|
||||
return sAutoMemoryCacheCapacity = capacity;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CacheObserver::UseNewCache()
|
||||
{
|
||||
uint32_t useNewCache = sUseNewCache;
|
||||
|
||||
if (sUseNewCacheTemp)
|
||||
useNewCache = 1;
|
||||
|
||||
switch (useNewCache) {
|
||||
case 0: // use the old cache backend
|
||||
return false;
|
||||
|
||||
case 1: // use the new cache backend
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
CacheObserver::SetDiskCacheCapacity(uint32_t aCapacity)
|
||||
@ -528,8 +493,7 @@ CacheObserver::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
|
||||
uint32_t activeVersion = UseNewCache() ? 1 : 0;
|
||||
CacheStorageService::CleaupCacheDirectories(sAutoDeleteCacheVersion, activeVersion);
|
||||
CacheStorageService::CleaupCacheDirectories();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ class CacheObserver : public nsIObserver
|
||||
static CacheObserver* Self() { return sSelf; }
|
||||
|
||||
// Access to preferences
|
||||
static bool UseNewCache();
|
||||
static bool UseDiskCache()
|
||||
{ return sUseDiskCache; }
|
||||
static bool UseMemoryCache()
|
||||
@ -86,7 +85,6 @@ private:
|
||||
void StoreHashStatsReported();
|
||||
void AttachToPreferences();
|
||||
|
||||
static uint32_t sUseNewCache;
|
||||
static bool sUseMemoryCache;
|
||||
static bool sUseDiskCache;
|
||||
static uint32_t sMetadataMemoryLimit;
|
||||
|
@ -571,13 +571,11 @@ class CleaupCacheDirectoriesRunnable : public Runnable
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIRUNNABLE
|
||||
static bool Post(uint32_t aVersion, uint32_t aActive);
|
||||
static bool Post();
|
||||
|
||||
private:
|
||||
CleaupCacheDirectoriesRunnable(uint32_t aVersion, uint32_t aActive)
|
||||
CleaupCacheDirectoriesRunnable()
|
||||
: Runnable("net::CleaupCacheDirectoriesRunnable")
|
||||
, mVersion(aVersion)
|
||||
, mActive(aActive)
|
||||
{
|
||||
nsCacheService::GetDiskCacheDirectory(getter_AddRefs(mCache1Dir));
|
||||
CacheFileIOManager::GetCacheDirectory(getter_AddRefs(mCache2Dir));
|
||||
@ -587,7 +585,6 @@ private:
|
||||
}
|
||||
|
||||
virtual ~CleaupCacheDirectoriesRunnable() {}
|
||||
uint32_t mVersion, mActive;
|
||||
nsCOMPtr<nsIFile> mCache1Dir, mCache2Dir;
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
nsCOMPtr<nsIFile> mCache2Profileless;
|
||||
@ -595,11 +592,10 @@ private:
|
||||
};
|
||||
|
||||
// static
|
||||
bool CleaupCacheDirectoriesRunnable::Post(uint32_t aVersion, uint32_t aActive)
|
||||
bool CleaupCacheDirectoriesRunnable::Post()
|
||||
{
|
||||
// CleaupCacheDirectories is called regardless what cache version is set up to use.
|
||||
// To obtain the cache1 directory we must unfortunately instantiate the old cache
|
||||
// service despite it may not be used at all... This also initialize nsDeleteDir.
|
||||
// service despite it may not be used at all... This also initializes nsDeleteDir.
|
||||
nsCOMPtr<nsICacheService> service = do_GetService(NS_CACHESERVICE_CONTRACTID);
|
||||
if (!service)
|
||||
return false;
|
||||
@ -609,8 +605,7 @@ bool CleaupCacheDirectoriesRunnable::Post(uint32_t aVersion, uint32_t aActive)
|
||||
if (!thread)
|
||||
return false;
|
||||
|
||||
RefPtr<CleaupCacheDirectoriesRunnable> r =
|
||||
new CleaupCacheDirectoriesRunnable(aVersion, aActive);
|
||||
RefPtr<CleaupCacheDirectoriesRunnable> r = new CleaupCacheDirectoriesRunnable();
|
||||
thread->Dispatch(r, NS_DISPATCH_NORMAL);
|
||||
return true;
|
||||
}
|
||||
@ -633,22 +628,8 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run()
|
||||
}
|
||||
#endif
|
||||
|
||||
// Delete the non-active version cache data right now
|
||||
if (mVersion == mActive) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (mVersion) {
|
||||
case 0:
|
||||
if (mCache1Dir) {
|
||||
nsDeleteDir::DeleteDir(mCache1Dir, true, 30000);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (mCache2Dir) {
|
||||
nsDeleteDir::DeleteDir(mCache2Dir, true, 30000);
|
||||
}
|
||||
break;
|
||||
if (mCache1Dir) {
|
||||
nsDeleteDir::DeleteDir(mCache1Dir, true, 30000);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -657,11 +638,11 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run()
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
void CacheStorageService::CleaupCacheDirectories(uint32_t aVersion, uint32_t aActive)
|
||||
void CacheStorageService::CleaupCacheDirectories()
|
||||
{
|
||||
// Make sure we schedule just once in case CleaupCacheDirectories gets called
|
||||
// multiple times from some reason.
|
||||
static bool runOnce = CleaupCacheDirectoriesRunnable::Post(aVersion, aActive);
|
||||
static bool runOnce = CleaupCacheDirectoriesRunnable::Post();
|
||||
if (!runOnce) {
|
||||
NS_WARNING("Could not start cache trashes cleanup");
|
||||
}
|
||||
@ -707,14 +688,8 @@ NS_IMETHODIMP CacheStorageService::MemoryCacheStorage(nsILoadContextInfo *aLoadC
|
||||
NS_ENSURE_ARG(aLoadContextInfo);
|
||||
NS_ENSURE_ARG(_retval);
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage;
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
storage = new CacheStorage(aLoadContextInfo, false, false, false, false);
|
||||
}
|
||||
else {
|
||||
storage = new _OldStorage(aLoadContextInfo, false, false, false, nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
|
||||
aLoadContextInfo, false, false, false, false);
|
||||
storage.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -732,14 +707,8 @@ NS_IMETHODIMP CacheStorageService::DiskCacheStorage(nsILoadContextInfo *aLoadCon
|
||||
// in memory.
|
||||
bool useDisk = CacheObserver::UseDiskCache();
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage;
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
storage = new CacheStorage(aLoadContextInfo, useDisk, aLookupAppCache, false /* size limit */, false /* don't pin */);
|
||||
}
|
||||
else {
|
||||
storage = new _OldStorage(aLoadContextInfo, useDisk, aLookupAppCache, false, nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
|
||||
aLoadContextInfo, useDisk, aLookupAppCache, false /* size limit */, false /* don't pin */);
|
||||
storage.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -750,10 +719,6 @@ NS_IMETHODIMP CacheStorageService::PinningCacheStorage(nsILoadContextInfo *aLoad
|
||||
NS_ENSURE_ARG(aLoadContextInfo);
|
||||
NS_ENSURE_ARG(_retval);
|
||||
|
||||
if (!CacheObserver::UseNewCache()) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// When disk cache is disabled don't pretend we cache.
|
||||
if (!CacheObserver::UseDiskCache()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@ -773,14 +738,9 @@ NS_IMETHODIMP CacheStorageService::AppCacheStorage(nsILoadContextInfo *aLoadCont
|
||||
NS_ENSURE_ARG(_retval);
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage;
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
// Using classification since cl believes we want to instantiate this method
|
||||
// having the same name as the desired class...
|
||||
storage = new mozilla::net::AppCacheStorage(aLoadContextInfo, aApplicationCache);
|
||||
}
|
||||
else {
|
||||
storage = new _OldStorage(aLoadContextInfo, true, false, true, aApplicationCache);
|
||||
}
|
||||
// Using classification since cl believes we want to instantiate this method
|
||||
// having the same name as the desired class...
|
||||
storage = new mozilla::net::AppCacheStorage(aLoadContextInfo, aApplicationCache);
|
||||
|
||||
storage.forget(_retval);
|
||||
return NS_OK;
|
||||
@ -792,14 +752,8 @@ NS_IMETHODIMP CacheStorageService::SynthesizedCacheStorage(nsILoadContextInfo *a
|
||||
NS_ENSURE_ARG(aLoadContextInfo);
|
||||
NS_ENSURE_ARG(_retval);
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage;
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
storage = new CacheStorage(aLoadContextInfo, false, false, true /* skip size checks for synthesized cache */, false /* no pinning */);
|
||||
}
|
||||
else {
|
||||
storage = new _OldStorage(aLoadContextInfo, false, false, false, nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
|
||||
aLoadContextInfo, false, false, true /* skip size checks for synthesized cache */, false /* no pinning */);
|
||||
storage.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -808,45 +762,34 @@ NS_IMETHODIMP CacheStorageService::Clear()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
// Tell the index to block notification to AsyncGetDiskConsumption.
|
||||
// Will be allowed again from CacheFileContextEvictor::EvictEntries()
|
||||
// when all the context have been removed from disk.
|
||||
CacheIndex::OnAsyncEviction(true);
|
||||
// Tell the index to block notification to AsyncGetDiskConsumption.
|
||||
// Will be allowed again from CacheFileContextEvictor::EvictEntries()
|
||||
// when all the context have been removed from disk.
|
||||
CacheIndex::OnAsyncEviction(true);
|
||||
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
|
||||
{
|
||||
mozilla::MutexAutoLock forcedValidEntriesLock(mForcedValidEntriesLock);
|
||||
mForcedValidEntries.Clear();
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(!mShutdown, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsTArray<nsCString> keys;
|
||||
for (auto iter = sGlobalEntryTables->Iter(); !iter.Done(); iter.Next()) {
|
||||
keys.AppendElement(iter.Key());
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < keys.Length(); ++i) {
|
||||
DoomStorageEntries(keys[i], nullptr, true, false, nullptr);
|
||||
}
|
||||
|
||||
// Passing null as a load info means to evict all contexts.
|
||||
// EvictByContext() respects the entry pinning. EvictAll() does not.
|
||||
rv = CacheFileIOManager::EvictByContext(nullptr, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsICacheService> serv =
|
||||
do_GetService(NS_CACHESERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = serv->EvictEntries(nsICache::STORE_ANYWHERE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
{
|
||||
mozilla::MutexAutoLock forcedValidEntriesLock(mForcedValidEntriesLock);
|
||||
mForcedValidEntries.Clear();
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(!mShutdown, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsTArray<nsCString> keys;
|
||||
for (auto iter = sGlobalEntryTables->Iter(); !iter.Done(); iter.Next()) {
|
||||
keys.AppendElement(iter.Key());
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < keys.Length(); ++i) {
|
||||
DoomStorageEntries(keys[i], nullptr, true, false, nullptr);
|
||||
}
|
||||
|
||||
// Passing null as a load info means to evict all contexts.
|
||||
// EvictByContext() respects the entry pinning. EvictAll() does not.
|
||||
rv = CacheFileIOManager::EvictByContext(nullptr, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -907,13 +850,8 @@ NS_IMETHODIMP CacheStorageService::AsyncGetDiskConsumption(
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
rv = CacheIndex::AsyncGetDiskConsumption(aObserver);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
rv = _OldGetDiskConsumption::Get(aObserver);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = CacheIndex::AsyncGetDiskConsumption(aObserver);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -922,20 +860,8 @@ NS_IMETHODIMP CacheStorageService::GetIoTarget(nsIEventTarget** aEventTarget)
|
||||
{
|
||||
NS_ENSURE_ARG(aEventTarget);
|
||||
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
nsCOMPtr<nsIEventTarget> ioTarget = CacheFileIOManager::IOTarget();
|
||||
ioTarget.forget(aEventTarget);
|
||||
}
|
||||
else {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsICacheService> serv =
|
||||
do_GetService(NS_CACHESERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = serv->GetCacheIOTarget(aEventTarget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsCOMPtr<nsIEventTarget> ioTarget = CacheFileIOManager::IOTarget();
|
||||
ioTarget.forget(aEventTarget);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ public:
|
||||
void DropPrivateBrowsingEntries();
|
||||
|
||||
// Takes care of deleting any pending trashes for both cache1 and cache2
|
||||
// as well as the cache directory of an inactive cache version when requested.
|
||||
static void CleaupCacheDirectories(uint32_t aVersion, uint32_t aActive);
|
||||
// as well as old cache directory.
|
||||
static void CleaupCacheDirectories();
|
||||
|
||||
static CacheStorageService* Self() { return sSelf; }
|
||||
static nsISupports* SelfISupports() { return static_cast<nsICacheStorageService*>(Self()); }
|
||||
|
@ -105,16 +105,14 @@ nsAboutCache::Channel::Init(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
"<label><input id='anon' type='checkbox'/> Anonymous</label>\n"
|
||||
);
|
||||
|
||||
if (CacheObserver::UseNewCache()) {
|
||||
// Visit scoping by browser and appid is not implemented for
|
||||
// the old cache, simply don't add these controls.
|
||||
// The appid/inbrowser entries are already mixed in the default
|
||||
// view anyway.
|
||||
mBuffer.AppendLiteral(
|
||||
"<label><input id='appid' type='text' size='6'/> AppID</label>\n"
|
||||
"<label><input id='inbrowser' type='checkbox'/> In Browser Element</label>\n"
|
||||
);
|
||||
}
|
||||
// Visit scoping by browser and appid is not implemented for
|
||||
// the old cache, simply don't add these controls.
|
||||
// The appid/inbrowser entries are already mixed in the default
|
||||
// view anyway.
|
||||
mBuffer.AppendLiteral(
|
||||
"<label><input id='appid' type='text' size='6'/> AppID</label>\n"
|
||||
"<label><input id='inbrowser' type='checkbox'/> In Browser Element</label>\n"
|
||||
);
|
||||
|
||||
mBuffer.AppendLiteral(
|
||||
"<label><input id='submit' type='button' value='Update' onclick='navigate()'/></label>\n"
|
||||
|
@ -188,14 +188,6 @@ nsAboutCacheEntry::Channel::OpenCacheEntry(nsIURI *uri)
|
||||
mEnhanceId, getter_AddRefs(mCacheURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!CacheObserver::UseNewCache() &&
|
||||
mLoadInfo->IsPrivate() &&
|
||||
mStorageName.EqualsLiteral("disk")) {
|
||||
// The cache v1 is storing all private entries in the memory-only
|
||||
// cache, so it would not be found in the v1 disk cache.
|
||||
mStorageName = NS_LITERAL_CSTRING("memory");
|
||||
}
|
||||
|
||||
return OpenCacheEntry();
|
||||
}
|
||||
|
||||
@ -307,20 +299,6 @@ nsAboutCacheEntry::Channel::OnCacheEntryAvailable(nsICacheEntry *entry,
|
||||
mWaitingForData = false;
|
||||
if (entry) {
|
||||
rv = WriteCacheEntryDescription(entry);
|
||||
} else if (!CacheObserver::UseNewCache() &&
|
||||
!mLoadInfo->IsPrivate() &&
|
||||
mStorageName.EqualsLiteral("memory")) {
|
||||
// If we were not able to find the entry in the memory storage
|
||||
// try again in the disk storage.
|
||||
// This is a workaround for cache v1: when an originally disk
|
||||
// cache entry is recreated as memory-only, it's clientID doesn't
|
||||
// change and we cannot find it in "HTTP-memory-only" session.
|
||||
// "Disk" cache storage looks at "HTTP".
|
||||
mStorageName = NS_LITERAL_CSTRING("disk");
|
||||
rv = OpenCacheEntry();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
rv = WriteCacheEntryUnavailable();
|
||||
}
|
||||
|
@ -156,17 +156,12 @@ enum CacheDisposition {
|
||||
void
|
||||
AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss)
|
||||
{
|
||||
if (!CacheObserver::UseNewCache()) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2, hitOrMiss);
|
||||
}
|
||||
else {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2_V2, hitOrMiss);
|
||||
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2_V2, hitOrMiss);
|
||||
|
||||
int32_t experiment = CacheObserver::HalfLifeExperiment();
|
||||
if (experiment > 0 && hitOrMiss == kCacheMissed) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_CACHE_MISS_HALFLIFE_EXPERIMENT_2,
|
||||
experiment - 1);
|
||||
}
|
||||
int32_t experiment = CacheObserver::HalfLifeExperiment();
|
||||
if (experiment > 0 && hitOrMiss == kCacheMissed) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_CACHE_MISS_HALFLIFE_EXPERIMENT_2,
|
||||
experiment - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5534,27 +5529,11 @@ nsHttpChannel::InstallCacheListener(int64_t offset)
|
||||
do_CreateInstance(kStreamListenerTeeCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIEventTarget> cacheIOTarget;
|
||||
if (!CacheObserver::UseNewCache()) {
|
||||
nsCOMPtr<nsICacheStorageService> serv(services::GetCacheStorageService());
|
||||
if (!serv) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
serv->GetIoTarget(getter_AddRefs(cacheIOTarget));
|
||||
}
|
||||
|
||||
if (!cacheIOTarget) {
|
||||
LOG(("nsHttpChannel::InstallCacheListener sync tee %p rv=%" PRIx32
|
||||
" cacheIOTarget=%p",
|
||||
tee.get(), static_cast<uint32_t>(rv), cacheIOTarget.get()));
|
||||
rv = tee->Init(mListener, out, nullptr);
|
||||
} else {
|
||||
LOG(("nsHttpChannel::InstallCacheListener async tee %p", tee.get()));
|
||||
rv = tee->InitAsync(mListener, cacheIOTarget, out, nullptr);
|
||||
}
|
||||
|
||||
LOG(("nsHttpChannel::InstallCacheListener sync tee %p rv=%" PRIx32,
|
||||
tee.get(), static_cast<uint32_t>(rv)));
|
||||
rv = tee->Init(mListener, out, nullptr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = tee;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ function asyncOpenCacheEntry(key, where, flags, lci, callback, appcache)
|
||||
|
||||
function syncWithCacheIOThread(callback, force)
|
||||
{
|
||||
if (!newCacheBackEndUsed() || force) {
|
||||
if (force) {
|
||||
asyncOpenCacheEntry(
|
||||
"http://nonexistententry/", "disk", Ci.nsICacheStorage.OPEN_READONLY, null,
|
||||
function(status, entry) {
|
||||
|
@ -3,16 +3,6 @@ var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
var Cr = Components.results;
|
||||
|
||||
function newCacheBackEndUsed()
|
||||
{
|
||||
var cache1srv = Components.classes["@mozilla.org/network/cache-service;1"]
|
||||
.getService(Components.interfaces.nsICacheService);
|
||||
var cache2srv = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
||||
.getService(Components.interfaces.nsICacheStorageService);
|
||||
|
||||
return cache1srv.cacheIOTarget != cache2srv.ioTarget;
|
||||
}
|
||||
|
||||
var callbacks = new Array();
|
||||
|
||||
// Expect an existing entry
|
||||
@ -133,17 +123,15 @@ OpenCallback.prototype =
|
||||
|
||||
if (this.behavior & COMPLETE) {
|
||||
LOG_C2(this, "onCacheEntryCheck DONE, return RECHECK_AFTER_WRITE_FINISHED");
|
||||
if (newCacheBackEndUsed()) {
|
||||
// Specific to the new backend because of concurrent read/write:
|
||||
// when a consumer returns RECHECK_AFTER_WRITE_FINISHED from onCacheEntryCheck
|
||||
// the cache calls this callback again after the entry write has finished.
|
||||
// This gives the consumer a chance to recheck completeness of the entry
|
||||
// again.
|
||||
// Thus, we reset state as onCheck would have never been called.
|
||||
this.onCheckPassed = false;
|
||||
// Don't return RECHECK_AFTER_WRITE_FINISHED on second call of onCacheEntryCheck.
|
||||
this.behavior &= ~COMPLETE;
|
||||
}
|
||||
// Specific to the new backend because of concurrent read/write:
|
||||
// when a consumer returns RECHECK_AFTER_WRITE_FINISHED from onCacheEntryCheck
|
||||
// the cache calls this callback again after the entry write has finished.
|
||||
// This gives the consumer a chance to recheck completeness of the entry
|
||||
// again.
|
||||
// Thus, we reset state as onCheck would have never been called.
|
||||
this.onCheckPassed = false;
|
||||
// Don't return RECHECK_AFTER_WRITE_FINISHED on second call of onCacheEntryCheck.
|
||||
this.behavior &= ~COMPLETE;
|
||||
return Ci.nsICacheEntryOpenCallback.RECHECK_AFTER_WRITE_FINISHED;
|
||||
}
|
||||
|
||||
@ -310,10 +298,7 @@ VisitCallback.prototype =
|
||||
{
|
||||
LOG_C2(this, "onCacheStorageInfo: num=" + num + ", size=" + consumption);
|
||||
do_check_eq(this.num, num);
|
||||
if (newCacheBackEndUsed()) {
|
||||
// Consumption is as expected only in the new backend
|
||||
do_check_eq(this.consumption, consumption);
|
||||
}
|
||||
do_check_eq(this.consumption, consumption);
|
||||
if (!this.entries)
|
||||
this.notify();
|
||||
},
|
||||
|
@ -75,11 +75,6 @@ function run_test()
|
||||
do_get_profile();
|
||||
evict_cache_entries();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since it depends on the new APIs.");
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
|
||||
cache_storage = getCacheStorage("disk");
|
||||
|
@ -86,11 +86,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since it depends on the new APIs.");
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
|
||||
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, delay the actual write
|
||||
asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW|DONTFILL, "a1m", "a1d", function(entry) {
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
var storage = getCacheStorage("disk");
|
||||
var entry = storage.openTruncate(createURI("http://new1/"), "");
|
||||
do_check_true(!!entry);
|
||||
|
@ -13,9 +13,7 @@ function run_test()
|
||||
do_execute_soon(function() {
|
||||
syncWithCacheIOThread(function() {
|
||||
|
||||
var expectedConsumption = newCacheBackEndUsed()
|
||||
? 4096
|
||||
: 48;
|
||||
var expectedConsumption = 4096;
|
||||
|
||||
storage.asyncVisitStorage(
|
||||
// Test should store 4 entries
|
||||
@ -32,7 +30,7 @@ function run_test()
|
||||
);
|
||||
});
|
||||
});
|
||||
}, !newCacheBackEndUsed());
|
||||
});
|
||||
|
||||
asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "a1m", "a1d", function(entry) {
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add entry to the memory storage
|
||||
var mc = new MultipleCallbacks(5, function() {
|
||||
// Check it's there by visiting the storage
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// First check how behaves the memory storage.
|
||||
|
||||
asyncOpenCacheEntry("http://mem-first/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW|DOOMED, "b1m", "b1d", function(entry) {
|
||||
entry.asyncDoom(
|
||||
|
@ -10,9 +10,7 @@ function run_test()
|
||||
new VisitCallback(0, 0, [], function() {
|
||||
var storage = getCacheStorage("disk");
|
||||
|
||||
var expectedConsumption = newCacheBackEndUsed()
|
||||
? 2048
|
||||
: 24;
|
||||
var expectedConsumption = 2048;
|
||||
|
||||
storage.asyncVisitStorage(
|
||||
new VisitCallback(2, expectedConsumption, ["http://a/", "http://b/"], function() {
|
||||
@ -25,7 +23,7 @@ function run_test()
|
||||
);
|
||||
})
|
||||
);
|
||||
}, !newCacheBackEndUsed());
|
||||
});
|
||||
|
||||
asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "m2m", "m2d", function(entry) {
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
var mc = new MultipleCallbacks(3, function() {
|
||||
var storage = getCacheStorage("disk");
|
||||
storage.asyncEvictStorage(
|
||||
@ -25,7 +20,7 @@ function run_test()
|
||||
);
|
||||
})
|
||||
);
|
||||
}, !newCacheBackEndUsed());
|
||||
});
|
||||
|
||||
asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "m2m", "m2d", function(entry) {
|
||||
|
@ -17,7 +17,7 @@ function run_test()
|
||||
new OpenCallback(NORMAL|COMPLETE|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
|
||||
if (beforeReading) {
|
||||
++order;
|
||||
do_check_eq(order, newCacheBackEndUsed() ? 3 : 1);
|
||||
do_check_eq(order, 3);
|
||||
} else {
|
||||
mc.fired();
|
||||
}
|
||||
@ -27,7 +27,7 @@ function run_test()
|
||||
new OpenCallback(NORMAL|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
|
||||
if (beforeReading) {
|
||||
++order;
|
||||
do_check_eq(order, newCacheBackEndUsed() ? 1 : 2);
|
||||
do_check_eq(order, 1);
|
||||
} else {
|
||||
mc.fired();
|
||||
}
|
||||
@ -37,7 +37,7 @@ function run_test()
|
||||
new OpenCallback(NORMAL|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
|
||||
if (beforeReading) {
|
||||
++order;
|
||||
do_check_eq(order, newCacheBackEndUsed() ? 2 : 3);
|
||||
do_check_eq(order, 2);
|
||||
} else {
|
||||
mc.fired();
|
||||
}
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, write
|
||||
asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "21m", "21d", function(entry) {
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, write but expect it to fail, since other callback will recreate (and doom)
|
||||
// the first entry before it opens output stream (note: in case of problems the DOOMED flag
|
||||
// can be removed, it is not the test failure when opening the output stream on recreated entry.
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, write
|
||||
asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "206m", "206part1-", function(entry) {
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, write
|
||||
asyncOpenCacheEntry("http://r200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW, "200m1", "200part1a-", function(entry) {
|
||||
|
@ -4,11 +4,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create and check an entry anon disk storage
|
||||
asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
|
||||
new OpenCallback(NEW, "an1", "an1", function(entry) {
|
||||
|
@ -4,8 +4,7 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
function checkNewBackEnd()
|
||||
{
|
||||
var mc = new MultipleCallbacks(2, function() {
|
||||
var storage = getCacheStorage("disk", LoadContextInfo.default);
|
||||
storage.asyncVisitStorage(
|
||||
new VisitCallback(1, 1024, ["http://an2/"], function() {
|
||||
@ -19,28 +18,8 @@ function run_test()
|
||||
}),
|
||||
true
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function checkOldBackEnd()
|
||||
{
|
||||
syncWithCacheIOThread(function() {
|
||||
var storage = getCacheStorage("disk", LoadContextInfo.default);
|
||||
storage.asyncVisitStorage(
|
||||
new VisitCallback(2, 24, ["http://an2/"], function() {
|
||||
storage = getCacheStorage("disk", LoadContextInfo.anonymous);
|
||||
storage.asyncVisitStorage(
|
||||
new VisitCallback(0, 0, ["http://an2/"], function() {
|
||||
finish_cache2_test();
|
||||
}),
|
||||
true
|
||||
);
|
||||
}),
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
var mc = new MultipleCallbacks(2, newCacheBackEndUsed() ? checkNewBackEnd : checkOldBackEnd, !newCacheBackEndUsed());
|
||||
|
||||
asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
|
||||
new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
|
||||
|
@ -4,11 +4,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
const kChunkSize = (256 * 1024);
|
||||
|
||||
var payload = "";
|
||||
|
@ -4,11 +4,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mc = new MultipleCallbacks(2, function() {
|
||||
var mem = getCacheStorage("memory");
|
||||
var disk = getCacheStorage("disk");
|
||||
|
@ -18,11 +18,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
|
||||
|
@ -2,11 +2,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, but never write and never mark valid
|
||||
asyncOpenCacheEntry("http://no-data/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||
new OpenCallback(NEW|METAONLY|DONTSETVALID|WAITFORWRITE, "meta", "", function(entry) {
|
||||
|
@ -4,11 +4,6 @@ function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mc = new MultipleCallbacks(2, function() {
|
||||
finish_cache2_test();
|
||||
});
|
||||
|
@ -65,11 +65,6 @@ function run_test()
|
||||
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1);
|
||||
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
|
||||
|
||||
|
@ -60,11 +60,6 @@ function run_test()
|
||||
|
||||
do_get_profile();
|
||||
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
|
||||
return;
|
||||
}
|
||||
|
||||
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1);
|
||||
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open for write, write
|
||||
asyncOpenCacheEntry("http://a/", "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, LoadContextInfo.default,
|
||||
|
@ -1,10 +1,7 @@
|
||||
function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var lci = LoadContextInfo.default;
|
||||
|
||||
// Open a pinned entry for write, write
|
||||
|
@ -26,10 +26,6 @@ function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
|
||||
function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var lci = LoadContextInfo.default;
|
||||
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);
|
||||
|
@ -22,10 +22,7 @@ function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
|
||||
function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var lci = LoadContextInfo.default;
|
||||
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);
|
||||
do_check_true(testingInterface);
|
||||
|
@ -7,10 +7,6 @@ function run_test()
|
||||
LoadContextInfo.custom(false, { userContextId: 3 })];
|
||||
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mc = new MultipleCallbacks(8, function() {
|
||||
do_execute_soon(function() {
|
||||
|
@ -89,10 +89,7 @@ async function run_all_tests() {
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
if (!newCacheBackEndUsed()) {
|
||||
do_check_true(true, "This test checks only cache2 specific behavior.");
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
|
||||
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
|
||||
|
@ -1981,14 +1981,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Open -> first byte of reply received (ms)"
|
||||
},
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Open -> cache read start (ms)"
|
||||
},
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -1997,14 +1989,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Open -> cache read start (ms), [cache2]"
|
||||
},
|
||||
"HTTP_PAGE_CACHE_READ_TIME": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Cache read time (ms)"
|
||||
},
|
||||
"HTTP_PAGE_CACHE_READ_TIME_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2021,14 +2005,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Positive cache validation time (ms)"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Overall load time - all (ms)"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2037,14 +2013,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Overall load time - all (ms) [cache2]"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Overall load time - cache hits (ms)"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2053,14 +2021,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Overall load time - cache hits (ms) [cache2]"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP page channel: Overall load time - network (ms)"
|
||||
},
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2129,14 +2089,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Open -> first byte of reply received (ms)"
|
||||
},
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Open -> cache read start (ms)"
|
||||
},
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2145,14 +2097,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Open -> cache read start (ms) [cache2]"
|
||||
},
|
||||
"HTTP_SUB_CACHE_READ_TIME": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Cache read time (ms)"
|
||||
},
|
||||
"HTTP_SUB_CACHE_READ_TIME_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2169,14 +2113,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Positive cache validation time (ms)"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Overall load time - all (ms)"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2185,14 +2121,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Overall load time - all (ms) [cache2]"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Overall load time - cache hits (ms)"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -2201,14 +2129,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Overall load time - cache hits (ms) [cache2]"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"description": "HTTP subitem channel: Overall load time - network (ms)"
|
||||
},
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
@ -3007,13 +2927,6 @@
|
||||
"kind": "boolean",
|
||||
"description": "Fraction of sockets that used a nsConnectionEntry with history - size 300."
|
||||
},
|
||||
"HTTP_CACHE_DISPOSITION_2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": 5,
|
||||
"description": "HTTP Cache Hit, Reval, Failed-Reval, Miss"
|
||||
},
|
||||
"HTTP_CACHE_DISPOSITION_2_V2": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
|
@ -253,7 +253,6 @@
|
||||
"HTTPCONNMGR_TOTAL_SPECULATIVE_CONN",
|
||||
"HTTPCONNMGR_UNUSED_SPECULATIVE_CONN",
|
||||
"HTTPCONNMGR_USED_SPECULATIVE_CONN",
|
||||
"HTTP_CACHE_DISPOSITION_2",
|
||||
"HTTP_CACHE_DISPOSITION_2_V2",
|
||||
"HTTP_CACHE_ENTRY_ALIVE_TIME",
|
||||
"HTTP_CACHE_ENTRY_RELOAD_TIME",
|
||||
@ -263,18 +262,13 @@
|
||||
"HTTP_DISK_CACHE_OVERHEAD",
|
||||
"HTTP_KBREAD_PER_CONN",
|
||||
"HTTP_OFFLINE_CACHE_DOCUMENT_LOAD",
|
||||
"HTTP_PAGE_CACHE_READ_TIME",
|
||||
"HTTP_PAGE_CACHE_READ_TIME_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_V2",
|
||||
"HTTP_PAGE_DNS_ISSUE_TIME",
|
||||
"HTTP_PAGE_DNS_LOOKUP_TIME",
|
||||
"HTTP_PAGE_FIRST_SENT_TO_LAST_RECEIVED",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
|
||||
@ -285,18 +279,13 @@
|
||||
"HTTP_REQUEST_PER_PAGE_FROM_CACHE",
|
||||
"HTTP_SUBITEM_FIRST_BYTE_LATENCY_TIME",
|
||||
"HTTP_SUBITEM_OPEN_LATENCY_TIME",
|
||||
"HTTP_SUB_CACHE_READ_TIME",
|
||||
"HTTP_SUB_CACHE_READ_TIME_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD",
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED",
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET",
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD_V2",
|
||||
"HTTP_SUB_DNS_ISSUE_TIME",
|
||||
"HTTP_SUB_DNS_LOOKUP_TIME",
|
||||
"HTTP_SUB_FIRST_SENT_TO_LAST_RECEIVED",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_SENT",
|
||||
@ -928,7 +917,6 @@
|
||||
"HTTPCONNMGR_TOTAL_SPECULATIVE_CONN",
|
||||
"HTTPCONNMGR_UNUSED_SPECULATIVE_CONN",
|
||||
"HTTPCONNMGR_USED_SPECULATIVE_CONN",
|
||||
"HTTP_CACHE_DISPOSITION_2",
|
||||
"HTTP_CACHE_DISPOSITION_2_V2",
|
||||
"HTTP_CACHE_ENTRY_ALIVE_TIME",
|
||||
"HTTP_CACHE_ENTRY_RELOAD_TIME",
|
||||
@ -939,18 +927,13 @@
|
||||
"HTTP_DISK_CACHE_OVERHEAD",
|
||||
"HTTP_KBREAD_PER_CONN",
|
||||
"HTTP_OFFLINE_CACHE_DOCUMENT_LOAD",
|
||||
"HTTP_PAGE_CACHE_READ_TIME",
|
||||
"HTTP_PAGE_CACHE_READ_TIME_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_NET_V2",
|
||||
"HTTP_PAGE_COMPLETE_LOAD_V2",
|
||||
"HTTP_PAGE_DNS_ISSUE_TIME",
|
||||
"HTTP_PAGE_DNS_LOOKUP_TIME",
|
||||
"HTTP_PAGE_FIRST_SENT_TO_LAST_RECEIVED",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
|
||||
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
|
||||
@ -963,18 +946,13 @@
|
||||
"HTTP_SAW_QUIC_ALT_PROTOCOL",
|
||||
"HTTP_SUBITEM_FIRST_BYTE_LATENCY_TIME",
|
||||
"HTTP_SUBITEM_OPEN_LATENCY_TIME",
|
||||
"HTTP_SUB_CACHE_READ_TIME",
|
||||
"HTTP_SUB_CACHE_READ_TIME_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD",
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED",
|
||||
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET",
|
||||
"HTTP_SUB_COMPLETE_LOAD_NET_V2",
|
||||
"HTTP_SUB_COMPLETE_LOAD_V2",
|
||||
"HTTP_SUB_DNS_ISSUE_TIME",
|
||||
"HTTP_SUB_DNS_LOOKUP_TIME",
|
||||
"HTTP_SUB_FIRST_SENT_TO_LAST_RECEIVED",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
|
||||
"HTTP_SUB_OPEN_TO_FIRST_SENT",
|
||||
|
Loading…
Reference in New Issue
Block a user