Bug 1234387 - DumpBacktrace: Check the result of Sprinter::init function. r=bbouvier

This commit is contained in:
Nicolas B. Pierron 2015-12-23 14:10:26 +00:00
parent 011504aa73
commit f04ed1dfd7

View File

@ -3639,8 +3639,11 @@ js::DumpInterpreterFrame(JSContext* cx, InterpreterFrame* start)
JS_FRIEND_API(void)
js::DumpBacktrace(JSContext* cx)
{
Sprinter sprinter(cx);
sprinter.init();
Sprinter sprinter(cx, false);
if (!sprinter.init()) {
fprintf(stdout, "js::DumpBacktrace: OOM\n");
return;
}
size_t depth = 0;
for (AllFramesIter i(cx); !i.done(); ++i, ++depth) {
const char* filename = JS_GetScriptFilename(i.script());
@ -3659,9 +3662,8 @@ js::DumpBacktrace(JSContext* cx)
}
fprintf(stdout, "%s", sprinter.string());
#ifdef XP_WIN32
if (IsDebuggerPresent()) {
if (IsDebuggerPresent())
OutputDebugStringA(sprinter.string());
}
#endif
}