Enabling GRE support in the mozilla client. r=chak, sr=darin, b=173262

This commit is contained in:
dougt%netscape.com 2003-01-16 19:25:47 +00:00
Родитель 5302be6eba
Коммит 23b3fe29ca
5 изменённых файлов: 91 добавлений и 52 удалений

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

@ -36,6 +36,8 @@ MOZ_WINCONSOLE=0
endif
endif
DEFINES += -DXPCOM_GLUE
MODULE = apprunner
REQUIRES = xpcom \
xpconnect \
@ -91,26 +93,25 @@ CPPSRCS = \
showOSAlert.cpp \
$(NULL)
ifneq ($(OS_ARCH),WINNT)
CPPSRCS += nsSigHandlers.cpp
endif
XP_LIBS = \
$(EXTRA_DSO_LDOPTS) \
$(EXTRA_DSO_LIBS) \
ifneq ($(OS_ARCH),WINNT)
STACKWALK_SRC_LCSRCS = \
nsStackFrameUnix.cpp \
nsStackFrameUnix.h \
$(NULL)
ifndef BUILD_STATIC_LIBS
STACKWALK_CPPSRCS := $(addprefix $(topsrcdir)/xpcom/base/, $(STACKWALK_SRC_LCSRCS))
EXTRA_DSO_LIBS += gkgfx
ifdef MOZ_OJI
ifeq ($(OS_ARCH),WINNT)
EXTRA_DSO_LIBS += jsj$(MOZ_BITS)$(VERSION_NUMBER)
else
EXTRA_DSO_LIBS += jsj
endif
CPPSRCS += nsSigHandlers.cpp nsStackFrameUnix.cpp
endif
LIBS = $(EXTRA_DSO_LDOPTS) \
$(EXTRA_DSO_LIBS) \
$(NULL)
ifndef BUILD_STATIC_LIBS
ifdef NS_TRACE_MALLOC
EXTRA_DSO_LIBS += tracemalloc
endif
@ -128,26 +129,32 @@ EXTRA_DSO_LDOPTS+= -L$(DEPTH)/dist/lib/components
endif # !WINNT
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
REQUIRES += $(STATIC_REQUIRES)
XP_LIBS += $(STATIC_EXTRA_LIBS)
LIBS += $(STATIC_EXTRA_LIBS)
endif
XP_LIBS += \
# If you change anything that mozilla links to, please talk to dougt@netscape.com
LIBS += \
$(MOZ_JS_LIBS) \
$(XPCOM_LIBS) \
$(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)string_obsolete_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)embedstring.$(LIB_SUFFIX) \
$(NSPR_LIBS) \
$(NULL)
ifdef MOZ_JPROF
XP_LIBS += -ljprof
LIBS += -ljprof
endif
LIBS = $(XP_LIBS)
ifdef GC_LEAK_DETECTOR
LIBS += -lboehm
endif
ifdef MOZ_DEMANGLE_SYMBOLS
LIBS += -liberty
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
CPPSRCS += nsNativeAppSupportBeOS.cpp
@ -251,8 +258,19 @@ endif
endif
endif
SRCS_IN_OBJDIR=1
ifneq ($(OS_ARCH),WINNT)
GARBAGE += $(STACKWALK_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
endif
include $(topsrcdir)/config/rules.mk
ifneq ($(OS_ARCH),WINNT)
export:: $(STACKWALK_CPPSRCS)
$(INSTALL) $^ .
endif
ifdef BUILD_STATIC_LIBS
include $(topsrcdir)/config/static-rules.mk
endif
@ -382,3 +400,4 @@ README_FILE = $(topsrcdir)/README.txt
libs::
$(INSTALL) $(README_FILE) $(DIST)/bin
$(INSTALL) $(topsrcdir)/LICENSE $(DIST)/bin

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

@ -36,10 +36,12 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsXPCOMGlue.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsIComponentRegistrar.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
@ -407,7 +409,6 @@ static nsresult GetNativeAppSupport(nsINativeAppSupport** aNativeApp)
return *aNativeApp ? NS_OK : NS_ERROR_FAILURE;
}
/*
* This routine translates the nsresult into a platform specific return
* code for the application...
@ -930,6 +931,14 @@ static nsresult ConvertToUnicode(nsString& aCharset, const char* inString, nsASt
return rv;
}
static PRBool IsAscii(const char *aString) {
while(*aString) {
if( 0x80 & *aString)
return PR_FALSE;
aString++;
}
return PR_TRUE;
}
static nsresult OpenBrowserWindow(PRInt32 height, PRInt32 width)
{
@ -955,7 +964,7 @@ static nsresult OpenBrowserWindow(PRInt32 height, PRInt32 width)
#endif /* DEBUG_CMD_LINE */
nsAutoString url;
if (nsCRT::IsAscii(urlToLoad)) {
if (IsAscii(urlToLoad)) {
url.AssignWithConversion(urlToLoad);
}
else {
@ -1358,11 +1367,12 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp )
// _Always_ autoreg if we're in a debug build, under the assumption
// that people are busily modifying components and will be angry if
// their changes aren't noticed.
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
nsnull /* default */);
nsCOMPtr<nsIComponentRegistrar> registrar;
NS_GetComponentRegistrar(getter_AddRefs(registrar));
registrar->AutoRegister(nsnull);
registrar = nsnull;
#endif
NS_TIMELINE_ENTER("startupNotifier");
// Start up the core services:
@ -1841,12 +1851,22 @@ int main(int argc, char* argv[])
#ifdef MOZ_JPROF
setupProfilingStuff();
#endif
NS_TIMELINE_MARK("GRE_Startup...");
nsresult rv = GRE_Startup();
NS_TIMELINE_MARK("...GRE_Startup done");
if (NS_FAILED(rv)) {
// We should be displaying a dialog here with the reason why we failed.
NS_WARNING("GRE_Startup failed");
return 1;
}
// Try to allocate "native app support."
// Note: this object is not released here. It is passed to main1 which
// has responsibility to release it.
nsINativeAppSupport *nativeApp = 0;
nsresult rv = NS_CreateNativeAppSupport(&nativeApp);
rv = NS_CreateNativeAppSupport(&nativeApp);
// See if we can run.
if (nativeApp)
@ -1880,13 +1900,6 @@ int main(int argc, char* argv[])
splash->Show();
}
NS_TIMELINE_MARK("InitXPCom...");
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
NS_TIMELINE_MARK("...InitXPCOM done");
#ifdef MOZ_ENABLE_XREMOTE
// handle -remote now that xpcom is fired up
int remoterv;
@ -1894,10 +1907,9 @@ int main(int argc, char* argv[])
// argused will be true if someone tried to use a -remote flag. We
// always exit in that case.
remoterv = HandleRemoteArguments(argc, argv, &argused);
if (argused) {
if (NS_SUCCEEDED(rv)) // only call NS_ShutdownXPCOM if Init succeeded.
NS_ShutdownXPCOM(nsnull);
return remoterv;
GRE_Shutdown();
}
#endif
@ -1909,10 +1921,8 @@ int main(int argc, char* argv[])
NS_ASSERTION(NS_SUCCEEDED(rv), "DoOnShutdown failed");
}
if (NS_SUCCEEDED(rv)) { // only call NS_ShutdownXPCOM if Init succeeded.
rv = NS_ShutdownXPCOM(nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
}
rv = GRE_Shutdown();
NS_ASSERTION(NS_SUCCEEDED(rv), "GRE_Shutdown failed");
return TranslateReturnValue(mainResult);
}

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

