Class Debugger


  • public class Debugger
    extends java.lang.Object
    Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
    • Constructor Detail

      • Debugger

        public Debugger()
    • Method Detail

      • disable

        public static Command<java.lang.Void> disable()
        Disables debugger for given page.
      • enable

        public static Command<UniqueDebuggerId> enable​(java.util.Optional<java.lang.Number> maxScriptsCacheSize)
        Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
      • evaluateOnCallFrame

        public static Command<Debugger.EvaluateOnCallFrameResponse> evaluateOnCallFrame​(CallFrameId callFrameId,
                                                                                        java.lang.String expression,
                                                                                        java.util.Optional<java.lang.String> objectGroup,
                                                                                        java.util.Optional<java.lang.Boolean> includeCommandLineAPI,
                                                                                        java.util.Optional<java.lang.Boolean> silent,
                                                                                        java.util.Optional<java.lang.Boolean> returnByValue,
                                                                                        java.util.Optional<java.lang.Boolean> generatePreview,
                                                                                        java.util.Optional<java.lang.Boolean> throwOnSideEffect,
                                                                                        java.util.Optional<TimeDelta> timeout)
        Evaluates expression on a given call frame.
      • getPossibleBreakpoints

        public static Command<java.util.List<BreakLocation>> getPossibleBreakpoints​(Location start,
                                                                                    java.util.Optional<Location> end,
                                                                                    java.util.Optional<java.lang.Boolean> restrictToFunction)
        Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
      • getScriptSource

        public static Command<java.lang.String> getScriptSource​(ScriptId scriptId)
        Returns source for the script with given id.
      • getStackTrace

        @Beta
        public static Command<StackTrace> getStackTrace​(StackTraceId stackTraceId)
        Returns stack trace with given `stackTraceId`.
      • pause

        public static Command<java.lang.Void> pause()
        Stops on the next JavaScript statement.
      • pauseOnAsyncCall

        @Beta
        public static Command<java.lang.Void> pauseOnAsyncCall​(StackTraceId parentStackTraceId)
      • removeBreakpoint

        public static Command<java.lang.Void> removeBreakpoint​(BreakpointId breakpointId)
        Removes JavaScript breakpoint.
      • resume

        public static Command<java.lang.Void> resume()
        Resumes JavaScript execution.
      • searchInContent

        public static Command<java.util.List<SearchMatch>> searchInContent​(ScriptId scriptId,
                                                                           java.lang.String query,
                                                                           java.util.Optional<java.lang.Boolean> caseSensitive,
                                                                           java.util.Optional<java.lang.Boolean> isRegex)
        Searches for given string in script content.
      • setAsyncCallStackDepth

        public static Command<java.lang.Void> setAsyncCallStackDepth​(java.lang.Integer maxDepth)
        Enables or disables async call stacks tracking.
      • setBlackboxPatterns

        @Beta
        public static Command<java.lang.Void> setBlackboxPatterns​(java.util.List<java.lang.String> patterns)
        Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
      • setBlackboxedRanges

        @Beta
        public static Command<java.lang.Void> setBlackboxedRanges​(ScriptId scriptId,
                                                                  java.util.List<ScriptPosition> positions)
        Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
      • setBreakpointByUrl

        public static Command<Debugger.SetBreakpointByUrlResponse> setBreakpointByUrl​(java.lang.Integer lineNumber,
                                                                                      java.util.Optional<java.lang.String> url,
                                                                                      java.util.Optional<java.lang.String> urlRegex,
                                                                                      java.util.Optional<java.lang.String> scriptHash,
                                                                                      java.util.Optional<java.lang.Integer> columnNumber,
                                                                                      java.util.Optional<java.lang.String> condition)
        Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in `locations` property. Further matching script parsing will result in subsequent `breakpointResolved` events issued. This logical breakpoint will survive page reloads.
      • setBreakpointOnFunctionCall

        @Beta
        public static Command<BreakpointId> setBreakpointOnFunctionCall​(RemoteObjectId objectId,
                                                                        java.util.Optional<java.lang.String> condition)
        Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint.
      • setBreakpointsActive

        public static Command<java.lang.Void> setBreakpointsActive​(java.lang.Boolean active)
        Activates / deactivates all breakpoints on the page.
      • setPauseOnExceptions

        public static Command<java.lang.Void> setPauseOnExceptions​(Debugger.SetPauseOnExceptionsState state)
        Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is `none`.
      • setReturnValue

        @Beta
        public static Command<java.lang.Void> setReturnValue​(CallArgument newValue)
        Changes return value in top frame. Available only at return break position.
      • setSkipAllPauses

        public static Command<java.lang.Void> setSkipAllPauses​(java.lang.Boolean skip)
        Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
      • setVariableValue

        public static Command<java.lang.Void> setVariableValue​(java.lang.Integer scopeNumber,
                                                               java.lang.String variableName,
                                                               CallArgument newValue,
                                                               CallFrameId callFrameId)
        Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
      • stepInto

        public static Command<java.lang.Void> stepInto​(java.util.Optional<java.lang.Boolean> breakOnAsyncCall)
        Steps into the function call.
      • stepOut

        public static Command<java.lang.Void> stepOut()
        Steps out of the function call.
      • stepOver

        public static Command<java.lang.Void> stepOver()
        Steps over the statement.
      • resumed

        public static Event<java.lang.Void> resumed()