In JS_PrintTraceThingInfo, only print the contents of JSSLOT_PRIVATE if it represents the class's private rather than the first slot. b=417972 r=igor a=DEBUG-only (not part of the default build)

This commit is contained in:
dbaron@dbaron.org 2008-02-18 22:19:13 -08:00
parent cafaf208a1
commit 6a1479a554

View File

@ -2010,12 +2010,17 @@ JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc,
case JSTRACE_OBJECT:
{
JSObject *obj = (JSObject *)thing;
jsval privateValue = STOBJ_GET_SLOT(obj, JSSLOT_PRIVATE);
void *privateThing = JSVAL_IS_VOID(privateValue)
? NULL
: JSVAL_TO_PRIVATE(privateValue);
JSClass *clasp = STOBJ_GET_CLASS(obj);
if (clasp->flags & JSCLASS_HAS_PRIVATE) {
jsval privateValue = STOBJ_GET_SLOT(obj, JSSLOT_PRIVATE);
void *privateThing = JSVAL_IS_VOID(privateValue)
? NULL
: JSVAL_TO_PRIVATE(privateValue);
JS_snprintf(buf, bufsize, "%p", privateThing);
JS_snprintf(buf, bufsize, "%p", privateThing);
} else {
JS_snprintf(buf, bufsize, "<no private>");
}
break;
}