Debugging an HTML Script Application
To create a launch configuration that will launch or attach to an HTML script application ( .htm, .html, or .jsp) for debugging, do the following:
In a workbench perspective that offers the launch/debug/run action set (such as the Debug perspective), do one of the following:
- Select Run > Debug from the workbench menu bar to open the Debug launch configurations dialog box.
- Select the workbench toolbar Debug push button and choose Debug from the menu. This will open the Debug launch configurations dialog box.
In the Debug launch configurations dialog box, do one of the following:
- Select the HTML Script Application node and click New.
- Right-click the HTML Script Application node and select New from the pop-up menu.
- Double-click the HTML Script Application node.
This will cause the launch configuration tabs and entry fields to display on the right-hand side of the dialog box. In the Name field, enter a name of your choice for the configuration that you are creating. Select the Main tab to bring it to the foreground. In the Main tab Project field, enter the name of the project that contains the source for the application that you wish to debug. If the project does not contain the source, import the source to the project.
Rather than enter a project name in the Project field, you can browse for the project by clicking Browse.
Do one of the following:
- If you wish to attach to an existing Internet Explorer browser that is running the script that you wish to debug, select the Use existing browser radio button.
- To launch the file that you wish to debug, select the Launch new browser radio button and then enter the URL or the full path and name of the file that you wish to debug in the URL field.
Select the Common tab to bring it to the foreground. You can do the following in the Common page:
- If you want the launch configuration to be stored locally and available for a single user, ensure that the Local radio button is selected. If the launch configuration is to be stored as a file in the workspace and shared in a repository for team use, select the Shared radio button and enter the project location where you wish the launch configuration to be stored in the Location of shared configuration field. Alternatively, you may browse for the project.
- If you would like the launch configuration to appear as a favorite debug configuration in the Debug push button favorites menu or the Debug menu Debug History list, select the Debug check box.
If all information mandatory to the launch configuration has been provided, the Debug and Apply push buttons will be enabled. Clicking Apply will save the launch configuration, at which point you can choose to close the dialog box without launching the debug session or you can click Debug to launch a debug session using the new launch configuration. If you click Debug, any changes to the launch configuration will be saved and a debug session will be launched.
Notes:
- You can have only one HTML script application debug session at a time (multiple HTML script application debug sessions are not supported).
- If you choose to launch using an existing browser, the Running Browsers dialog will open. In this dialog, select the browser session that you want to debug (a browser node for each browser session that you have open will be listed in the dialog). To choose the browser to attach to, expand the browser nodes until you see the URL that is running the script that you wish to debug. Select this URL and click OK to launch the debug session. Or, if the URL is running in the browser that is the first of multiple instances, you can choose the browser node to launch the debug session.
Important: Running the workbench Web Browser while debugging can cause unexpected results. During an Active Script debug session, this browser should be closed. If this browser is left open and you attempt to attach to it for the purpose of debugging, the workbench will stop responding.- If you are browsing HTML frames, each frame may appear individually in the Running Browsers dialog. You can attach to any of these frames for the purpose of debugging.
- When you launch a debug session by attaching to an existing browser, the debug target will display in the Debug view but the suspended thread will not. The thread will appear in the Debug view after you run the application's script.
- After you have saved a debug launch configuration, you may edit it. For further information about editing debug launch configurations, see the related task below.
Tip: If you have not yet saved launch configuration settings and if you have made entries in the launch configuration settings that you would like to remove or change, clicking Revert will remove all changes that you have made. If information mandatory to the launch configuration has not been provided or if there are errors in the information that you have provided, messages at the top of the dialog box will indicate what is missing. When you are finished working in the dialog box, click Close to exit it.Note: When you are debugging a JSP page that generates script and you wish to suspend execution for that script, you need to issue a suspend action on the thread before launching the script action. If you do not do this, the debugger may not halt within that action, even when a breakpoint is set. For information about halting program execution, see the related topic below.
Related tasks
Preparing to debug
Setting debug preferences
Starting a debug session
Debugging a Script Host Application
Debugging Web project script
Using the Debug view
Running an Active Script application
Stepping through a program
Halting a running program
Terminating a debug session
Starting a debug session with an existing launch configuration
Editing launch configurations
Removing launch configurations
Creating new launch configurations from existing launch configurations
Debug on Server
Editing and viewing source while debugging