зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1563023 - Part 8: Ignore quota cache if the user loads the same profile in different builds; r=asuth
This patch adds support for quota cache invalidation if the profile is loaded in different builds. Differential Revision: https://phabricator.services.mozilla.com/D39673 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3e97ea2f34
Коммит
f4d108788b
|
@ -1840,6 +1840,7 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
|
||||
namespace {
|
||||
|
||||
bool gInvalidateQuotaCache = false;
|
||||
StaticAutoPtr<nsString> gBaseDirPath;
|
||||
StaticAutoPtr<nsCString> gBuildId;
|
||||
|
||||
|
@ -6480,6 +6481,15 @@ nsresult QuotaManager::EnsureStorageIsInitialized() {
|
|||
}
|
||||
}
|
||||
|
||||
if (cacheUsable && gInvalidateQuotaCache) {
|
||||
rv = InvalidateCache(connection);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
gInvalidateQuotaCache = false;
|
||||
}
|
||||
|
||||
mStorageConnection = connection;
|
||||
mCacheUsable = cacheUsable;
|
||||
|
||||
|
@ -7175,6 +7185,11 @@ bool QuotaManager::ParseOrigin(const nsACString& aOrigin, nsCString& aSpec,
|
|||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void QuotaManager::InvalidateQuotaCache() {
|
||||
gInvalidateQuotaCache = true;
|
||||
}
|
||||
|
||||
uint64_t QuotaManager::LockedCollectOriginsForEviction(
|
||||
uint64_t aMinSizeToBeFreed, nsTArray<RefPtr<DirectoryLockImpl>>& aLocks) {
|
||||
mQuotaMutex.AssertCurrentThreadOwns();
|
||||
|
|
|
@ -430,6 +430,8 @@ class QuotaManager final : public BackgroundThreadObject {
|
|||
static bool ParseOrigin(const nsACString& aOrigin, nsCString& aSpec,
|
||||
OriginAttributes* aAttrs);
|
||||
|
||||
static void InvalidateQuotaCache();
|
||||
|
||||
private:
|
||||
QuotaManager();
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
#include "nsIWidget.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsAppShellCID.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
|
@ -320,6 +321,7 @@ using namespace mozilla::startup;
|
|||
using mozilla::Unused;
|
||||
using mozilla::dom::ContentChild;
|
||||
using mozilla::dom::ContentParent;
|
||||
using mozilla::dom::quota::QuotaManager;
|
||||
using mozilla::intl::LocaleService;
|
||||
using mozilla::scache::StartupCache;
|
||||
|
||||
|
@ -4170,6 +4172,8 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
|||
bool startupCacheValid = true;
|
||||
|
||||
if (!cachesOK || !versionOK) {
|
||||
QuotaManager::InvalidateQuotaCache();
|
||||
|
||||
startupCacheValid = RemoveComponentRegistries(mProfD, mProfLD, false);
|
||||
|
||||
// Rewrite compatibility.ini to match the current build. The next run
|
||||
|
|
Загрузка…
Ссылка в новой задаче