diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/debug/breakpoint-12.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/debug/breakpoint-12.js')
-rw-r--r-- | js/src/jit-test/tests/debug/breakpoint-12.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/breakpoint-12.js b/js/src/jit-test/tests/debug/breakpoint-12.js new file mode 100644 index 0000000000..96770c8f26 --- /dev/null +++ b/js/src/jit-test/tests/debug/breakpoint-12.js @@ -0,0 +1,78 @@ +// Removing a global as a debuggee forgets all its breakpoints. + + +var dbgA = new Debugger; +var logA = ''; + +var dbgB = new Debugger; +var logB = ''; + +var g1 = newGlobal({newCompartment: true}); +g1.eval('function g1f() { print("Weltuntergang"); }'); +var DOAg1 = dbgA.addDebuggee(g1); +var DOAg1f = DOAg1.getOwnPropertyDescriptor('g1f').value; +DOAg1f.script.setBreakpoint(0, { hit: () => { logA += '1'; } }); + +var DOBg1 = dbgB.addDebuggee(g1); +var DOBg1f = DOBg1.getOwnPropertyDescriptor('g1f').value; +DOBg1f.script.setBreakpoint(0, { hit: () => { logB += '1'; } }); + + +var g2 = newGlobal({newCompartment: true}); +g2.eval('function g2f() { print("Mokushi"); }'); + +var DOAg2 = dbgA.addDebuggee(g2); +var DOAg2f = DOAg2.getOwnPropertyDescriptor('g2f').value; +DOAg2f.script.setBreakpoint(0, { hit: () => { logA += '2'; } }); + +var DOBg2 = dbgB.addDebuggee(g2); +var DOBg2f = DOBg2.getOwnPropertyDescriptor('g2f').value; +DOBg2f.script.setBreakpoint(0, { hit: () => { logB += '2'; } }); + +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '12'); +assertEq(logB, '12'); +logA = logB = ''; + +// Removing a global as a debuggee should make its breakpoint not hit. +dbgA.removeDebuggee(g2); +dbgB.removeDebuggee(g1); +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '1'); +assertEq(logB, '2'); +logA = logB = ''; + +// Adding the global back as a debuggee should not resurrect its breakpoints. +dbgA.addDebuggee(g2); +dbgB.addDebuggee(g1); +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '1'); +assertEq(logB, '2'); +logA = logB = ''; + +// But, we can set them again, and it all works. +DOAg2f.script.setBreakpoint(0, { hit: () => { logA += '2'; } }); +assertEq(logA, ''); +assertEq(logB, ''); +g2.g2f(); +g1.g1f(); +assertEq(logA, '21'); +assertEq(logB, '2'); +logA = logB = ''; + +DOBg1f.script.setBreakpoint(0, { hit: () => { logB += '1'; } }); +assertEq(logA, ''); +assertEq(logB, ''); +g2.g2f(); +g1.g1f(); +assertEq(logA, '21'); +assertEq(logB, '21'); |