JS Debugger

Published 2014-10-27 | (Compatible with SDK 2.5,3.5,4.5,5.0,5.1 and 2011,2012,2013,2014 models)

JS Debugger

The debugger tool allows you to perform basic JavaScript (JS) debugging operations, such as setting break points, browsing objects, and watching variables. The tool enables you to run your application code, one line at a time, and check how variables change during the program execution. During debugging, you can view the source code, set or clear breakpoints, and evaluate expressions. Script execution can be controlled with breakpoints and stepping functions.

The Samsung Smart TV SDK uses two debuggers:

The features for JS debugger tool include loading scripts, opening windows, setting local variables, setting break points, using call stacks, and creating interactive sessions. The figure below illustrates the debug menu and a JavaScript source file:

Figure: Debug Menu and JavaScript Source file

Development Environment

To create the your application, use the Samsung Smart TV SDK. Use the SDK-provided emulator to operate and test the application before uploading it to a TV.

Debugger Features

The JS debugger-related features are implemented in the Debug menu of the SDK. The basic features are:

  • Start Debugging
  • Stop Debugging
  • Continue
  • Step Over
  • Step Into
  • Step Out
  • Add Breakpoint
  • Remove Breakpoint
  • Remove All Breakpoints

Figure: Basic features in Debug menu

Source Code Structure

The source code window displays the JavaScript source code embedded in HTML pages. To display the source code of a script in the source code window, double-click the script name in the Apps tab. A new source code tab is created for each script.

The main components of the source code window are:

Source tab
displays the JavaScript file source code.
Breakpoint (marker) bar
displays the JavaScript file breakpoint.
Line bar
displays the JavaScript file line numbers.
Scroll bar (Horizontal/Vertical)
enables source page vertical and horizontal scrolling when the source code does not fit on a single page.

Figure: Components of source code window