org.jvnet.hudson.test.rhino
Class JavaScriptDebugger

java.lang.Object
  extended by org.jvnet.hudson.test.rhino.JavaScriptDebugger
All Implemented Interfaces:
org.mozilla.javascript.debug.Debugger

public class JavaScriptDebugger
extends java.lang.Object
implements org.mozilla.javascript.debug.Debugger

Monitors the execution of the JavaScript inside HtmlUnit, and provides debug information such as call stacks, variables, arguments, etc.

Usage

When you set a break point in Java code that are directly/indirectly invoked through JavaScript, use toString() to see the JavaScript stack trace (and variables at each stack frame.) This helps you see where the problem is.

TODO: add programmatic break point API, selective method invocation tracing, and allow arbitrary script evaluation in arbitrary stack frame.

Author:
Kohsuke Kawaguchi

Field Summary
 java.util.List<CallStackFrame> callStack
          Call stack as a list.
 
Constructor Summary
JavaScriptDebugger()
           
 
Method Summary
 org.mozilla.javascript.debug.DebugFrame getFrame(org.mozilla.javascript.Context cx, org.mozilla.javascript.debug.DebuggableScript fnOrScript)
           
 void handleCompilationDone(org.mozilla.javascript.Context cx, org.mozilla.javascript.debug.DebuggableScript fnOrScript, java.lang.String source)
           
 java.lang.String toString()
          Formats the current call stack into a human readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

callStack

public final java.util.List<CallStackFrame> callStack
Call stack as a list. The list grows at the end, so the first element in the list is the oldest stack frame.

Constructor Detail

JavaScriptDebugger

public JavaScriptDebugger()
Method Detail

handleCompilationDone

public void handleCompilationDone(org.mozilla.javascript.Context cx,
                                  org.mozilla.javascript.debug.DebuggableScript fnOrScript,
                                  java.lang.String source)
Specified by:
handleCompilationDone in interface org.mozilla.javascript.debug.Debugger

getFrame

public org.mozilla.javascript.debug.DebugFrame getFrame(org.mozilla.javascript.Context cx,
                                                        org.mozilla.javascript.debug.DebuggableScript fnOrScript)
Specified by:
getFrame in interface org.mozilla.javascript.debug.Debugger

toString

public java.lang.String toString()
Formats the current call stack into a human readable string.

Overrides:
toString in class java.lang.Object


Copyright © 2008. All Rights Reserved.