Class JavaScriptDebugger

java.lang.Object
org.jvnet.hudson.test.rhino.JavaScriptDebugger
All Implemented Interfaces:
org.htmlunit.corejs.javascript.debug.Debugger

public class JavaScriptDebugger extends Object implements org.htmlunit.corejs.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
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.htmlunit.corejs.javascript.debug.DebugFrame
    getFrame(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.debug.DebuggableScript fnOrScript)
     
    void
    handleCompilationDone(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.debug.DebuggableScript fnOrScript, String source)
     
    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
  • Constructor Details

    • JavaScriptDebugger

      public JavaScriptDebugger()
  • Method Details

    • handleCompilationDone

      public void handleCompilationDone(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.debug.DebuggableScript fnOrScript, String source)
      Specified by:
      handleCompilationDone in interface org.htmlunit.corejs.javascript.debug.Debugger
    • getFrame

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

      public String toString()
      Formats the current call stack into a human readable string.
      Overrides:
      toString in class Object