Bug 1571791 - "Step in" across an await expression jumps to unexpected places. r=loganfsmyth
authorJason Laster <jlaster@mozilla.com>
Thu, 29 Aug 2019 16:09:47 +0000
changeset 554447 9a55517ecc442fdc7e241409fe7a98ea9c075a45
parent 554446 7396789341b14d8fd1cc12ad0ec30c0180a5dfae
child 554448 4b77646bc7889edbe2b03160f754f7709f93459a
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersloganfsmyth
bugs1571791
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1571791 - "Step in" across an await expression jumps to unexpected places. r=loganfsmyth Differential Revision: https://phabricator.services.mozilla.com/D42723
devtools/server/actors/thread.js
devtools/server/tests/unit/test_stepping-14.js
devtools/server/tests/unit/xpcshell.ini
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -829,16 +829,17 @@ const ThreadActor = ActorClassWithSpec(t
 
   _makeOnPop: function({ pauseAndRespond, steppingType, rewinding }) {
     const thread = this;
     return function(completion) {
       // onPop is called when we temporarily leave an async/generator
       if (completion.await || completion.yield) {
         thread.suspendedFrame = this;
         this.waitingOnStep = true;
+        thread.dbg.onEnterFrame = undefined;
         return undefined;
       }
 
       if (thread.sources.isFrameBlackBoxed(this)) {
         return undefined;
       }
 
       // Note that we're popping this frame; we need to watch for
new file mode 100644
--- /dev/null
+++ b/devtools/server/tests/unit/test_stepping-14.js
@@ -0,0 +1,55 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/*
+ * Check that is possible to step into both the inner and outer function
+ * calls.
+ */
+
+add_task(
+  threadFrontTest(async ({ threadFront, targetFront, debuggee }) => {
+    dumpn("Evaluating test code and waiting for first debugger statement");
+
+    const consoleFront = await targetFront.getFront("console");
+    consoleFront.evaluateJSAsync(
+      `(function () {
+        async function f() {
+          const p = Promise.resolve(43);
+          await p;
+          return p;
+        }
+
+        function call_f() {
+          Promise.resolve(42).then(forty_two => {
+            return forty_two;
+          });
+
+          f().then(v => {
+            return v;
+          });
+        }
+        debugger;
+        call_f();
+      })()`
+    );
+
+    const packet = await waitForEvent(threadFront, "paused");
+    const location = {
+      sourceId: packet.frame.where.actor,
+      line: 4,
+      column: 10,
+    };
+
+    await threadFront.setBreakpoint(location, {});
+
+    const packet2 = await resumeAndWaitForPause(threadFront);
+    Assert.equal(packet2.frame.where.line, 4, "landed at await");
+
+    const packet3 = await stepIn(threadFront);
+    Assert.equal(packet3.frame.where.line, 5, "step to the next line");
+
+    await threadFront.resume();
+  })
+);
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -190,16 +190,17 @@ skip-if = true # breakpoint sliding is n
 [test_stepping-06.js]
 [test_stepping-07.js]
 [test_stepping-08.js]
 [test_stepping-09.js]
 [test_stepping-10.js]
 [test_stepping-11.js]
 [test_stepping-12.js]
 [test_stepping-13.js]
+[test_stepping-14.js]
 [test_stepping-with-skip-breakpoints.js]
 [test_framebindings-01.js]
 [test_framebindings-02.js]
 [test_framebindings-03.js]
 [test_framebindings-04.js]
 [test_framebindings-05.js]
 [test_framebindings-06.js]
 [test_framebindings-07.js]