Add a passing test for Debugger.Frame.prototype.live.
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 05 Jul 2011 10:08:49 -0500
changeset 74500 74a28915c87cd1e249ab0415a9269691f5b6b600
parent 74499 252709231d206c34f5d7b3e86981a9fa0772f179
child 74501 d3b7501084d11b4d067596d6002694430b8b8a6b
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone7.0a1
Add a passing test for Debugger.Frame.prototype.live.
js/src/jit-test/tests/debug/Frame-live-05.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Frame-live-05.js
@@ -0,0 +1,31 @@
+// frame.live is false for frames removed after their compartments stopped being debuggees.
+
+var g1 = newGlobal('new-compartment');
+var g2 = newGlobal('new-compartment');
+var dbg = Debugger(g1, g2);
+var hits = 0;
+var snapshot = [];
+dbg.hooks = {
+    debuggerHandler: function (frame) {
+	if (hits++ === 0) {
+	    assertEq(frame.eval("x();"), null);
+	} else {
+	    for (var f = frame; f; f = f.older) {
+		if (f.type === "call")
+		    snapshot.push(f);
+	    }
+	    dbg.removeDebuggee(g2);
+	    return null;
+	}
+    }
+};
+
+g1.eval("function z() { debugger; }");
+g2.z = g1.z;
+g2.eval("function y() { z(); }");
+g2.eval("function x() { y(); }");
+assertEq(g2.eval("debugger; 'ok';"), "ok");
+assertEq(hits, 2);
+assertEq(snapshot.length, 3);
+for (var i = 0; i < snapshot.length; i++)
+    assertEq(snapshot[i].live, false);