Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 04:25:11 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Firebug: Saved / Persisted Watch Expressions, Breakpoints, etc.?  (Read 2786 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,845
    • View Profile
    • Donate to Member
I've started to use Firebug (1.2.1) recently to trace execution of code in an attempt to verify my rather limited understanding of fulljslint.js (JSLint). 

So, I'd like to watch the code execute for different inputs (basically what one specifies as parameters for JSLint are: 1. source code, 2. options for what things to check for) to examine values and paths of execution. 

I'm finding it instructive to have certain watch expressions (e.g. token, prevtoken, nexttoken, syntax, funct, functions, scope, option, etc.) and breakpoints set up -- but I'd like to not have to enter / set these each time I start up Firefox.

I haven't had much luck determining whether this is possible -- does anyone happen to know?

housetier

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 1,321
    • View Profile
    • Donate to Member
Re: Firebug: Saved / Persisted Watch Expressions, Breakpoints, etc.?
« Reply #1 on: January 03, 2009, 06:49:32 AM »
can you put these in a javascript file which is included when you load the page? Anything you type on the firebug console can be put in a script as well.

However, I do not know how to set up breakpoints from the console of firebug...

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,845
    • View Profile
    • Donate to Member
Re: Firebug: Saved / Persisted Watch Expressions, Breakpoints, etc.?
« Reply #2 on: January 03, 2009, 08:22:12 AM »
Thanks for the response.

I'm not sure I follow your suggestion.  Is there some way to set up watch expressions from the console?  If I knew this, I think I would understand your suggestion, but I have not figured out how to do that.  I looked at the following, but didn't managed to figure out anything relevant:


For global functions, IIUC, I can use debug(fn) to set up a breakpoint for a function, but there are two issues with this as I see it.  The first is that the breakpoint is set up on the first line of the function only (I suppose this is better than nothing).  The second issue is that there is only one global function in fulljslint.js -- all other functions are local in scope to that one function -- and so placing debug(fn) in a separate script doesn't seem like it will be that useful because none of the functions I want to examine (save the main JSLINT one) are visible (I tried debug(advance); in the FB console w/o a successful result).

I tried placing debug(fn) inside fulljslint.js but this gave an error: debug is not defined.  This seemed slightly odd as earlier I had success with placing console.log calls to fulljslint.js.

I guess I could try modifying fulljslint.js so that it made the functions I wanted to examine available globally...

Edit: I tried the modification I had in mind, but although I was able to successfully call debug(fn); from the console, execution doesn't appear to stop when the code runs -- perhaps the breakpoint is not being set or honored.  It'd be nice if I was just doing something wrong :)
« Last Edit: January 03, 2009, 08:30:43 AM by ewemoa »