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 --- devtools/server/tests/xpcshell/test_stepping-09.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 devtools/server/tests/xpcshell/test_stepping-09.js (limited to 'devtools/server/tests/xpcshell/test_stepping-09.js') diff --git a/devtools/server/tests/xpcshell/test_stepping-09.js b/devtools/server/tests/xpcshell/test_stepping-09.js new file mode 100644 index 0000000000..da59ed963c --- /dev/null +++ b/devtools/server/tests/xpcshell/test_stepping-09.js @@ -0,0 +1,47 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Check that step out stops at the end of the parent if it fails to stop + * anywhere else. Bug 1504358. + */ + +add_task( + threadFrontTest(async ({ threadFront, debuggee }) => { + dumpn("Evaluating test code and waiting for first debugger statement"); + const dbgStmt = await executeOnNextTickAndWaitForPause( + () => evaluateTestCode(debuggee), + threadFront + ); + equal( + dbgStmt.frame.where.line, + 2, + "Should be at debugger statement on line 2" + ); + + dumpn("Step out of inner and into outer"); + const step2 = await stepOut(threadFront); + // The bug was that we'd step right past the end of the function and never pause. + equal(step2.frame.where.line, 2); + equal(step2.frame.where.column, 31); + deepEqual(step2.why.frameFinished.return, { type: "undefined" }); + }) +); + +function evaluateTestCode(debuggee) { + // By placing the inner and outer on the same line, this triggers the server's + // logic to skip steps for these functions, meaning that onPop is the only + // thing that will cause it to pop. + Cu.evalInSandbox( + ` + function outer(){ inner(); return 42; } function inner(){ debugger; } + outer(); + `, + debuggee, + "1.8", + "test_stepping-09-test-code.js", + 1 + ); +} -- cgit v1.2.3