From b8445a29e47bf8b7a277dc0bd07b4902bccebaed Mon Sep 17 00:00:00 2001 From: "bsmedberg%covad.net" Date: Wed, 7 Sep 2005 17:31:00 +0000 Subject: [PATCH] Bug 303279 - Use "special" localstore when in safe mode, r=mconnor+darin git-svn-id: svn://10.0.0.236/trunk@179805 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/toolkit/xre/nsAppRunner.h | 5 +++++ mozilla/toolkit/xre/nsXREDirProvider.cpp | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mozilla/toolkit/xre/nsAppRunner.h b/mozilla/toolkit/xre/nsAppRunner.h index d514230b30a..86eeb0e69f4 100644 --- a/mozilla/toolkit/xre/nsAppRunner.h +++ b/mozilla/toolkit/xre/nsAppRunner.h @@ -60,6 +60,11 @@ // this key will not be available. #define NS_APP_PROFILE_DIR_STARTUP "ProfDS" +// This directory service key is a lot like NS_APP_LOCALSTORE_50_FILE, +// but it is always the "main" localstore file, even when we're in safe mode +// and we load localstore from somewhere else. +#define NS_LOCALSTORE_UNSAFE_FILE "LStoreS" + class nsACString; struct nsXREAppData; struct nsStaticModuleInfo; diff --git a/mozilla/toolkit/xre/nsXREDirProvider.cpp b/mozilla/toolkit/xre/nsXREDirProvider.cpp index 999313ebbed..4005d45885d 100644 --- a/mozilla/toolkit/xre/nsXREDirProvider.cpp +++ b/mozilla/toolkit/xre/nsXREDirProvider.cpp @@ -262,10 +262,20 @@ nsXREDirProvider::GetFile(const char* aProperty, PRBool* aPersistent, rv = mProfileDir->Clone(getter_AddRefs(file)); rv |= file->AppendNative(NS_LITERAL_CSTRING("prefs.js")); } - else if (!strcmp(aProperty, NS_APP_LOCALSTORE_50_FILE)) { + else if (!strcmp(aProperty, NS_LOCALSTORE_UNSAFE_FILE)) { rv = mProfileDir->Clone(getter_AddRefs(file)); rv |= file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf")); - EnsureProfileFileExists(file); + } + else if (!strcmp(aProperty, NS_APP_LOCALSTORE_50_FILE)) { + rv = mProfileDir->Clone(getter_AddRefs(file)); + if (gSafeMode) { + rv |= file->AppendNative(NS_LITERAL_CSTRING("localstore-safe.rdf")); + file->Remove(PR_FALSE); + } + else { + rv |= file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf")); + EnsureProfileFileExists(file); + } } else if (!strcmp(aProperty, NS_APP_HISTORY_50_FILE)) { rv = mProfileDir->Clone(getter_AddRefs(file));