Bug 262189: fix JS component loader's error reporting up to be less-often

useless.  Also some warning fixes for gcc and quelling some
	    spew for myself.  r+sr=brendan.
This commit is contained in:
shaver%mozilla.org 2004-10-12 03:37:20 +00:00
parent 0341aafe1e
commit d01ecae854
5 changed files with 22 additions and 16 deletions

View File

@ -944,18 +944,24 @@ mozJSComponentLoader::ModuleForLocation(const char *registryLocation,
JSCLAutoErrorReporterSetter aers(cx, Reporter);
jsval argv[2], retval;
argv[0] = OBJECT_TO_JSVAL(cm_jsobj);
argv[1] = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, registryLocation));
if (!JS_CallFunctionName(cx, global, "NSGetModule", 2, argv,
&retval)) {
#ifdef DEBUG_shaver_off
fprintf(stderr, "mJCL: NSGetModule failed for %s\n",
registryLocation);
#endif
jsval argv[2], retval, NSGetModule_val;
if (!JS_GetProperty(cx, global, "NSGetModule", &NSGetModule_val) ||
JSVAL_IS_VOID(NSGetModule_val) {
return nsnull;
}
if (JS_TypeOfValue(cx, NSGetModule_val) != JSTYPE_FUNCTION) {
JS_ReportError(cx, "%s has NSGetModule property that is not a function",
registryLocation);
return nsnull;
}
argv[0] = OBJECT_TO_JSVAL(cm_jsobj);
argv[1] = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, registryLocation));
if (!JS_CallFunctionValue(cx, global, NSGetModule_val, 2, argv, &retval))
return nsnull;
#ifdef DEBUG_shaver_off
JSString *s = JS_ValueToString(cx, retval);
fprintf(stderr, "mJCL: %s::NSGetModule returned %s\n",

View File

@ -415,11 +415,11 @@ static const int tab_width = 2;
static void PrintObjectBasics(JSObject* obj)
{
if(OBJ_IS_NATIVE(obj))
printf("%#p 'native' <%s>",
obj,
printf("%p 'native' <%s>",
(void *)obj,
((JSClass*)(obj->slots[JSSLOT_CLASS]-1))->name);
else
printf("%#p 'host'", obj);
printf("%p 'host'", (void *)obj);
}

View File

@ -134,7 +134,7 @@
// Note that one would not normally turn *any* of these on in a non-DEBUG build.
#if defined(DEBUG_jband) || defined(DEBUG_jst) || defined(DEBUG_dbradley) || defined(DEBUG_shaver) || defined(DEBUG_dbaron) || defined(DEBUG_timeless)
#if defined(DEBUG_jband) || defined(DEBUG_jst) || defined(DEBUG_dbradley) || defined(DEBUG_shaver_no) || defined(DEBUG_dbaron) || defined(DEBUG_timeless)
#define DEBUG_xpc_hacker
#endif

View File

@ -59,7 +59,7 @@ nsJSRuntimeServiceImpl::~nsJSRuntimeServiceImpl() {
{
JS_DestroyRuntime(mRuntime);
JS_ShutDown();
#ifdef DEBUG_shaver
#ifdef DEBUG_shaver_off
fprintf(stderr, "nJRSI: destroyed runtime %p\n", (void *)mRuntime);
#endif
}
@ -108,7 +108,7 @@ nsJSRuntimeServiceImpl::GetRuntime(JSRuntime **runtime)
return NS_ERROR_OUT_OF_MEMORY;
}
*runtime = mRuntime;
#ifdef DEBUG_shaver
#ifdef DEBUG_shaver_off
fprintf(stderr, "nJRSI: returning %p\n", (void *)mRuntime);
#endif
return NS_OK;

View File

@ -2939,7 +2939,7 @@ void DEBUG_ReportWrapperThreadSafetyError(XPCCallContext& ccx,
JS_smprintf_free(wrapperDump);
}
else
printf(" %s\n wrapper @ 0x%p\n", msg, wrapper);
printf(" %s\n wrapper @ 0x%p\n", msg, (void *)wrapper);
printf(" JS call stack...\n");
xpc_DumpJSStack(ccx, JS_TRUE, JS_TRUE, JS_TRUE);