From a554f1f1f7f7968a9ea7732c4e5f6cd78ddd229a Mon Sep 17 00:00:00 2001 From: Bjarne Herland Date: Thu, 16 Sep 2010 20:21:16 -0700 Subject: [PATCH] Bug 596808 - nsDiskCacheDevice::Init() called twice resulting in no disk cache available r=jduell, a=betaN --- netwerk/cache/nsCacheService.cpp | 4 ++-- netwerk/cache/nsDiskCache.h | 2 +- netwerk/cache/nsDiskCacheDevice.cpp | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index d6c2526c9a7b..cef42500fb83 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -109,7 +109,7 @@ static const char * observerList[] = { "profile-before-change", - "profile-after-change", + "profile-do-change", NS_XPCOM_SHUTDOWN_OBSERVER_ID, NS_PRIVATE_BROWSING_SWITCH_TOPIC }; @@ -364,7 +364,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject, nsCacheService::OnProfileShutdown(!strcmp("shutdown-cleanse", data.get())); - } else if (!strcmp("profile-after-change", topic)) { + } else if (!strcmp("profile-do-change", topic)) { // profile after change mHaveProfile = PR_TRUE; nsCOMPtr branch = do_GetService(NS_PREFSERVICE_CONTRACTID); diff --git a/netwerk/cache/nsDiskCache.h b/netwerk/cache/nsDiskCache.h index 7983acd43863..7d2b0bcfb51d 100644 --- a/netwerk/cache/nsDiskCache.h +++ b/netwerk/cache/nsDiskCache.h @@ -53,7 +53,7 @@ class nsDiskCache { public: enum { - kCurrentVersion = 0x0001000D // format = 16 bits major version/16 bits minor version + kCurrentVersion = 0x0001000E // format = 16 bits major version/16 bits minor version }; enum { kData, kMetaData }; diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 10e6096696fc..1a5e922057ab 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -368,7 +368,10 @@ nsDiskCacheDevice::Init() nsresult rv; - NS_ENSURE_TRUE(!Initialized(), NS_ERROR_FAILURE); + if (Initialized()) { + NS_ERROR("Disk cache already initialized!"); + return NS_ERROR_UNEXPECTED; + } if (!mCacheDirectory) return NS_ERROR_FAILURE;