Class 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:
    HudsonTestCase.jsDebugger
    • Constructor Detail

      • JavaScriptDebugger

        public JavaScriptDebugger()
    • Method Detail

      • 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