Open Bug 1523893 Opened 6 years ago Updated 2 years ago

Stepping out from an async function that is not on the stack anymore doesn't work correctly

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: Honza, Unassigned)

References

(Blocks 1 open bug)

Details

Initial state: foo calls sleep and the user is paused at the debugger keyword at line 3

1. async function sleep(n) {
2.   await new Promise(r => setTimeout(r, n));
3.   debugger;  // step out from here
4.   return new Promise(r => setTimeout(r, n));
5. }
6. 
7. async function foo() {
8.   const s = sleep(1000);
9.   s.then(callback);
10. }
11. 
12. function callback() {
13.   console.log("callback");
14. }

STR:

  1. The user is paused at line 3
  2. The user steps out of the sleep function. Note that the sleep function isn’t on the stack anymore (since the await at line 2)
  3. BUG => The execution should resume since there is no parent frame on the stack where the execution could pause.
  4. Expected: Chrome parity

This is not working as expected, the execution breaks at the end of the function (last bracket), just before leaving the frame. Also, there was a suggestion to pause the execution at line 13 after step out from the sleep function (open for discussion).

Online example #3:
https://statuesque-cover.glitch.me/

Other browsers:

  • Edge pauses at line 13 (in the callback)
  • Chrome pauses in what seems to be top-level evaluated code
Priority: -- → P2
Type: defect → enhancement
Priority: P2 → P3
Whiteboard: [debugger-mvp]
Priority: P3 → P2
Whiteboard: [debugger-mvp]
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.