Introduction
This walkthrough will instruct you how to install the Aptana JavaScript debugger, add a breakpoint to your code, and display the current values of your variables.
- Import the debugging sample as a project.
- In the Samples View, expand the Aptana Studio Samples node.
- Select the Debugger Sample.
- Right-click the Debugger Sample and select Import sample as project from the context menu.
- Follow the prompts to import the sample.
Aptana creates a new Debugger Sample project, which includes a debug_tests.html file (which will automatically open) and a debug_timer.html file. You will be using debug_timer.html later on in this tutorial.
- In your Project View, navigate to the new Debugger Sample project.
- Expand the Debugger Sample project node.
- Open the debug_timer.html file in your Editor.
- Install the debugger.
- From the Run menu, select Debug... to open a Debug window.
- In the lower-left corner of the Debug window, under the list of Configurations, click the New button to create a new configuration.
- In the Name field, type a name for your new configuration (e.g. "debug").
- Under Web Browser, browse to your Firefox installation, if it is not there by default.
- Click the Debug button to install the debugger into Firefox.
A browser window opens, checks for the Debugger extension, and then closes.
Aptana displays a prompt asking if you would like to install the Debugger Extension.
- On the prompt, click Yes to install the Debugger Extension for your browser.
A browser window opens and displays a Software Installation prompt.
- Click the Install Now button to start installing the debugger.
An Extensions pop-up window displays the list of extensions installed in your browser.
- Close the Extensions pop-up window.
- Close your browser window.
Aptana opens an Install Debugger Extension pop-up window.
- On the Install Debugger Extension pop-up window, click OK.
A browser window opens, which installs the debugger.
- Close the browser window.
Aptana displays a prompt telling you that the debugger was successfully installed.
- Click OK.
A browser window opens that contains the start page that you specified in your configuration.
- Start debugging.
- Return to Aptana, and switch to the Debug perspective.
To access the Debug perspective for the first time, click the Perspective button and select Other... > Debug from the pop-up menu.
Aptana switches to the Debug Perspective.
- On the Debug View in the upper-left corner of the Debug Perspective, select the main thread for timer.html and click the Suspend button to suspend the current JavaScript thread.
- Switch back to Firefox, and click the Start button on the timer page to start executing the JavaScript for the page.
- Switch back to Aptana to continue debugging.
- Return to Aptana, and switch to the Debug perspective.
- Add a breakpoint to your code.
- In timer.html, navigate to the timerUpdate() function.
- On the second line of the timerUpdate function (i.e.
if( timerID ) {
), right-click in the gray margin, and select Toggle Breakpoint from the context menu. - Click the Resume button to resume execution of your code.
Execution of your JavaScript code will automatically suspend on this breakpoint.
- Inspect the values of your variables.
- In the upper-right part of the Debug perspective, click the Variables tab.
The Variables View displays the values for the variables in the current stack frame.
- Click the Show Type Names button to display what types your variables are.
- Right-click a variable and select Change Value... from the context menu, if you want to change a variable value.
- In the upper-right part of the Debug perspective, click the Variables tab.
- Quit the debugger.
- Click the Terminate button to stop debugging and close your Firefox window.