how to totally ignore 'debugger' statement in chrome? - javascript

'never pause here' can not work
after I continue:
still paused

To totally ignore all breakpoints in Chrome, you must do as follows:
Open your page in the Chrome browser.
Press F12 or right-click on the page and select Inspect.
In the Source panel, press Ctrl+F8 to deactivate all breakpoints. (or: At the top-right corner, select deactivate breakpoints.)
All breakpoints and debugger statements will be deactivated.
I tested it in Chrome 79.0.3945.88 (64-bit) and I found that the debugger statement is ignored.

To stop hitting debugger statements, you must either set a "never pause here" breakpoint, OR you must pause stopping on exceptions.
This works because debugger breakpoints are considered exceptions by the browser.

Related

Chrome Dev Tools stops at breakpoint even when breakpoints are deactivated

I encountered an issue while debugging Javascript in the Dev Tools in Chrome.
Even when I have deactivated the breakpoints from the button, it still stops at them.
like this
I haven't enabled the "Pause on exceptions" button and the only thing that works is when I disable the breakpoints one by one (not having 'tick' on them).
disabled breakpoint
I noticed that this appeared in a week or so.
My browser is Version 78.0.3904.108 (Official Build) (64-bit)
It happened to me when I had another browser tab open on the same domain and the dev tool was open in that other tab too.
in that case you need to decative the debugger in both tabs or better close the other tab.
Edit: The issue is gone now, with the last update from chrome.

How to remove breakpoints causing Chrome to hang

Is it possible to delete all breakpoints without opening Chrome devtools?
I have a breakpoint set in a large obfuscated javascript file that cause the current tab to hang if I have devtools open while the page loads. I have no problems if i let the page load, and then open the devtools, but then the script is not visible in the sources and network panels.
I have attempted to disable breakpoints by immediately activating the "Deactivate all breakpoints" button when the page loads, but the breakpoint still triggers causing the tab to hang.
Update: This problem only happens when the sources panel in the devtools is open during page load.
As #Andrey points out, when the dev tools are closed Chrome will never break on a breakpoint.
You can disable breakpoints using Ctrl + F8, hitting F8 afterwards will continue from the current breakpoint.
You can also view a summary of all active BP's in the right of dev tools.
Update:
A last resort option is to clear the dev tools settings as follows. Note this will clear reset any customized settings you have...
Settings > Restore defaults and reload
I finally managed to reset the devtools, including all breakpoints, by simply logging out of chrome and back in again.

Chrome Debugger Doesn't Pause Mid-Scroll ... Fixable?

When I put a debugger statement inside some code that is called onScroll, the Chrome development tools do something strange that I haven't seen before: instead of pausing the browser with a gray overlay AND pausing the dev tools debugger on the appropriate line, Chrome only does the latter. In other words, it pauses in the debugging pane, but the browser remains active, allowing me to continue scroll (or do anything else) in the browser.
Is there anything I can do to make the browser truly halt both the debugger AND the browser pane?

MS Edge continue past all breakpoints

How do you resume execution and skip all breakpoints in MS Edge? In Chrome you can click and hold on the "play" button (seen below) to resume execution and ignore breakpoints:
You can disable all breakpoints in the F12 tools of Microsoft Edge by hitting Ctrl+Shift+F11.
Or, in the Debugger tab of F12, select the Breakpoints tab and click the "disable all breakpoints" button to achieve similar results.

Chrome devtools: Drop into debugger without switching to Sources tab

If I put the debugger statement in my JavaScript source with the Chrome devtools open, it'll stop execution so I can interactively explore the current context from the console. It's really awesome.
But unfortunately it will also switch to the Sources tab and display the line where the debugger statement happened. Most of the time, I want to type JavaScript commands, so I have to manually switch back to the Console tab.
Can I avoid the tab-switching and stay in the Console tab?
Or am I using it wrong?
Right-click on the source-tab and select 'move to bottom'.
Looks like Chrome added a preference for this in the intervening 9 years: https://stackoverflow.com/a/69216922/66673
Quoting that answer:
I had the same issue and it was driving me nuts! The way I managed it to stop switching was to go to into the DevTools settings -> Preferences.
Under Sources options, uncheck Focus Sources panel when triggering a breakpoint.
There's a reason for that - and is that whenever the code has stopped, because of a breakpoint or a debugger statement, you'd usually want to actually see where the execution has stopped. So, the developer tools switches to the Scripts/Sources tab, and this is a common behaviour among the major browsers, that may also show the local variables, the call stack and so on.
The best thing you can do is to keep the console frame always open, so you're ready to work. Just press Esc or click on the second icon on the lower left corner. That's what I usually do.
Switch to the Console tab when you expect to get a large response from the command you type.

Categories

Resources