Closed Bug 1942443 Opened 24 days ago Closed 21 days ago

"Pause on exceptions" in developer tools doesn't work in async functions

Categories

(DevTools :: Debugger, defect)

Firefox 134
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1929595

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:

  1. 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>
  1. Open that HTML file in Firefox.
  2. Open the developer tools and go to the Debugger tab.
  3. Under Breakpoints, check "Pause on exceptions" and uncheck "Pause on caught exceptions".
  4. 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.

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.

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.

Component: Untriaged → Debugger
Product: Firefox → DevTools

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.

Flags: needinfo?(hmanilla)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(hmanilla)

Tested Chrome and they pause on unhandled promise rejections.

There are other bugs on opened with details relating to this work. I will close this as a duplicate

Thanks for filing

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

Attachment

General

Creator:
Created:
Updated:
Size: