Handle -register before gtk_init() is called so that an X display is not required for this step.

This commit is contained in:
bryner%brianryner.com 2003-12-04 19:39:40 +00:00
Родитель 1efcceef2f
Коммит 8cc7ca2c47
1 изменённых файлов: 27 добавлений и 18 удалений

Просмотреть файл

@ -1592,6 +1592,33 @@ int main(int argc, char* argv[])
argc = NS_TraceMallocStartupArgs(argc, argv);
#endif
#ifdef MOZ_XUL_APP
// Check for -register, which registers chrome and then exits immediately.
for (int i = 0; i < argc; ++i) {
if (!strcmp(argv[i], "-register")) {
{
nsCOMPtr<nsIDirectoryServiceProvider> provider;
provider = new nsXREDirProvider(aAppData.GetProductName());
NS_ENSURE_TRUE(provider, 1);
nsresult rv = NS_InitXPCOM2(nsnull, nsnull, provider);
NS_ENSURE_SUCCESS(rv, 1);
}
nsCOMPtr<nsIChromeRegistry> chromeReg = do_GetService("@mozilla.org/chrome/chrome-registry;1");
NS_ENSURE_TRUE(chromeReg, 1);
chromeReg->CheckForNewChrome();
chromeReg = 0;
#ifdef XPCOM_GLUE
GRE_Shutdown();
#else
NS_ShutdownXPCOM(nsnull);
#endif
return 0;
}
}
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
// Initialize GTK+1/2 here for splash
#if defined(MOZ_WIDGET_GTK)
@ -1695,24 +1722,6 @@ int main(int argc, char* argv[])
}
#endif
#ifdef MOZ_XUL_APP
// Check for -register, which registers chrome and then exits immediately.
for (int i = 0; i < argc; ++i) {
if (!strcmp(argv[i], "-register")) {
nsCOMPtr<nsIChromeRegistry> chromeReg = do_GetService("@mozilla.org/chrome/chrome-registry;1");
if (chromeReg) {
chromeReg->CheckForNewChrome();
chromeReg = 0;
#ifdef XPCOM_GLUE
GRE_Shutdown();
#else
NS_ShutdownXPCOM(nsnull);
#endif
return 0;
}
}
}
nsresult mainResult = main1(argc, argv, nativeApp ? (nsISupports*)nativeApp : (nsISupports*)splash, aAppData);
#else
nsresult mainResult = main1(argc, argv, nativeApp ? (nsISupports*)nativeApp : (nsISupports*)splash);