separate javascript logging macro

This commit is contained in:
Vincent Sanders 2012-11-06 18:08:39 +00:00
parent 4bd5e23fff
commit 12f874cd92
3 changed files with 16 additions and 10 deletions

View File

@ -36,7 +36,7 @@ void js_initialise(void)
#endif
rt = JS_NewRuntime(8L * 1024L * 1024L);
LOG(("New runtime handle %p", rt));
JSLOG("New runtime handle %p", rt);
/* register script content handler */
javascript_init();
@ -45,7 +45,7 @@ void js_initialise(void)
void js_finalise(void)
{
if (rt != NULL) {
LOG(("destroying runtime handle %p", rt));
JSLOG("destroying runtime handle %p", rt);
JS_DestroyRuntime(rt);
}
JS_ShutDown();
@ -54,10 +54,10 @@ void js_finalise(void)
/* The error reporter callback. */
static void js_reportError(JSContext *cx, const char *message, JSErrorReport *report)
{
LOG(("%s:%u:%s",
JSLOG("%s:%u:%s",
report->filename ? report->filename : "<no filename>",
(unsigned int) report->lineno,
message));
message);
}
jscontext *js_newcontext(void)
@ -76,7 +76,9 @@ jscontext *js_newcontext(void)
JS_SetVersion(cx, JSVERSION_LATEST);
JS_SetErrorReporter(cx, js_reportError);
LOG(("New Context %p", cx));
/*JS_SetGCZeal(cx, 2); */
JSLOG("New Context %p", cx);
return (jscontext *)cx;
}
@ -85,7 +87,7 @@ void js_destroycontext(jscontext *ctx)
{
JSContext *cx = (JSContext *)ctx;
if (cx != NULL) {
LOG(("Destroying Context %p", cx));
JSLOG("Destroying Context %p", cx);
JS_DestroyContext(cx);
}
}
@ -109,7 +111,7 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
window_proto = jsapi_InitClass_Window(cx, NULL);
if (window_proto == NULL) {
LOG(("Unable to initialise window class"));
JSLOG("Unable to initialise window class");
return NULL;
}
@ -122,7 +124,7 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
{
JSContext *cx = (JSContext *)ctx;
/* LOG(("%p \"%s\"",cx ,txt)); */
/* JSLOG("%p \"%s\"",cx ,txt); */
if (ctx == NULL) {
return false;
@ -140,6 +142,7 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
JS_GetGlobalObject(cx),
txt, txtlen,
"<head>", 0, NULL) == JS_TRUE) {
return true;
}

View File

@ -159,5 +159,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#endif
#define JSLOG(args...) LOG((args))
#endif

View File

@ -34,6 +34,8 @@ binding document {
api finalise %{
if (private != NULL) {
JSLOG("dom_document %p in content %p",
private->node, private->htmlc);
dom_node_unref(private->node);
}
%}