From 894a77ccc4822fef62d80da196f7b6d9560a4dbd Mon Sep 17 00:00:00 2001 From: "dougt%meer.net" Date: Thu, 15 Sep 2005 19:53:01 +0000 Subject: [PATCH] Make XPCOM broadcast any LoadLibrary Load() error failures. b=308716 r=bsmedberg git-svn-id: svn://10.0.0.236/trunk@180308 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpcom/components/nsNativeComponentLoader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index 9da34e5e1ba..19c94d5c7ce 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -87,6 +87,17 @@ nsNativeComponentLoader::nsNativeComponentLoader() : NS_IMPL_THREADSAFE_ISUPPORTS1(nsNativeComponentLoader, nsIComponentLoader) + +static void BroadcastLoadFailure(nsDll *dll) +{ + nsCOMPtr fs; + dll->GetDllSpec(getter_AddRefs(fs)); + + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); + if (observerService) + observerService->NotifyObservers(fs, "xpcom-loader", NS_LITERAL_STRING("Load Failed").get()); +} + NS_IMETHODIMP nsNativeComponentLoader::GetFactory(const nsIID & aCID, const char *aLocation, @@ -130,6 +141,8 @@ nsNativeComponentLoader::GetFactory(const nsIID & aCID, DumpLoadError(dll, "GetFactory", errorMsg); + BroadcastLoadFailure(dll); + return NS_ERROR_FAILURE; } } @@ -390,6 +403,8 @@ nsNativeComponentLoader::SelfRegisterDll(nsDll *dll, DumpLoadError(dll, "SelfRegisterDll", errorMsg); + BroadcastLoadFailure(dll); + return NS_ERROR_FAILURE; }