diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp index c5b60180512c..f0eee745469d 100644 --- a/modules/libpref/src/nsPrefService.cpp +++ b/modules/libpref/src/nsPrefService.cpp @@ -82,9 +82,6 @@ static PRBool isSharingEnabled(); static nsresult openPrefFile(nsIFile* aFile); static nsresult pref_InitInitialObjects(void); - // needed so we can still get the JS Runtime Service during XPCOM shutdown -static nsIJSRuntimeService* gJSRuntimeService = nsnull; // owning reference - //----------------------------------------------------------------------------- /* @@ -105,7 +102,6 @@ nsPrefService::~nsPrefService() { PREF_Cleanup(); NS_IF_RELEASE(mCurrentFile); - NS_IF_RELEASE(gJSRuntimeService); #ifdef MOZ_PROFILESHARING NS_IF_RELEASE(mCurrentSharedFile); diff --git a/modules/libpref/src/nsPrefService.h b/modules/libpref/src/nsPrefService.h index b8de5519483a..4baa279741c7 100644 --- a/modules/libpref/src/nsPrefService.h +++ b/modules/libpref/src/nsPrefService.h @@ -36,6 +36,9 @@ * * ***** END LICENSE BLOCK ***** */ +#ifndef nsPrefService_h__ +#define nsPrefService_h__ + #include "nsIPrefService.h" #include "nsIPrefBranch.h" #include "nsIPrefBranchInternal.h" @@ -82,3 +85,4 @@ private: nsIFile* mCurrentSharedFile; }; +#endif // nsPrefService_h__ diff --git a/modules/libpref/src/nsPrefsFactory.cpp b/modules/libpref/src/nsPrefsFactory.cpp index 01f18e19acb6..490ccdc833a3 100644 --- a/modules/libpref/src/nsPrefsFactory.cpp +++ b/modules/libpref/src/nsPrefsFactory.cpp @@ -40,6 +40,11 @@ #include "nsPrefService.h" #include "nsPrefBranch.h" #include "nsIPref.h" +#include "prefapi.h" + +#ifdef MOZ_PROFILESHARING +#include "nsSharedPrefHandler.h" +#endif // remove this when nsPref goes away extern NS_IMETHODIMP nsPrefConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult); @@ -81,5 +86,15 @@ static const nsModuleComponentInfo components[] = }, }; -NS_IMPL_NSGETMODULE(nsPrefModule, components) +static void +UnloadPrefsModule(nsIModule* unused) +{ + PREF_Cleanup(); +#ifdef MOZ_PROFILESHARING + NS_ASSERTION(!gSharedPrefHandler, "Leaking the shared pref handler (and the prefservice, presumably)."); + gSharedPrefHandler = nsnull; +#endif +} + +NS_IMPL_NSGETMODULE_WITH_DTOR(nsPrefModule, components, UnloadPrefsModule)