Bug 858170 - Fix a NULL dereference in the debugger; r=jorendorff

This commit is contained in:
Eddy Bruel 2013-04-04 21:22:23 +02:00
parent 4b988f6ada
commit 9e21f79bc8
2 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1,7 @@
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
dbg.onNewScript = function (s) {
throw new Error();
};
dbg.uncaughtExceptionHook = function () {}
g.eval("2 * 3");

View File

@ -554,7 +554,7 @@ Debugger::slowPathOnLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool frame
RootedValue completion(cx);
if (!dbg->newCompletionValue(cx, status, value, &completion)) {
status = dbg->handleUncaughtException(ac, NULL, false);
status = dbg->handleUncaughtException(ac, false);
break;
}
@ -1007,7 +1007,7 @@ Debugger::fireNewScript(JSContext *cx, HandleScript script)
JSObject *dsobj = wrapScript(cx, script);
if (!dsobj) {
handleUncaughtException(ac, NULL, false);
handleUncaughtException(ac, false);
return;
}
@ -1015,7 +1015,7 @@ Debugger::fireNewScript(JSContext *cx, HandleScript script)
argv[0].setObject(*dsobj);
Value rv;
if (!Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv))
handleUncaughtException(ac, NULL, true);
handleUncaughtException(ac, true);
}
JSTrapStatus
@ -1306,7 +1306,7 @@ Debugger::fireNewGlobalObject(JSContext *cx, Handle<GlobalObject *> global, Muta
AutoArrayRooter argvRooter(cx, ArrayLength(argv), argv);
argv[0].setObject(*global);
if (!wrapDebuggeeValue(cx, argvRooter.handleAt(0)))
return handleUncaughtException(ac, NULL, false);
return handleUncaughtException(ac, false);
RootedValue rv(cx);
bool ok = Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, rv.address());