"Pause on exceptions" in developer tools doesn't work in async functions
Categories
(DevTools :: Debugger, defect)
Tracking
(Not tracked)
People
(Reporter: kalle.anka.ank, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0
Steps to reproduce:
- Create an HTML file with the following content:
<!DOCTYPE html>
<html>
<head>
<script>
async function f(){
thisIsAnError();
}
</script>
</head>
<body>
<button onclick="f()">Click here</button>
</body>
</html>
- Open that HTML file in Firefox.
- Open the developer tools and go to the Debugger tab.
- Under Breakpoints, check "Pause on exceptions" and uncheck "Pause on caught exceptions".
- Click on the button on the HTML page that says "Click here" while the developer tools are still open.
Actual results:
The debugger didn't pause and simply logged an error in the console saying "Uncaught (in promise) ReferenceError: thisIsAnError is not defined".
Expected results:
The debugger should have paused on the "thisIsAnError();" line.
Reporter | ||
Comment 1•24 days ago
|
||
Note: It works fine if "Pause on caught exceptions" is checked, but I can't use that in my real project because I'm using third-party libraries that catch a lot of exceptions internally.
Comment 2•24 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•22 days ago
|
||
Did a little quick bit of digging,
Note: It works fine if "Pause on caught exceptions" is checked, but I can't use that in my real project because I'm using third-party libraries that catch a lot of exceptions internally.
So it seems like isInCatchScope
sees this scenario as a caught exception here https://searchfox.org/mozilla-central/rev/9a66d18cb35595c89f499a1011c9dd7e573fce77/devtools/server/actors/thread.js#2010-2011,2016 which explains why it works when the "Pause on caught exceptions" is checked.
isInCatchScope
might be handling uncaught async rejections differently. I'll test and see.
Updated•22 days ago
|
Updated•22 days ago
|
Comment 4•22 days ago
|
||
Tested Chrome and they pause on unhandled promise rejections.
Comment 5•21 days ago
|
||
There are other bugs on opened with details relating to this work. I will close this as a duplicate
Thanks for filing
Description
•