In Google Chrome, there is a debug()
function which can be called from the DevTools console and accepts a function as its parameter. It can be used when you want to pause whenever a specific function is called.
Is there any similar Firefox alternative that can be called from the console?
Now, in Firefox, I have to find the source code for the function in the Debugger tab and set a breakpoint at the function.
There is a long-standing request to add the debug()
/undebug()
functions to the console, which were originally introduced by Firebug, by the way.
For now (as of Firefox 71) you need to set them manually, though you can at least easily jump to the definition of the function by logging it to the console.
Clicking the icon besides the function takes you to the function definition. There you can set a breakpoint at the first executable statement of the function.
Another way to do that is by selecting the function from within the Outline panel. You will still have to set the breakpoint manually, though.