04.11.2015 Views

javascript

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 14: Error Handling and Debugging<br />

Stepping through Code<br />

You can step through code on the Source tab using the buttons in the upper - left corner. There are six<br />

buttons to control the execution of code and one for logging threads (see Figure 14 - 32 ).<br />

Continue<br />

Step Into<br />

Step Over<br />

Log Threads<br />

Break on Error<br />

Break Next<br />

Step Out<br />

Figure 14-32<br />

The first four buttons are standard: Continue, Step Into, Step Over, and Step Out. The next two buttons<br />

indicate different times when the debugger can break. The first of these is Break Next, which breaks into<br />

the debugger when the next line of JavaScript is to be executed; the second is Break on Error, which<br />

breaks into the debugger whenever an error occurs.<br />

When code execution is stopped, the Call Stack and Inspection tabs are filled with information about the<br />

current execution context.<br />

The Command Line Tab<br />

The last tab under the Scripts tab is called Command Line, and it contains a command - line console<br />

similar to Firebug (see Figure 14 - 33 ).<br />

Figure 14-33<br />

Using the Command Line, you can execute JavaScript in the context of the currently loaded page and get<br />

the result. Note that Opera doesn ’ t expose the console object, so you cannot write to this console from<br />

JavaScript.<br />

512

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!