We have a very large JavaScript application where after many months of coding there have inevitably sprung a couple scope slip ups where a variable is defined in the following fashion:
function() { x = 5; ... }
instead of:
function() { var x = 5; ... }
This is happening somewhere -- We're not sure where -- and searching for the variable name in question is difficult since it's a common word that appears 1000s of times in our source.
Is there a way to ask Firebug to break on the line that first creates a given global variable? To clarify, I would like to break at exactly the instant when window['X'] switches from undefined to defined, and to break on the line that is executing at that instant.
I've tried creating a watch expression and hoped I could turn it into a breakpoint, but I can't seem to create watch expressions without some kind of context or scope.
If this isn't possible with Firebug, I'd be interested in anything that can accomplish this in Firefox in general.