Specifications

Chapter 20244
4 When Dreamweaver finds a script tag or event handler, it calls the startBlock() function of
the module and passes in the name of the file and the line and character offsets from the
beginning of the file.
5 Dreamweaver begins parsing the JavaScript code in the block.
6 When Dreamweaver finds a JavaScript statement, such as a variable declaration, it calls
getStepInstrument(), passing the line and character offsets and other information. The
module returns a string of JavaScript code that is inserted before the statement. You must take
care to insert valid JavaScript code. For each call to
getStepInstrument(), Dreamweaver
records the line number as a valid breakpoint line regardless of the instrumentation that
returns. So, when the debugger is started with
dw.startDebugger(), the breakpoints that are
already set by the user will be moved to one of these valid lines.
7 When Dreamweaver finds a function declaration, it calls getFunctionStartInstrument() to
receive the instrumentation to be inserted at the beginning of the function.
Note: This is not considered a valid breakpoint line.
8 Dreamweaver continues parsing the function, calling getStepInstrument() for each
statement in the function.
9 When Dreamweaver comes to a return statement, or the end of the function, it calls
getFunctionEndInstument() to receive the instrumentation to be inserted before the
function returns.
Note: This is not considered a valid breakpoint line.
10 If Dreamweaver encounters a syntax error or warning in the JavaScript block, it calls
reportError() or reportWarning(), respectively. After an error is encountered,
Dreamweaver stops parsing the block. Other blocks continue to be parsed.
11 After Dreamweaver has parsed all the script blocks in the HEAD section, it calls
getHeadInstrument() to get the HTML instrumentation to insert in the HEAD section.
Note: This function should return HTML, not JavaScript. If the module needs to insert JavaScript code in the
HEAD, it must enclose it in a SCRIPT tag.
12 Dreamweaver begins processing the JavaScript blocks (SCRIPT tags and event handlers) in the
BODY section of the document.
13 After the last block in the BODY section is processed, Dreamweaver calls
getBodyInstrument() to get the HTML instrumentation to insert in the BODY section.
Note: This function should return HTML, not JavaScript.
14 After Dreamweaver calls getBodyInstrument(), there is one final call to startBlock() and
getStepInstrument() for an auto-breakpoint. The instrumentation does not correspond to
any user-defined
SCRIPT tag, but instead, it is inserted in a new SCRIPT tag after the BODY
instrumentation. Unlike other calls to
getStepInstrument(), this line is not considered a
valid line on which the user can set a breakpoint, but instead, it is treated as a special
breakpoint where the debugger always stops.
15 Finally, Dreamweaver calls getOnUnloadInstrument() to get JavaScript instrumentation to
be inserted in the
onUnload handler of the BODY tag. If the document already has an onUnload
handler, this instrumentation is inserted after the user-defined
onUnload code.