About debugging Web targets
You can debug server and client
scripts using the debugger for Web targets that you deploy to PowerDynamo.
Debugging for Web targets uses:
- For client
scripts, the JScript variant of JavaScript and Microsoft Internet
Explorer (IE) - For server scripts, the PowerDynamo DynaScript engine,
which is JavaScript-compatible
What you debug
Debugging lets you test your whole site or some subset of
it. After you deploy, you can navigate between pages, test links,
set breakpoints, and debug both client and server scripts. Debugging
an entire project requires that you set up your debugging environment
first.
You can debug only one frame or window containing client scripts
at a time. Script debugging is not supported when you simultaneously
display multiple frames or windows that contain client scripts.
How you debug
You debug your scripts by:
- Setting breakpoints
at one or more lines in scripts - At a breakpoint, examining the call stack and variables
in the current script - Stepping through scripts after you have paused at
a breakpoint
Requirements for debugging
Using the debugger
requires that scripts be written in JavaScript and use the Web Target
object model or the PowerDynamo native object model.
Where you deploy
To debug a target, you must deploy to the PowerDynamo application
server with debugging enabled in your deployment configuration.
You must deploy the project to PowerDynamo even if you will debug
only client scripts.
JavaScript language
The debugger supports scripts written in JavaScript. You can
write scripts in other languages, such as VBScript, but you cannot
debug them. When you deploy for debugging, the deployment engine
sets the language attribute of the Script element to DynaScript
(for debugging in PowerDynamo). DynaScript is fully compatible with
JavaScript.
Object model
For server scripts, you must use the Web Target object model
or the PowerDynamo native object model, so that the scripts run
on the PowerDynamo application server. If you use the Web Target
object model, scripts you debug on PowerDynamo should run correctly
on other supported application servers.
Identifiers in scripts
When you write an event handler script for an HTML object,
make sure you set the object’s NAME or ID attribute. IDs
or names let the debugger manage objects correctly.
The debugging environment
Three windows
(the Script editor, the Call Stack window, and the Watches window)
and the Microsoft Internet Explorer (IE 5.5) browser make up the debugging
environment.
When you start debugging, the Call Stack and Watches windows
open and the IE browser starts. When you reach a breakpoint in a
script, focus switches from the browser back to the Script editor.
An editor window opens with the page and script containing the breakpoint.
You can examine the script and look at the call stack and the variable
values.
The picture below displays breakpoints in server-side script,
with values for the page parameters displayed in the Watches window:
When you stop debugging, the Watches and the Call Stack windows,
as well as the IE browser, close.
Script editor
The Script editor (the lower pane of Page view in the HTML
editor) is the center of your debugging activity. You can set breakpoints
while you are editing or debugging. Breakpoints display in the left
margin as brown circles.
When you start debugging, the browser starts and displays
the starting page and runs scripts. When the script reaches a breakpoint,
the focus switches back to the Script editor, which displays the
current script. If the page is already open in the editor, the window
moves to the front.
While you are at a breakpoint, you can use the Script toolbar
to view other scripts, and you can open other pages in other editor
windows. In the script editor, you can set more breakpoints and
step through the paused script or step into another function call.
A blue arrow in the left margin marks the line of code about to
be executed.
When you resume debugging, focus returns to the browser. Then
you can take actions in the browser so that you get to another breakpoint.
You can also switch back to the editor and look at (but not change)
pages.
Call Stack window
The Call Stack window displays the scripts that called the
current script, back to the top-level script or event handler on
the page.
When you have paused in a top-level script or event handler,
the window shows only that script’s name or ID. If you
have paused in a function, the window shows the function, the script
that called the function, and the script that called that script,
back up to the event handler or top-level script that is still in progress.
If you click on an item in the Call Stack window, the Script
editor displays the script for the item you selected.
Watches window
The Watches window shows the objects and global variables
on the current page and local variables in the current script. They
are arranged in a tree structure. You can expand branches to view
properties and variables belonging to objects.
The Watches window is a dockable window. You can anchor it
to the IDE frame or float it.