Can I tell the Chrome script debugger to ignore jquery.js?
Asked Answered
B

8

106

Is there a way to tell the Chrome debugger (or maybe Firebug?) to not break within certain files? To assume they're not broken, essentially? This seems like something they might build in.

Birkenhead answered 19/8, 2011 at 20:5 Comment(4)
This would be particularly useful to me in the context of jquery events. When an event is triggered you have to step through a lot of crud to figure out which handlers are being invoked.Lias
It looks you should mark jfriend00 as the answer. I could not find the reason for that annoying behavior, and his answer solved it up.Valleau
@Valleau I disagree, my problem (and my understanding of Josh's problem) is that we are debugging our file, however this does not mean an exception is being thrown. My assumption is that my code is the problem and not jQuery's, so I never want to debug jQuery. I think of it like the DebuggerHiddenAttribute in .NETSelenite
I voted up jfriend00's answer, because it might be valuable to folks who come across this question, but I didn't mark it as the correct answer, because Nathan Koop is right, it doesn't solve my problem.Birkenhead
I
51

Blackboxing JS files is now possible in Firefox https://developer.mozilla.org/en-US/docs/Tools/Debugger

And in Chrome Canary using Experimental Dev tools. http://www.divshot.com/blog/tips-and-tricks/ignoring-library-code-while-debugging-in-chrome/

Update. In Chrome v.75 there is a separabe tab for blackboxing.

Above works in stable Chrome build as well now.

Impermeable answered 19/9, 2013 at 8:26 Comment(5)
Blackboxing doesn't seem to make the debugger skip the file. It will still pass through it's function calls... Completely ignoring a file would be nice.Cacus
That is the point in blackboxing - running the code without seeing it's contents.Burden
Isn't blackboxing when you simply don't step through the other libraries, not that they don't exist or aren't being used.Hobbism
updated link for firefox: developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/…Seringapatam
Blackboxing has been renamed to Ignore List in Chrome. Still FF Ignore list works better.Merriman
M
31

The latest version of Chrome has implemented a new blackbox feature that does exactly what you are looking for. Basically, when you set the blackbox option on a given file, it will prevent Chrome debugger from breaking into that file.

This feature is built-in and it can be set with the context menu of the file (right click). It will also work if Chrome debugger is set for stopping on all exceptions.

Malayopolynesian answered 28/1, 2015 at 14:51 Comment(3)
very Clean solution No plugins needed.Aldora
No longer works unfortunately. If you have "Pause On Caught Exceptions" checked and then blackbox jQuery it will still break on the exceptions.Thallic
too bad it doesn't work wellOutflow
G
16

If the issue you're having is that the Chrome debugger is stopping on all exceptions, even the ones inside of jQuery, then you may need to tell Chrome to only pause on uncaught exceptions, not all exceptions. When in the Script panel in the debugger, there is an icon in the lower left corner of the window that controls this.

Gyasi answered 19/8, 2011 at 20:42 Comment(0)
R
14

In Chrome, open Developer Tools, then goto Settings, and you will see the Blackbox tab:

Chrome Blackbox

In FireFox it's even easier, just click the Eye at the bottom of the file:

FireFox Blackbox

Rickie answered 8/11, 2017 at 22:22 Comment(1)
You just made my life heaven! Thanks!Sallie
U
7
  1. Go to developer tools setting and click on Balckboxing tab on the left panel.
  2. Then click on the Add pattern button and type jquery.js
  3. Close and reopen developer tools, now its skipped!
Unbend answered 28/3, 2017 at 8:6 Comment(0)
C
4

You can follow this link to ignore the pattern in latest chrome browser (mine is : Version 100.0.4896.60 (Official Build)).

https://dilshankelsen.com/ignore-library-code-while-debugging-browser/

Developer Tools > Settings (Cog Icon) > Ignore List. Then add a file name or regex pattern you wish to exclude.

Celestina answered 4/4, 2022 at 4:50 Comment(0)
M
2

If the debugger is blowing up somewhere in the jQuery files, you could potentially wrap the suspect calls in a try/catch and then throw an error in your own catch. That way, you can isolate exactly where your're going wrong.

I would be more inclined to do stack traces to see why my code is blowing up, e.g. invalid JSON, than to try gloss over it.

Mustachio answered 19/8, 2011 at 20:20 Comment(0)
M
0

Go to Developer Tools > Settings (Cog Icon ⚙️) > Ignore List.
Then add a Custom exclusion rule like file name or regex pattern of the library you want to exclude:

enter image description here

Mulcahy answered 1/12, 2023 at 20:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.