diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /devtools/server/tests/xpcshell/test_breakpoint-13.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/tests/xpcshell/test_breakpoint-13.js')
-rw-r--r-- | devtools/server/tests/xpcshell/test_breakpoint-13.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/devtools/server/tests/xpcshell/test_breakpoint-13.js b/devtools/server/tests/xpcshell/test_breakpoint-13.js new file mode 100644 index 0000000000..2265f3449a --- /dev/null +++ b/devtools/server/tests/xpcshell/test_breakpoint-13.js @@ -0,0 +1,78 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Check that execution doesn't pause twice while stepping, when encountering + * either a breakpoint or a debugger statement. + */ + +add_task( + threadFrontTest(async ({ threadFront, debuggee }) => { + const packet = await executeOnNextTickAndWaitForPause( + () => evaluateTestCode(debuggee), + threadFront + ); + + const source = await getSourceById(threadFront, packet.frame.where.actor); + await threadFront.setBreakpoint( + { sourceUrl: source.url, line: 3, column: 6 }, + {} + ); + + info("Check that the stepping worked."); + const packet1 = await stepIn(threadFront); + Assert.equal(packet1.frame.where.line, 6); + Assert.equal(packet1.why.type, "resumeLimit"); + + info("Entered the foo function call frame."); + const packet2 = await stepIn(threadFront); + Assert.equal(packet2.frame.where.line, 3); + Assert.equal(packet2.why.type, "resumeLimit"); + + info("Check that the breakpoint wasn't the reason for this pause"); + const packet3 = await stepIn(threadFront); + Assert.equal(packet3.frame.where.line, 4); + Assert.equal(packet3.why.type, "resumeLimit"); + Assert.equal(packet3.why.frameFinished.return.type, "undefined"); + + info("Check that the debugger statement wasn't the reason for this pause."); + const packet4 = await stepIn(threadFront); + Assert.equal(debuggee.a, 1); + Assert.equal(debuggee.b, undefined); + Assert.equal(packet4.frame.where.line, 7); + Assert.equal(packet4.why.type, "resumeLimit"); + + info("Check that the debugger statement wasn't the reason for this pause."); + const packet5 = await stepIn(threadFront); + Assert.equal(packet5.frame.where.line, 8); + Assert.equal(packet5.why.type, "resumeLimit"); + + info("Remove the breakpoint and finish."); + await stepIn(threadFront); + threadFront.removeBreakpoint({ sourceUrl: source.url, line: 3 }); + + await resume(threadFront); + }) +); + +function evaluateTestCode(debuggee) { + /* eslint-disable */ + Cu.evalInSandbox( + ` + function foo() { + this.a = 1; // <-- breakpoint set here + } + debugger; + foo(); + debugger; + var b = 2; + `, + debuggee, + "1.8", + "test_breakpoint-13.js", + 1 + ); + /* eslint-enable */ +} |