Keyboard shortcuts for the step commands are the same as in other common visual debugging environments, and console users should be familiar with Venkman's break, step, next, finish, frame, and where commands.
Venkman consists of eight main interface elements, referred to as "views." These views display information such as local variables, source code, and the interactive console. They can be detached from the main window to save space on your desktop, or they can be hidden. The Venkman project page at http://www.mozilla.org/projects/venkman/ describes these views and their modes of operation.
Invoke the -venkman command-line argument by typing mozilla -venkman to start Mozilla.
You must start the debugger before the scripts it edits can be debugged. If you want to debug the file navigator.xul, for example, then Venkman must load before the main browser window. This limitation will either be fixed or worked around later. For the time being, you need to start the debugger first to debug browser chrome.
Launch a browser window and select "Navigator" from the debugger's Tasks menu.
Type break ContextMenu 357 in the debugger.
Or, you could select nsContextMenu.js from the Scripts View, locate line 357, and click in the left margin. Setting breakpoints in this way is equivalent to using the break command in the console.
Type break in the debugger.
If you don't provide arguments to the break command, all breakpoints are listed.
Create a context menu in the Navigator window.
A right-click in the content area creates a context menu. You should have hit the breakpoint you just set. The debugger should have displayed "Stopped for breakpoint," along with the filename, line number, and snippet source code where it stopped from.
Type step in the debugger.
Type props this in the debugger.
The props command lists an object's properties. The letters and dashes before the values are the flags for that value. The flags are enumerated in Figure B-3, previously shown.
Step one more time.
You should be in the isTargetATextBox function call now.
Type frame in the debugger.
When used without arguments, the frame command shows you the source code for the current frame (with a few lines of context).
Type scope in the debugger.
The scope command lists the current frame's local variables. In this case, there are two locals: node and attrib. The node property is an argument to the function, while attrib is a local variable. The scope is also visible in the Stack View. Open the [isTargetATextBox] frame and the scope node below it.
Type where in the debugger.
The where command lists the current call stack. The frame command can be used to change the current frame to any frame listed here. For example, to view variables in the code that called isTargetATextBox, type frame 1, and scope. To return to the top frame, type frame 0.
Type eval window._content.
The break command, when used without arguments, lists the current breakpoints by index.
Type clear 0.
The clear command clears breakpoints. In this example, we clear by breakpoint number, which we got from the break command in the previous step.
The cont command continues execution. The context menu should pop up as it always does.