Class JavaScriptDebugger

  • All Implemented Interfaces:
    net.sourceforge.htmlunit.corejs.javascript.debug.Debugger

    public class JavaScriptDebugger
    extends Object
    implements net.sourceforge.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:
    HudsonTestCase.jsDebugger
    • Constructor Detail

      • JavaScriptDebugger

        public JavaScriptDebugger()
    • Method Detail

      • handleCompilationDone

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

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

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