зеркало из https://github.com/mozilla/gecko-dev.git
Mostly submitted patches...
- Fix bug 54264 from Jon Smirl <jonsmirl@mediaone.net> Do cleanup of thread local storage on main thread. - Fix bug 54275 from Jon Smirl <jonsmirl@mediaone.net> Release components in shell before shutting down xpcom - Fix bug 54310 from Jon Smirl <jonsmirl@mediaone.net> Call JS_DestroyScript in xpcshell and js.c - Fix bug 54352 from Jon Smirl <jonsmirl@mediaone.net> Cleanup what static data we can in xpclog. - Initial fix of bug 54473 Don't report warnings as errors in wrapped JS calls. - Fix bug 54462 from Mark Hammond <MarkH@ActiveState.com> Fix jband's stupid use of uint8 for method indexes. - Use environment rather than prefs for #ifdef'd debug options - Don't report NS_ERROR_FACTORY_REGISTER_AGAIN as an error. r=mccabe@netscape.com a=jband@netscape.com
This commit is contained in:
Родитель
6ee197932d
Коммит
b1a79c9199
|
@ -314,8 +314,10 @@ Process(JSContext *cx, JSObject *obj, char *filename)
|
|||
}
|
||||
ungetc(ch, fh);
|
||||
script = JS_CompileFileHandle(cx, obj, filename, fh);
|
||||
if (script)
|
||||
if (script) {
|
||||
(void)JS_ExecuteScript(cx, obj, script, &result);
|
||||
JS_DestroyScript(cx, script);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -475,8 +475,10 @@ Process(JSContext *cx, JSObject *obj, char *filename)
|
|||
}
|
||||
ungetc(ch, fh);
|
||||
script = JS_CompileFileHandle(cx, obj, filename, fh);
|
||||
if (script)
|
||||
if (script) {
|
||||
(void)JS_ExecuteScript(cx, obj, script, &result);
|
||||
JS_DestroyScript(cx, script);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -830,6 +832,8 @@ main(int argc, char **argv)
|
|||
xpc->SyncJSContexts();
|
||||
xpc->DebugDump(4);
|
||||
xpc = nsnull; // force nsCOMPtr to Release the service
|
||||
secman = nsnull;
|
||||
rtsvc = nsnull;
|
||||
|
||||
rv = NS_ShutdownXPCOM( NULL );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
|
||||
|
|
|
@ -143,32 +143,29 @@ nsXPConnect::nsXPConnect()
|
|||
(nsISupports **)&mContextStack);
|
||||
|
||||
#ifdef XPC_TOOLS_SUPPORT
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
if(prefs)
|
||||
{
|
||||
const char* filename = PR_GetEnv("MOZILLA_JS_PROFILER_OUTPUT");
|
||||
if(filename)
|
||||
{
|
||||
char* filename;
|
||||
if(NS_SUCCEEDED(prefs->CopyCharPref("xpctools.profiler.outputfilename",
|
||||
&filename)) && filename)
|
||||
|
||||
mProfilerOutputFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
|
||||
if(mProfilerOutputFile &&
|
||||
NS_SUCCEEDED(mProfilerOutputFile->InitWithPath(filename)))
|
||||
{
|
||||
mProfilerOutputFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
|
||||
if(mProfilerOutputFile &&
|
||||
NS_SUCCEEDED(mProfilerOutputFile->InitWithPath(filename)))
|
||||
mProfiler = do_GetService(XPCTOOLS_PROFILER_CONTRACTID);
|
||||
if(mProfiler)
|
||||
{
|
||||
mProfiler = do_GetService(XPCTOOLS_PROFILER_CONTRACTID);
|
||||
if(mProfiler)
|
||||
if(NS_SUCCEEDED(mProfiler->Start()))
|
||||
{
|
||||
if(NS_SUCCEEDED(mProfiler->Start()))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("***** profiling JavaScript. Output to: %s\n",
|
||||
filename);
|
||||
printf("***** profiling JavaScript. Output to: %s\n",
|
||||
filename);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCRT::free(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -193,6 +190,9 @@ nsXPConnect::~nsXPConnect()
|
|||
//
|
||||
xpcPerThreadData::CleanupAllThreads();
|
||||
|
||||
// shutdown the logging system
|
||||
XPC_LOG_FINISH();
|
||||
|
||||
if(mThrower)
|
||||
delete mThrower;
|
||||
if(mRuntime)
|
||||
|
@ -282,6 +282,8 @@ nsXPConnect::ReleaseXPConnectSingleton()
|
|||
#ifdef XPC_DUMP_AT_SHUTDOWN
|
||||
if (0 != cnt) {
|
||||
printf("*** dangling reference to nsXPConnect: refcnt=%d\n", cnt);
|
||||
} else {
|
||||
printf("+++ XPConnect had no dangling references.\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -61,13 +61,26 @@ static PRBool Init()
|
|||
g_Spaces[SPACE_COUNT] = 0;
|
||||
if(!g_LogMod || !g_Spaces || !PR_LOG_TEST(g_LogMod,1))
|
||||
{
|
||||
g_InitState = -1;
|
||||
g_InitState = 1;
|
||||
XPC_Log_Finish();
|
||||
return PR_FALSE;
|
||||
}
|
||||
g_InitState = 1;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
XPC_Log_Finish()
|
||||
{
|
||||
if(g_InitState == 1)
|
||||
{
|
||||
delete g_Spaces;
|
||||
// we'd like to properly cleanup the LogModule, but nspr owns that
|
||||
g_LogMod = nsnull;
|
||||
}
|
||||
g_InitState = -1;
|
||||
}
|
||||
|
||||
void
|
||||
XPC_Log_print(const char *fmt, ...)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#define XPC_LOG_INDENT() XPC_Log_Indent()
|
||||
#define XPC_LOG_OUTDENT() XPC_Log_Outdent()
|
||||
#define XPC_LOG_CLEAR_INDENT() XPC_Log_Clear_Indent()
|
||||
#define XPC_LOG_FINISH() XPC_Log_Finish()
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
|
@ -75,6 +76,7 @@ PRBool XPC_Log_Check(int i);
|
|||
void XPC_Log_Indent();
|
||||
void XPC_Log_Outdent();
|
||||
void XPC_Log_Clear_Indent();
|
||||
void XPC_Log_Finish();
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
@ -88,6 +90,7 @@ JS_END_EXTERN_C
|
|||
#define XPC_LOG_INDENT() ((void)0)
|
||||
#define XPC_LOG_OUTDENT() ((void)0)
|
||||
#define XPC_LOG_CLEAR_INDENT() ((void)0)
|
||||
#define XPC_LOG_FINISH() ((void)0)
|
||||
#endif
|
||||
|
||||
#endif /* xpclog_h___ */
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "xpcjsid.h"
|
||||
#include "prlong.h"
|
||||
#include "prmem.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "prthread.h"
|
||||
|
@ -93,7 +94,6 @@
|
|||
|
||||
#ifdef XPC_TOOLS_SUPPORT
|
||||
#include "nsIXPCToolsProfiler.h"
|
||||
#include "nsIPref.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -981,7 +981,7 @@ private:
|
|||
const nsXPTMethodInfo* method,
|
||||
const XPCNativeMemberDescriptor* desc,
|
||||
const nsXPTParamInfo& param,
|
||||
uint8 vtblIndex,
|
||||
uint16 vtblIndex,
|
||||
uint8 paramIndex,
|
||||
SizeMode mode,
|
||||
nsXPTCVariant* dispatchParams,
|
||||
|
@ -991,7 +991,7 @@ private:
|
|||
const nsXPTMethodInfo* method,
|
||||
const XPCNativeMemberDescriptor* desc,
|
||||
const nsXPTParamInfo& param,
|
||||
uint8 vtblIndex,
|
||||
uint16 vtblIndex,
|
||||
uint8 paramIndex,
|
||||
const nsXPTType& datum_type,
|
||||
nsXPTCVariant* dispatchParams,
|
||||
|
|
|
@ -417,5 +417,7 @@ xpcPerThreadData::CleanupAllThreads()
|
|||
for(xpcPerThreadData* cur = gThreads; cur; cur = cur->mNextThread)
|
||||
cur->Cleanup();
|
||||
}
|
||||
if(gTLSIndex != BAD_TLS_INDEX)
|
||||
PR_SetThreadPrivate(gTLSIndex, nsnull);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,13 @@ static inline void DoPostScriptEvaluated(JSContext* cx)
|
|||
#endif /* XPCONNECT_STANDALONE */
|
||||
}
|
||||
|
||||
// It turns out that some errors may be not worth reporting. So, this
|
||||
// this function is factored out to manage that.
|
||||
static inline JSBool IsReportableErrorCode(nsresult code)
|
||||
{
|
||||
return NS_FAILED(code) && code != NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
|
||||
// static
|
||||
nsXPCWrappedJSClass*
|
||||
nsXPCWrappedJSClass::GetNewOrUsedClass(XPCJSRuntime* rt,
|
||||
|
@ -348,6 +355,22 @@ xpcWrappedJSErrorReporter(JSContext *cx, const char *message,
|
|||
{
|
||||
nsIXPCException* e;
|
||||
XPCContext* xpcc;
|
||||
|
||||
if(report)
|
||||
{
|
||||
// If it is an exception report, then we can just deal with the
|
||||
// exception later (if not caught in the JS code).
|
||||
if(JSREPORT_IS_EXCEPTION(report->flags))
|
||||
return;
|
||||
|
||||
if(JSREPORT_IS_WARNING(report->flags))
|
||||
{
|
||||
// XXX printf the warning.
|
||||
// XXX send the warning to the console service.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(nsnull != (e = XPCConvert::JSErrorToXPCException(cx, message,
|
||||
nsnull, nsnull, report)) &&
|
||||
nsnull != (xpcc = nsXPConnect::GetContext(cx)))
|
||||
|
@ -833,7 +856,7 @@ pre_call_clean_up:
|
|||
nsresult e_result;
|
||||
if(NS_SUCCEEDED(xpc_exception->GetResult(&e_result)))
|
||||
{
|
||||
if(NS_FAILED(e_result))
|
||||
if(IsReportableErrorCode(e_result))
|
||||
{
|
||||
static const char line[] =
|
||||
"************************************************************\n";
|
||||
|
|
|
@ -432,7 +432,7 @@ nsXPCWrappedNativeClass::GetArraySizeFromParam(
|
|||
const nsXPTMethodInfo* method,
|
||||
const XPCNativeMemberDescriptor* desc,
|
||||
const nsXPTParamInfo& param,
|
||||
uint8 vtblIndex,
|
||||
uint16 vtblIndex,
|
||||
uint8 paramIndex,
|
||||
SizeMode mode,
|
||||
nsXPTCVariant* dispatchParams,
|
||||
|
@ -475,7 +475,7 @@ nsXPCWrappedNativeClass::GetInterfaceTypeFromParam(
|
|||
const nsXPTMethodInfo* method,
|
||||
const XPCNativeMemberDescriptor* desc,
|
||||
const nsXPTParamInfo& param,
|
||||
uint8 vtblIndex,
|
||||
uint16 vtblIndex,
|
||||
uint8 paramIndex,
|
||||
const nsXPTType& datum_type,
|
||||
nsXPTCVariant* dispatchParams,
|
||||
|
@ -544,7 +544,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx,
|
|||
uint8 requiredArgs;
|
||||
uint8 paramCount;
|
||||
jsval src;
|
||||
uint8 vtblIndex;
|
||||
uint16 vtblIndex;
|
||||
nsresult invokeResult;
|
||||
nsID* conditional_iid = nsnull;
|
||||
uintN err;
|
||||
|
|
Загрузка…
Ссылка в новой задаче