Closed Bug 1929694 Opened 26 days ago Closed 19 days ago

Debugger doesn't pause (at least) `fetch` requests

Categories

(DevTools :: Debugger, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1573816

People

(Reporter: ochameau, Unassigned)

References

(Blocks 1 open bug)

Details

This issue is probably here since day 1.

When the debugger pause for any reason (any type of breakpoint, debugger statements, ...), asynchronous work related to fetch isn't paused.
So that the related promise returned by fetch may still trigger page JavaScript via its resolution/rejection handlers.

Here is a test page demonstrating that:
data:text/html,<script>window.onclick=()=>{var x=0;fetch("http://mozilla.org").catch(()=>{}).then(()=>x=42); console.log(x);debugger;}</script>
When we hit the debugger statement, x is at 0 (as stated by the console.log.
But, when hovering x you can see that it changed to 42 (and the preview popup is actually correct).

I know there is something about MicroTask, but only for the worker thread:
https://searchfox.org/mozilla-central/rev/5b288ed276a9580f2bedd4f67543940667d6a8c0/dom/workers/WorkerPrivate.cpp#5192-5196
and it seems to be the other way around, to allow debugger Promises to keep running.
It isn't clear how worker's promises are being frozen.

Blocks: dbg-r2c

It seems to be specific to fetch and not general to all Promises as the following promise resolution handled is paused:
data:text/html,<script>window.onclick=()=>{Promise.resolve().then(()=>console.log("foo")); debugger};</script>

This seems to be a duplicate of bug 1573816.

Status: NEW → RESOLVED
Closed: 19 days ago
Duplicate of bug: 1573816
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.