Bug 596808 - nsDiskCacheDevice::Init() called twice resulting in no disk cache available r=jduell, a=betaN

This commit is contained in:
Bjarne Herland 2010-09-16 20:21:16 -07:00
parent 06a4f2397e
commit a554f1f1f7
3 changed files with 7 additions and 4 deletions

View File

@ -109,7 +109,7 @@
static const char * observerList[] = { static const char * observerList[] = {
"profile-before-change", "profile-before-change",
"profile-after-change", "profile-do-change",
NS_XPCOM_SHUTDOWN_OBSERVER_ID, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
NS_PRIVATE_BROWSING_SWITCH_TOPIC NS_PRIVATE_BROWSING_SWITCH_TOPIC
}; };
@ -364,7 +364,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
nsCacheService::OnProfileShutdown(!strcmp("shutdown-cleanse", nsCacheService::OnProfileShutdown(!strcmp("shutdown-cleanse",
data.get())); data.get()));
} else if (!strcmp("profile-after-change", topic)) { } else if (!strcmp("profile-do-change", topic)) {
// profile after change // profile after change
mHaveProfile = PR_TRUE; mHaveProfile = PR_TRUE;
nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID); nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);

View File

@ -53,7 +53,7 @@
class nsDiskCache { class nsDiskCache {
public: public:
enum { 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 }; enum { kData, kMetaData };

View File

@ -368,7 +368,10 @@ nsDiskCacheDevice::Init()
nsresult rv; nsresult rv;
NS_ENSURE_TRUE(!Initialized(), NS_ERROR_FAILURE); if (Initialized()) {
NS_ERROR("Disk cache already initialized!");
return NS_ERROR_UNEXPECTED;
}
if (!mCacheDirectory) if (!mCacheDirectory)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;