From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../tests/debug/Frame-evalWithBindings-09.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js (limited to 'js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js') diff --git a/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js new file mode 100644 index 0000000000..c697903193 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js @@ -0,0 +1,27 @@ +// evalWithBindings code is debuggee code, so it can trip the debugger. It nests! +var g = newGlobal({newCompartment: true}); +var dbg = new Debugger(g); +var f1; +var hits = 0; +dbg.onDebuggerStatement = function (frame) { + f1 = frame; + + // This trips the onExceptionUnwind hook. + var x = frame.evalWithBindings("wrongSpeling", {rightSpelling: 2}).throw; + + assertEq(frame.evalWithBindings("exc.name", {exc: x}).return, "ReferenceError"); + hits++; +}; +dbg.onExceptionUnwind = function (frame, exc) { + assertEq(frame !== f1, true); + + // f1's environment does not contain the binding for the first evalWithBindings call. + assertEq(f1.eval("rightSpelling").return, "dependent"); + assertEq(f1.evalWithBindings("n + rightSpelling", {n: "in"}).return, "independent"); + + // frame's environment does contain the binding. + assertEq(frame.eval("rightSpelling").return, 2); + assertEq(frame.evalWithBindings("rightSpelling + three", {three: 3}).return, 5); + hits++; +}; +g.eval("(function () { var rightSpelling = 'dependent'; debugger; })();"); -- cgit v1.2.3