summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js')
-rw-r--r--js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js27
1 files changed, 27 insertions, 0 deletions
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; })();");