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 fbf1398801
commit 6e12c675dc
3 changed files with 7 additions and 4 deletions

View File

@ -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<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);

View File

@ -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 };

View File

@ -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;