While debugging some client side javascript today in Firefox, I ran into something that I found quite odd and little unnerving. Also, I was unable to duplicate this behavior wh
To my experience, Firebug doesn't work well when putting breakpoints in asynchronous code.
I.e. if you have one straight line of execution and put breakpoints in it, you'll be fine. However if you introduce asynchronicity e.g. by using setTimeout, you won't hit the breakpoint in that "parallel" line (which of course is not parallel really, the JS engine switches between the tasks). I've been experiencing it a lot in last couple of months.
In Chrome, it seems to work fine (they defer timeouts intelligently somehow). Perhaps because Chrome dev tools are built-in to the browser, it's easier to manipulate the timeouts. Firebug is "just" an add-on and perhaps it may be tricky to do it correctly.
A simple script to reproduce the issue:
Put breakpoints in lines when I assign value to x, y, z.
First, you'll hit a breakpoint on the line x = 1. Use F10 to step over. You won't hit a breakpoint on the line with will hit a breakpoint on the line with z = 3 everz = 3 only if you're quick enough with pressing F10 (Firefox 14, Firebug 1.10).