diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index c62b5319c51..dc703564ade 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -42,7 +42,6 @@ #include "nsCOMPtr.h" #include "nsHashtable.h" #include "nsIFactory.h" -#include "nsIRegistry.h" #include "nsSupportsPrimitives.h" #include "nsIObserver.h" #include "nsComponentManager.h" @@ -62,6 +61,9 @@ Leaf nodes are strings. */ +// this function is not public yet, hence it is externed here. +extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result); + static NS_IMETHODIMP @@ -270,8 +272,6 @@ nsCategoryManager::AddCategoryEntry( const char *aCategoryName, nsCStringKey entryNameKey(aEntryName); category->Put(&entryNameKey, entry); - // this function is not public yet, hence it is externed here. - extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result); nsCOMPtr mgr; NS_GetComponentLoaderManager(getter_AddRefs(mgr)); if (mgr) @@ -303,6 +303,12 @@ nsCategoryManager::DeleteCategoryEntry( const char *aCategoryName, { nsCStringKey entryKey(aEntryName); category->RemoveAndDelete(&entryKey); + + nsCOMPtr mgr; + NS_GetComponentLoaderManager(getter_AddRefs(mgr)); + if (mgr) + mgr->FlushPersistentStore(PR_FALSE); + } return NS_OK; @@ -315,6 +321,11 @@ nsCategoryManager::DeleteCategory( const char *aCategoryName ) { NS_ASSERTION(aCategoryName, "aCategoryName is NULL!"); + nsCOMPtr mgr; + NS_GetComponentLoaderManager(getter_AddRefs(mgr)); + if (mgr) + mgr->FlushPersistentStore(PR_FALSE); + // QUESTION: consider whether this should be an error nsCStringKey categoryKey(aCategoryName); return RemoveAndDelete(&categoryKey) ? NS_OK : NS_ERROR_NOT_AVAILABLE;