From bb2fdb112709f5af309768af92e58bad7c4a002b Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Thu, 24 Feb 2005 06:52:50 +0000 Subject: [PATCH] Force the window datasource to be initialized at app startup so that it recognizes all windows. Bug 169378. Patch by neil@parkwaycc.co.uk, r+sr=me. --- xpfe/components/build/nsModule.cpp | 18 +++++++++++++++++- xpfe/components/build2/nsModule.cpp | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/xpfe/components/build/nsModule.cpp b/xpfe/components/build/nsModule.cpp index 49376a70796..4edc0aac64b 100644 --- a/xpfe/components/build/nsModule.cpp +++ b/xpfe/components/build/nsModule.cpp @@ -151,6 +151,22 @@ UnregisterProc(nsIComponentManager *aCompMgr, "application/http-index-format", PR_TRUE); } +static NS_METHOD +RegisterWindowDS(nsIComponentManager *aCompMgr, + nsIFile *aPath, + const char *registryLocation, + const char *componentType, + const nsModuleComponentInfo *info) +{ + nsresult rv; + nsCOMPtr catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); + if (NS_FAILED(rv)) return rv; + + return catman->AddCategoryEntry("app-startup", "Window Data Source", + "service," NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", + PR_TRUE, PR_TRUE, nsnull); +} + static const nsModuleComponentInfo components[] = { { "Directory Viewer", NS_DIRECTORYVIEWERFACTORY_CID, "@mozilla.org/xpfe/http-index-format-factory-constructor", @@ -218,7 +234,7 @@ static const nsModuleComponentInfo components[] = { { "nsWindowDataSource", NS_WINDOWDATASOURCE_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", - nsWindowDataSourceConstructor }, + nsWindowDataSourceConstructor, RegisterWindowDS }, #if defined(XP_WIN) #if !defined(MOZ_PHOENIX) && !defined(MOZ_XULRUNNER) { NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID, NS_IURLWIDGET_CONTRACTID, diff --git a/xpfe/components/build2/nsModule.cpp b/xpfe/components/build2/nsModule.cpp index 1553bea0e0b..53ad8013281 100644 --- a/xpfe/components/build2/nsModule.cpp +++ b/xpfe/components/build2/nsModule.cpp @@ -79,6 +79,22 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsHooks) #endif // Windows +static NS_METHOD +RegisterWindowDS(nsIComponentManager *aCompMgr, + nsIFile *aPath, + const char *registryLocation, + const char *componentType, + const nsModuleComponentInfo *info) +{ + nsresult rv; + nsCOMPtr catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); + if (NS_FAILED(rv)) return rv; + + return catman->AddCategoryEntry("app-startup", "Window Data Source", + "service," NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", + PR_TRUE, PR_TRUE, nsnull); +} + static const nsModuleComponentInfo components[] = { { "Download Manager", NS_DOWNLOADMANAGER_CID, NS_DOWNLOADMANAGER_CONTRACTID, @@ -110,7 +126,7 @@ static const nsModuleComponentInfo components[] = { { "nsWindowDataSource", NS_WINDOWDATASOURCE_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", - nsWindowDataSourceConstructor }, + nsWindowDataSourceConstructor, RegisterWindowDS }, }; NS_IMPL_NSGETMODULE(application, components)