Advanced Javascript and Web Debugging Techniques
techblog.badoo.com
techblog.badoo.com
Writing code in Conditional Breakpoints - So lets say you want to modify the value of PRICE, but only if ASIN == 'XYZ', then you can write:
if(ASIN === 'XYZ') { PRICE = 20 }
as the condition for your breakpoint and instead of breaking at that point, the value of price will be changed only for that ASIN. Helped me a lot during involved debugging sessions.I know I can get that effect by liberally sprinkling my code with 'debugger;', and could even automate that, but still...
https://developer.mozilla.org/en-US/docs/Tools/Debugger#Blac...
http://www.divshot.com/blog/tips-and-tricks/ignoring-library...
By any chance, do you also know of a way to exclude jQuery event wrappers from inspection in the "events" part ? Like in this screenshot : http://imgur.com/UaHTrth
This feature is pretty useless due to the fact that libraries wrap event callbacks.
Xcode (I'm sure others as well, but I played with that one recently so...) has absolutely humongous breakpoint "options" including silencing repeats (e.g. hit a breakpoint 5 times in a session then skip it) and advanced actions[0], including multiple actions per breakpoint, which is really nice.
[0] in Xcode 5, possible actions aside from a conditional break are executing applescript code, capturing an OpenGL ES frame, executing an LLDB command, logging a message (to the console or to text-to-speech), executing a shell command or playing a sound
It appears to me that webkit's logging by reference is actually fuzzy; after some magical amount of time the logged object will be displayed "how it used to be"; but in some cases like
obj = {foo: 'something bad mwahahhaa'};
console.log(obj);
obj.foo = 'something good ;-)';
it will just go ahead and time travel to 'something good' and you will never see the 'something bad'.however, if you expand the the object in the console (side note, would be nice to have an option to display expanded by default) it doesn't ever time travel and
obj = {foo: 'something bad mwahahhaa'};
console.log(obj);
// some magic amount of time or lines of execution
obj.foo = 'something good ;-)';
will also not time travelIt's really handy for mobile debugging.
In any case, note that that's also a lovely option.
Didn't know about the DOM breakpoint, though.
We faced a problem a few weeks ago, where Chrome for mobile worked fine, but the built in browser on Android phones pre 4.4 had some issues with our web app. Then we needed something else than Chrome to do the remote debugging.