debugger.html messes up the promise callback execution order

RESOLVED DUPLICATE of bug 1145201

Status

defect
RESOLVED DUPLICATE of bug 1145201
2 years ago
Last year

People

(Reporter: jovan.gerodetti, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

2 years ago
When debugging this: 
https://jsfiddle.net/7ph52bv6/28/ (right click result iframe, open in new tab, open devtools and type one key into the input) 

The execution order of promises gets messed up. The promise callback is executed synchronously instead of asynchronously, as it should and normally does.
Reporter

Comment 1

2 years ago
Once the debugger halted, start and continue "stepping in". The debugger will then step through _runStage and into _scheduleStage. Inside _scheduleStage it should create the new promise and then move on to the console log. It instead immediately moves into the then() callback (_runStage).
Indeed, here is a much simpler example that reproduces the issue: https://jsfiddle.net/kjx6061b/1/

> debugger;
> (new Promise((resolve) => resolve(2))).then(console.log);
> console.log("1")
> debugger;

Normally we would expect to log 1, then 2. But if you simply step over after hitting debugger, we will log 2, then 1.

Updated

2 years ago
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1145201

Updated

Last year
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.