Set a breakpoint

Puedes establecer una interrupción incondicional en una de las siguientes maneras:

  • en el panel de fuente, haz clic en el número de línea para la línea que deseas la interrupción
  • in the source pane, activate the context menu while on the line you want to break at, and select "Add breakpoint"
  • in the source pane, highlight the line you want to break at and press Ctrl + B (Windows/Linux) or Cmd + B (macOS)

When you display the context menu, you have a choice of setting either a breakpoint that will pause code execution when it reaches that line, an unconditional breakpoint, or a conditional breakpoint that will only pause the code if the conditions you define are met:

If you choose to set a conditional breakpoint, you will be able to add the condition:

Each breakpoint is shown in two places in the debugger:

  • the breakpoints list shows the filename and line number for the breakpoint

  • the line in the source pane is marked with a blue arrow if you set an unconditional breakpoint, or an orange arrow if the breakpoint is conditional.

Starting in Firefox 67, you can set a column breakpoint on a complex line of code, such as one that makes multiple function calls. For example, if you try to set a breakpoint on the following line, you will have three possible locations for a breakpoint: at the point where the variable value is set, at the call to parse, or at the call to getItem.

tasks = JSON.parse(localStorage.getItem('todoList'));

Possible breakpoints are shown with indicators. The following image shows the line in the debugger. As soon as you click on the line, the three indicators show the possible breakpoints. The default breakpoint is set to the first column. In the image, the second column breakpoint was chosen which you can confirm in the Breakpoints section on the right where it shows that the breakpoint is on the call to parse.

Column breakpoints allow you to break at multiple points on the same line. In the previous example, you could have selected both the call to parse and the call to getItem, or even all three columns to break at each of the possible locations.

In cases where you set breakpoints on multiple columns, the currently active columns breakpoint will be highlighted in the Breakpoints side panel.