Closed Bug 1397933 Opened 7 years ago Closed 7 years ago

debugger.html messes up the promise callback execution order

Categories

(DevTools :: Debugger, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1145201

People

(Reporter: jovan.gerodetti, Unassigned)

Details

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.
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.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.