Make the JS debugger consistently ignore dummy frames, fixing an assertion failure. Bug 678086, r=jimb.
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 27 Jan 2012 14:16:22 -0600
changeset 85614 42408569a696aebdfeb742bca0b035553de3b25c
parent 85613 2108d51be2e7ac67f0f79bdf97969e5a160f7380
child 85615 88145df4191a6b4d29f552c2f0e5f05c21545cc2
push id21940
push userjdrew@mozilla.com
push dateSun, 29 Jan 2012 02:43:03 +0000
treeherdermozilla-central@ec666b4c8d84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs678086
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Make the JS debugger consistently ignore dummy frames, fixing an assertion failure. Bug 678086, r=jimb.
js/src/jit-test/tests/debug/Debugger-getNewestFrame-03.js
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-getNewestFrame-03.js
@@ -0,0 +1,9 @@
+// Debugger.prototype.getNewestFrame() ignores dummy frames.
+// See bug 678086.
+
+var g = newGlobal('new-compartment');
+g.f = function () { return dbg.getNewestFrame(); };
+var dbg = new Debugger;
+var gw = dbg.addDebuggee(g);
+var fw = gw.getOwnPropertyDescriptor("f").value;
+assertEq(fw.call().return, null);
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -2555,17 +2555,17 @@ DebuggerFrame_getThis(JSContext *cx, uin
 }
 
 static JSBool
 DebuggerFrame_getOlder(JSContext *cx, uintN argc, Value *vp)
 {
     THIS_FRAME(cx, argc, vp, "get this", args, thisobj, thisfp);
     Debugger *dbg = Debugger::fromChildJSObject(thisobj);
     for (StackFrame *fp = thisfp->prev(); fp; fp = fp->prev()) {
-        if (!fp->isDummyFrame() && dbg->observesFrame(fp))
+        if (dbg->observesFrame(fp))
             return dbg->getScriptFrame(cx, fp, vp);
     }
     args.rval().setNull();
     return true;
 }
 
 Class DebuggerArguments_class = {
     "Arguments", JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGARGUMENTS_COUNT),
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -478,17 +478,17 @@ bool
 Debugger::observesGlobal(GlobalObject *global) const
 {
     return debuggees.has(global);
 }
 
 bool
 Debugger::observesFrame(StackFrame *fp) const
 {
-    return observesGlobal(&fp->scopeChain().global());
+    return !fp->isDummyFrame() && observesGlobal(&fp->scopeChain().global());
 }
 
 JSTrapStatus
 Debugger::onEnterFrame(JSContext *cx, Value *vp)
 {
     if (cx->compartment->getDebuggees().empty())
         return JSTRAP_CONTINUE;
     return slowPathOnEnterFrame(cx, vp);