Reputation:
I'm debugging code on an external site (jshint.com). In Chrome, I can successfully set and trap numerous breakpoints in the code. However, in Firefox/Firebug (9.0.1/1.8.4), the same code lines, in fact huge chunks of code, can not be debugged (viz., the line numbers are not green). Has anyone seen something similar and found a solution?
Upvotes: 1
Views: 1119
Reputation: 1
in Firefox the problem is the catch statement:
wrong
catch {
}
right
catch(e) {
}
Upvotes: 0
Reputation: 624
I'm using FB 1.11.3b1 in FF 20.0.1 and have noticed this issue. Even after cleaning up the code in JSLint. What I did find is that FB does get confused with a line containing a single curly bracket followed immediately by an inline comment:
}
// some comment
// lines after this don't have green line numbers, breakpoints ignored
breakpointable_line = false;
To work around the issue, separate them with a blank line
}
// some comment
// lines after this now have green line numbers, all is well with the world
breakpointable_line = true;
Upvotes: 1
Reputation: 3419
I see the same problem on FF 14.0.1 with FB 1.10.0 (quite recent versions). I'd seen this a couple years ago, I thought it was a reported bug and was fixed, but I see it again. The problem has been reported as: http://code.google.com/p/fbug/issues/detail?id=4646
A reported workaround is to break your JS file into smaller files (not a solution for claytoncarney's issue debugging JS files from other sites)
The problem seems to occur at the end of functions. The line numbers, where you set click to set breakpoints are green for places you can set breakpoints (ie not on comments or blank lines etc). However at the some functions some number of the last lines in the function have gray, not line numbers not green. The end of the green line numbers seems to correspond to the end of a block of code(a closing curly bracket) which is not the end of the function.
Of course it happens with large JS files, so it is hard to create a minimal example that reproduces the code. (I see it on JS files loaded from the same server as the base web page, so it is not limited to external sites as claytoncarney experienced.)
Upvotes: 0