UI Tour

This article is a quick tour of the main sections of the JavaScript Debugger's user interface. The UI is split vertically into three panels

Source list pane

The source list pane lists all the JavaScript source files loaded into the page, and enables you to select one to debug. At the top level sources are organized by origin, and under that they're organized by the directory structure from which they are served.

You can search for a file using Ctrl + P (Cmd + P on a Mac).

Web Extensions are listed in the Source List pane using the extension's name rather than its id beginning with Firefox 69.

You can simplify the list of files in the Source list pane by right-clicking on the directory in which you are interested and selecting Set directory root.

Now the root of the Source list pane is the root of the project, making for a much cleaner, easier to navigate display.

Outline View

The Outline view shows a tree for navigating the currently open file. Use it to jump directly to a function, class or method definition.

Source pane

This shows the JavaScript file currently loaded.

When the source pane is focused you can search for a string in the file using Ctrl + F (Cmd + F on a Mac).

Breakpoints have a blue arrow overlaid on the line number. Conditional breakpoints have an orange arrow. If you're stopped at a breakpoint, the entire line gets a green overlay. In the screenshot below there are three breakpoints:

  • line 82 has a normal breakpoint and execution is paused here
  • line 85 has a logpoint which logs the contents of tablerow to the console
  • line 100 has a conditional breakpoint

The third column shows more information about the breakpoints. For example, the logpoint at line 85 logs the value of the tableRow variable to the console and the conditional breakpoint at line 100 breaks if the contents of the todoList is undefined.

Toolbar

At the top of the right-hand pane, there's a toolbar:

The toolbar consists of:

  • Four buttons to control the debugger's movement through the script:
    • Play/pause (F8): pauses or resumes execution of the script you're debugging. When it displays a "play" icon, that means the script is paused, either because you've paused it with this button or because you've hit a breakpoint.
    • Step over (F10): steps across the current line of JavaScript code.
    • Step in (F11): steps into the function call on the current line of JavaScript code.
    • Step out (Shift-F11): runs the script until the current function exits.
  • a button that can be used to deactivate all breakpoints

Breakpoints list

Under the toolbar, you'll see all the breakpoints you've set. Next to each breakpoint is a checkbox which you can use to enable/disable it:

Watch expressions

You can add watch expressions in the right pane. They will be evaluated when code execution is paused:

Variable tooltip

Hover on a variable show a tooltip with its value inside:

Call stack

When the debugger's paused, you'll see a call stack:

Each level of the call stack gets a line, with the name of the function and the filename and line number. Clicking the line opens that source in the source pane.

Scopes

In the right-hand pane you'll see a label "Scopes" with a disclosure arrow next to it. When the debugger's paused, you'll be able to expand this section to see all objects that are in scope at this point in the program:

Objects are organized by scope: the most local appears first, and the global scope (Window, in the case of page scripts) appears last.