JavaScriptDebuggingWithInternetExplorer

JavaScript Debugging with Internet Explorer

Overview

NetBeans debugging support for Internet Explorer is enabled through a Browser Helper Object (BHO; also known as an add-on). A BHO is a COM component which gets loaded into every instance of Internet Explorer. The NetBeans add-on uses Active Scripting debugger API's to talk to the IE Scripting engine, and communicates with the NetBeans IDE via the DBGP protocol.

Supported Versions and Operating Systems

Debugging support is enabled for

  • Internet Explorer versions 6 and 7
  • Windows XP and Vista operating systems

Differences from FireFox

The Netbeans JavaScript debugger aims to provide a common UI experience for users of both FireFox and Internet Explorer browsers. However, there are differences in the script debugging architecture and exposed API's between the two browsers. Hence there are few noticeable differences for users. This document lists and defines these differences.

Installation of the Debugging Framework and Internet Explorer Add-On

When the user starts to debug with Internet Explorer, the NetBeans JavaScript Debugger first checks if the required Active Scripting debugger framework is available on their system. If not, the following dialog displays, and the user's browser is launched with the URL pointing to Microsoft's download page for the Active Scripting debugger framework. For more information visit: http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99

Image:MSActiveDebuggerFrameWork_JavaScriptDebuggingWithInternetExplorer.png

The user should successfully install the Active Scripting debugger framework before clicking OK in the above dialog.

As mentioned in the overview, the NetBeans Add-on for Internet Explorer is also required for debugging to work. The JavaScript debugger checks to see if the Add-on has been registered already. If not, they are prompted to register it.

Image:RegisterBHO_JavaScriptDebuggingWithInternetExplorer.png

Upon clicking OK, the Add-on is registered in the Windows system registry.

Local variables window

Because of a limitation in the Active Scripting debugger API's, it is not possible to get the type of JavaScript variables directly. The NetBeans JavaScript debugger makes an attempt to determine the type, which may not work in all scenarios. Hence in the Local Variables window, you may not see the actual type shown in the type column. In such cases, generic "Object" name is shown.

For example, the actual type is not shown for animElements or animElements._newEnum. Whereas type is shown for the rect variable.

Image:IELocalVariables_JavaScriptDebuggingWithInternetExplorer.png

A second difference between Firefox and IE, is that there is no parent scope node listed under the scope node.

Stepping Through Code

When the debugger is suspended at a line containing multiple JavaScript statements, choosing Step Over results in stepping over to the next statement in the same line. Therefore, the user sees the debugger stopped on the same line until all statements are stepped through. In the case of FireFox, the debugger executes all statements on the given line, then moves to next line.

The easiest way to move to next line is to use the Run to Cursor feature.

Image:IEStep_JavaScriptDebuggingWithInternetExplorer.png

Stopping on First Line

If the user has selected the option to Suspend on First Line, in Internet Explorer the debugger stops on the first JavaScript statement to be executed. (In FireFox, it stops on the first line of JavaScript code.)

For example, in the case of Internet Explorer, the debugger stops below on line 9, where as in the case of FireFox it stops on line 5.

Image:IESuspendOnFirstLine_JavaScriptDebuggingWithInternetExplorer.png

Exception handling

If the user has selected the option to Suspend on Exceptions, and if an exception is encountered during execution, the debugger suspends as it would for a breakpoint, but with a status of 'EXCEPTION'. The actual message for the exception is shown in the Console for the current debugging session.

Image:IEException_JavaScriptDebuggingWithInternetExplorer.png

Detaching Browser or Terminating Session

When the user terminates the session, either by shutting down the IDE or detaching the session, Internet Explorer continues to run normally.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo