Bug 1008418 - Add dumpObject to TestingFunctions.cpp (r=sfink)

This commit is contained in:
Bill McCloskey 2014-05-15 16:16:41 -07:00
parent 5e55b00343
commit c8fdca4d92
2 changed files with 23 additions and 18 deletions

View File

@ -1606,6 +1606,22 @@ DisableTraceLogger(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
#ifdef DEBUG
static bool
DumpObject(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject arg0(cx);
if (!JS_ConvertArguments(cx, args, "o", arg0.address()))
return false;
js_DumpObject(arg0);
args.rval().setUndefined();
return true;
}
#endif
static const JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FN_HELP("gc", ::GC, 0, 0,
"gc([obj] | 'compartment')",
@ -1875,6 +1891,13 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FN_HELP("stopTraceLogger", DisableTraceLogger, 0, 0,
"stopTraceLogger()",
" Stop logging the mainThread."),
#ifdef DEBUG
JS_FN_HELP("dumpObject", DumpObject, 1, 0,
"dumpObject()",
" Dump an internal representation of an object."),
#endif
JS_FS_HELP_END
};

View File

@ -2510,20 +2510,6 @@ DumpHeap(JSContext *cx, unsigned argc, jsval *vp)
return ok;
}
static bool
DumpObject(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject arg0(cx);
if (!JS_ConvertArguments(cx, args, "o", arg0.address()))
return false;
js_DumpObject(arg0);
args.rval().setUndefined();
return true;
}
#endif /* DEBUG */
static bool
@ -4580,10 +4566,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = {
"dissrc([fun])",
" Disassemble functions with source lines."),
JS_FN_HELP("dumpObject", DumpObject, 1, 0,
"dumpObject()",
" Dump an internal representation of an object."),
JS_FN_HELP("notes", Notes, 1, 0,
"notes([fun])",
" Show source notes for functions."),