@ -56,6 +56,7 @@
#include "nsIPromptService.h"
#include "nsNetCID.h"
#include "nsIObserverService.h"
#include "nsXPCOM.h"
#include "nsPaletteOS2.h"
// These are needed to load a URL in a browser window.
@ -2053,10 +2054,14 @@ nsNativeAppSupportOS2::GetCmdLineArgs( LPBYTE request, nsICmdLineService **aResu
// OK, now create nsICmdLineService object from argc/argv.
static NS_DEFINE_CID( kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID );
rv = nsComponentManager::CreateInstance( kCmdLineServiceCID,
0,
NS_GET_IID( nsICmdLineService ),
(void**)aResult );
nsCOMPtr<nsIComponentManager> compMgr;
NS_GetComponentManager(getter_AddRefs(compMgr));
rv = compMgr->CreateInstance( kCmdLineServiceCID,
0,
NS_GET_IID( nsICmdLineService ),
(void**)aResult );
if ( NS_FAILED( rv ) || NS_FAILED( ( rv = (*aResult)->Initialize( argc, argv ) ) ) ) {
#if MOZ_DEBUG_DDE
printf( "Error creating command line service = 0x%08X (argc=%d, argv=0x%08X)\n", (int)rv, (int)argc, (void*)argv );
@ -2302,7 +2307,7 @@ nsNativeAppSupportOS2::StartServerMode() {
// Create the array for the arguments.
nsCOMPtr<nsISupportsArray> argArray;
NS_NewISupportsArray( getter_AddRefs( argArray ) );
nsCOMPtr<nsISupportsArray> argArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
if ( !argArray ) {
return NS_OK;
}

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

@ -68,6 +68,7 @@
#include "nsIPromptService.h"
#include "nsNetCID.h"
#include "nsIObserverService.h"
#include "nsXPCOM.h"
// These are needed to load a URL in a browser window.
#include "nsIDOMLocation.h"
@ -2009,10 +2010,14 @@ nsNativeAppSupportWin::GetCmdLineArgs( LPBYTE request, nsICmdLineService **aResu
// OK, now create nsICmdLineService object from argc/argv.
static NS_DEFINE_CID( kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID );
rv = nsComponentManager::CreateInstance( kCmdLineServiceCID,
0,
NS_GET_IID( nsICmdLineService ),
(void**)aResult );
nsCOMPtr<nsIComponentManager> compMgr;
NS_GetComponentManager(getter_AddRefs(compMgr));
rv = compMgr->CreateInstance( kCmdLineServiceCID,
0,
NS_GET_IID( nsICmdLineService ),
(void**)aResult );
if ( NS_FAILED( rv ) || NS_FAILED( ( rv = (*aResult)->Initialize( argc, argv ) ) ) ) {
#if MOZ_DEBUG_DDE
printf( "Error creating command line service = 0x%08X (argc=%d, argv=0x%08X)\n", (int)rv, (int)argc, (void*)argv );
@ -2491,8 +2496,7 @@ nsNativeAppSupportWin::StartServerMode() {
}
// Create the array for the arguments.
nsCOMPtr<nsISupportsArray> argArray;
NS_NewISupportsArray( getter_AddRefs( argArray ) );
nsCOMPtr<nsISupportsArray> argArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
if ( !argArray ) {
return NS_OK;
}

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

@ -114,6 +114,7 @@ void abnormal_exit_handler(int signum)
#include <unistd.h>
#include "nsISupportsUtils.h"
#include "nsStackFrameUnix.h"
void
ah_crap_handler(int signum)
@ -134,7 +135,7 @@ ah_crap_handler(int signum)
#endif
printf("Stack:\n");
nsTraceRefcnt::WalkTheStack(stdout);
DumpStackToFile(stdout);
printf("Sleeping for 5 minutes.\n");
printf("Type 'gdb %s %d' to attatch your debugger to this thread.\n",