Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created July 29, 2019 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/dbee4b7b989b0da251bd924a78a87a98 to your computer and use it in GitHub Desktop.
Save jasonLaster/dbee4b7b989b0da251bd924a78a87a98 to your computer and use it in GitHub Desktop.
diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
index f7c09a3ce9fc..44de146ccb28 100644
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -840,6 +840,13 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
return undefined;
}
+ console.log(`>>> POP just happened ${location.line}, ${location.column}`);
+ console.log(`>> ${this.generator} ${this.type}`, completion)
+
+ if (completion.await) {
+ return undefined;
+ }
+
// Note that we're popping this frame; we need to watch for
// subsequent step events on its caller.
this.reportedPop = true;
@@ -962,9 +969,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
}) {
const thread = this;
return function() {
+
// onStep is called with 'this' set to the current frame.
const location = thread.sources.getFrameLocation(this);
+ console.log(`>> onStep ${location.line}, ${location.column}`)
+
// Continue if the source is black boxed.
if (thread.sources.isBlackBoxed(location.url)) {
return undefined;
@@ -1092,6 +1102,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
* rejected with an error packet.
*/
_handleResumeLimit: async function({ rewind, resumeLimit }) {
+ console.log(`>>> resumeLimit ${JSON.stringify(resumeLimit)}`)
let steppingType = resumeLimit.type;
const rewinding = rewind;
if (!["break", "step", "next", "finish", "warp"].includes(steppingType)) {
@@ -1143,6 +1154,8 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
stepFrame.setReplayingOnStep(onStep, offsets);
} else {
stepFrame.onStep = onStep;
+ stepFrame.onPop = onPop;
+
}
}
// Fall through.
diff --git a/devtools/server/tests/unit/test_stepping-12.js b/devtools/server/tests/unit/test_stepping-12.js
new file mode 100644
index 000000000000..2a2ec4d7698e
--- /dev/null
+++ b/devtools/server/tests/unit/test_stepping-12.js
@@ -0,0 +1,56 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Check that step out stops at the parent and the parent's parent.
+ * This checks for the failure found in bug 1530549.
+ */
+
+const sourceUrl = "test_stepping-10-test-code.js"
+
+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, 3);
+
+ // dumpn("Resume and land on line 5");
+ // await setBreakpoint(threadFront, { sourceUrl, line: 5 });
+ // const step2 = await resumeAndWaitForPause(threadFront);
+ // equal(step2.frame.where.line, 5);
+ // equal(debuggee.r, 'yay')
+
+
+ dumpn("Step Over and land on line 5");
+ const step1 = await stepOver(threadFront);
+ equal(step1.frame.where.line, 4);
+ equal(step1.frame.where.column, 8);
+
+ const step2 = await stepOver(threadFront);
+ equal(step2.frame.where.line, 5);
+ equal(step2.frame.where.column, 8);
+ equal(debuggee.r, 'yay');
+ })
+);
+
+function evaluateTestCode(debuggee) {
+ Cu.evalInSandbox(
+ `
+ (async function() {
+ debugger;
+ r = await Promise.resolve('yay');
+ a = 4;
+ })();
+ `,
+ debuggee,
+ "1.8",
+ sourceUrl,
+ 1
+ );
+}
diff --git a/devtools/server/tests/unit/xpcshell.ini b/devtools/server/tests/unit/xpcshell.ini
index e45a4fa6742e..9ad5fa614ec0 100644
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -190,6 +190,7 @@ skip-if = true # breakpoint sliding is not supported bug 1525685
[test_stepping-09.js]
[test_stepping-10.js]
[test_stepping-11.js]
+[test_stepping-12.js]
[test_stepping-with-skip-breakpoints.js]
[test_framebindings-01.js]
[test_framebindings-02.js]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment