Debugger doesn't pause (at least) `fetch` requests
Categories
(DevTools :: Debugger, defect)
Tracking
(Not tracked)
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.
Reporter | ||
Comment 1•19 days ago
|
||
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.
Description
•