Class DebuggerImpl

java.lang.Object
io.webfolder.cdp.command.DebuggerImpl
All Implemented Interfaces:
Debugger

public class DebuggerImpl
extends java.lang.Object
implements Debugger
  • Constructor Details

  • Method Details

    • continueToLocation

      public void continueToLocation​(Location location, TargetCallFrames targetCallFrames)
      Description copied from interface: Debugger
      Continues execution until specific location is reached.
      Specified by:
      continueToLocation in interface Debugger
      Parameters:
      location - Location to continue to.
    • disable

      public void disable()
      Description copied from interface: Debugger
      Disables debugger for given page.
      Specified by:
      disable in interface Debugger
    • enable

      public java.lang.String enable​(java.lang.Double maxScriptsCacheSize)
      Description copied from interface: Debugger
      Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
      Specified by:
      enable in interface Debugger
      Parameters:
      maxScriptsCacheSize - The maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if paramter is omitted.
      Returns:
      Unique identifier of the debugger.
    • evaluateOnCallFrame

      public EvaluateOnCallFrameResult evaluateOnCallFrame​(java.lang.String callFrameId, java.lang.String expression, java.lang.String objectGroup, java.lang.Boolean includeCommandLineAPI, java.lang.Boolean silent, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview, java.lang.Boolean throwOnSideEffect, java.lang.Double timeout)
      Description copied from interface: Debugger
      Evaluates expression on a given call frame.
      Specified by:
      evaluateOnCallFrame in interface Debugger
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      expression - Expression to evaluate.
      objectGroup - String object group name to put result into (allows rapid releasing resulting object handles using `releaseObjectGroup`).
      includeCommandLineAPI - Specifies whether command line API should be available to the evaluated expression, defaults to false.
      silent - In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides `setPauseOnException` state.
      returnByValue - Whether the result is expected to be a JSON object that should be sent by value.
      generatePreview - Whether preview should be generated for the result.
      throwOnSideEffect - Whether to throw an exception if side effect cannot be ruled out during evaluation.
      timeout - Terminate execution after timing out (number of milliseconds).
      Returns:
      EvaluateOnCallFrameResult
    • getPossibleBreakpoints

      public java.util.List<BreakLocation> getPossibleBreakpoints​(Location start, Location end, java.lang.Boolean restrictToFunction)
      Description copied from interface: Debugger
      Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
      Specified by:
      getPossibleBreakpoints in interface Debugger
      Parameters:
      start - Start of range to search possible breakpoint locations in.
      end - End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
      restrictToFunction - Only consider locations which are in the same (non-nested) function as start.
      Returns:
      List of the possible breakpoint locations.
    • getScriptSource

      public GetScriptSourceResult getScriptSource​(java.lang.String scriptId)
      Description copied from interface: Debugger
      Returns source for the script with given id.
      Specified by:
      getScriptSource in interface Debugger
      Parameters:
      scriptId - Id of the script to get source for.
      Returns:
      GetScriptSourceResult
    • getWasmBytecode

      public java.lang.String getWasmBytecode​(java.lang.String scriptId)
      Description copied from interface: Debugger
      This command is deprecated. Use getScriptSource instead.
      Specified by:
      getWasmBytecode in interface Debugger
      Parameters:
      scriptId - Id of the Wasm script to get source for.
      Returns:
      Script source.
    • getStackTrace

      public StackTrace getStackTrace​(StackTraceId stackTraceId)
      Description copied from interface: Debugger
      Returns stack trace with given `stackTraceId`.
      Specified by:
      getStackTrace in interface Debugger
    • pause

      public void pause()
      Description copied from interface: Debugger
      Stops on the next JavaScript statement.
      Specified by:
      pause in interface Debugger
    • pauseOnAsyncCall

      public void pauseOnAsyncCall​(StackTraceId parentStackTraceId)
      Specified by:
      pauseOnAsyncCall in interface Debugger
    • removeBreakpoint

      public void removeBreakpoint​(java.lang.String breakpointId)
      Description copied from interface: Debugger
      Removes JavaScript breakpoint.
      Specified by:
      removeBreakpoint in interface Debugger
    • restartFrame

      public RestartFrameResult restartFrame​(java.lang.String callFrameId)
      Description copied from interface: Debugger
      Restarts particular call frame from the beginning.
      Specified by:
      restartFrame in interface Debugger
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      Returns:
      RestartFrameResult
    • resume

      public void resume()
      Description copied from interface: Debugger
      Resumes JavaScript execution.
      Specified by:
      resume in interface Debugger
    • searchInContent

      public java.util.List<SearchMatch> searchInContent​(java.lang.String scriptId, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
      Description copied from interface: Debugger
      Searches for given string in script content.
      Specified by:
      searchInContent in interface Debugger
      Parameters:
      scriptId - Id of the script to search in.
      query - String to search for.
      caseSensitive - If true, search is case sensitive.
      isRegex - If true, treats string parameter as regex.
      Returns:
      List of search matches.
    • setAsyncCallStackDepth

      public void setAsyncCallStackDepth​(java.lang.Integer maxDepth)
      Description copied from interface: Debugger
      Enables or disables async call stacks tracking.
      Specified by:
      setAsyncCallStackDepth in interface Debugger
      Parameters:
      maxDepth - Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async call stacks (default).
    • setBlackboxPatterns

      public void setBlackboxPatterns​(java.util.List<java.lang.String> patterns)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBlackboxPatterns in interface Debugger
      Parameters:
      patterns - Array of regexps that will be used to check script url for blackbox state.
    • setBlackboxedRanges

      public void setBlackboxedRanges​(java.lang.String scriptId, java.util.List<ScriptPosition> positions)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBlackboxedRanges in interface Debugger
      Parameters:
      scriptId - Id of the script.
    • setBreakpoint

      public SetBreakpointResult setBreakpoint​(Location location, java.lang.String condition)
      Description copied from interface: Debugger
      Sets JavaScript breakpoint at a given location.
      Specified by:
      setBreakpoint in interface Debugger
      Parameters:
      location - Location to set breakpoint in.
      condition - Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
      Returns:
      SetBreakpointResult
    • setInstrumentationBreakpoint

      public java.lang.String setInstrumentationBreakpoint​(InstrumentationName instrumentation)
      Description copied from interface: Debugger
      Sets instrumentation breakpoint.
      Specified by:
      setInstrumentationBreakpoint in interface Debugger
      Parameters:
      instrumentation - Instrumentation name.
      Returns:
      Id of the created breakpoint for further reference.
    • setBreakpointByUrl

      public SetBreakpointByUrlResult setBreakpointByUrl​(java.lang.Integer lineNumber, java.lang.String url, java.lang.String urlRegex, java.lang.String scriptHash, java.lang.Integer columnNumber, java.lang.String condition)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBreakpointByUrl in interface Debugger
      Parameters:
      lineNumber - Line number to set breakpoint at.
      url - URL of the resources to set breakpoint on.
      urlRegex - Regex pattern for the URLs of the resources to set breakpoints on. Either `url` or `urlRegex` must be specified.
      scriptHash - Script hash of the resources to set breakpoint on.
      columnNumber - Offset in the line to set breakpoint at.
      condition - Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
      Returns:
      SetBreakpointByUrlResult
    • setBreakpointOnFunctionCall

      public java.lang.String setBreakpointOnFunctionCall​(java.lang.String objectId, java.lang.String condition)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBreakpointOnFunctionCall in interface Debugger
      Parameters:
      objectId - Function object id.
      condition - Expression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true.
      Returns:
      Id of the created breakpoint for further reference.
    • setBreakpointsActive

      public void setBreakpointsActive​(java.lang.Boolean active)
      Description copied from interface: Debugger
      Activates / deactivates all breakpoints on the page.
      Specified by:
      setBreakpointsActive in interface Debugger
      Parameters:
      active - New value for breakpoints active state.
    • setPauseOnExceptions

      public void setPauseOnExceptions​(PauseOnExceptionState state)
      Description copied from interface: Debugger
      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`.
      Specified by:
      setPauseOnExceptions in interface Debugger
      Parameters:
      state - Pause on exceptions mode.
    • setReturnValue

      public void setReturnValue​(CallArgument newValue)
      Description copied from interface: Debugger
      Changes return value in top frame. Available only at return break position.
      Specified by:
      setReturnValue in interface Debugger
      Parameters:
      newValue - New return value.
    • setScriptSource

      public SetScriptSourceResult setScriptSource​(java.lang.String scriptId, java.lang.String scriptSource, java.lang.Boolean dryRun)
      Description copied from interface: Debugger
      Edits JavaScript source live.
      Specified by:
      setScriptSource in interface Debugger
      Parameters:
      scriptId - Id of the script to edit.
      scriptSource - New content of the script.
      dryRun - If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
      Returns:
      SetScriptSourceResult
    • setSkipAllPauses

      public void setSkipAllPauses​(java.lang.Boolean skip)
      Description copied from interface: Debugger
      Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
      Specified by:
      setSkipAllPauses in interface Debugger
      Parameters:
      skip - New value for skip pauses state.
    • setVariableValue

      public void setVariableValue​(java.lang.Integer scopeNumber, java.lang.String variableName, CallArgument newValue, java.lang.String callFrameId)
      Description copied from interface: Debugger
      Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
      Specified by:
      setVariableValue in interface Debugger
      Parameters:
      scopeNumber - 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
      variableName - Variable name.
      newValue - New variable value.
      callFrameId - Id of callframe that holds variable.
    • stepInto

      public void stepInto​(java.lang.Boolean breakOnAsyncCall)
      Description copied from interface: Debugger
      Steps into the function call.
      Specified by:
      stepInto in interface Debugger
      Parameters:
      breakOnAsyncCall - Debugger will pause on the execution of the first async task which was scheduled before next pause.
    • stepOut

      public void stepOut()
      Description copied from interface: Debugger
      Steps out of the function call.
      Specified by:
      stepOut in interface Debugger
    • stepOver

      public void stepOver()
      Description copied from interface: Debugger
      Steps over the statement.
      Specified by:
      stepOver in interface Debugger
    • continueToLocation

      public void continueToLocation​(Location location)
      Description copied from interface: Debugger
      Continues execution until specific location is reached.
      Specified by:
      continueToLocation in interface Debugger
      Parameters:
      location - Location to continue to.
    • enable

      public java.lang.String enable()
      Description copied from interface: Debugger
      Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
      Specified by:
      enable in interface Debugger
      Returns:
      Unique identifier of the debugger.
    • evaluateOnCallFrame

      public EvaluateOnCallFrameResult evaluateOnCallFrame​(java.lang.String callFrameId, java.lang.String expression)
      Description copied from interface: Debugger
      Evaluates expression on a given call frame.
      Specified by:
      evaluateOnCallFrame in interface Debugger
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      expression - Expression to evaluate.
      Returns:
      EvaluateOnCallFrameResult
    • getPossibleBreakpoints

      public java.util.List<BreakLocation> getPossibleBreakpoints​(Location start)
      Description copied from interface: Debugger
      Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
      Specified by:
      getPossibleBreakpoints in interface Debugger
      Parameters:
      start - Start of range to search possible breakpoint locations in.
      Returns:
      List of the possible breakpoint locations.
    • searchInContent

      public java.util.List<SearchMatch> searchInContent​(java.lang.String scriptId, java.lang.String query)
      Description copied from interface: Debugger
      Searches for given string in script content.
      Specified by:
      searchInContent in interface Debugger
      Parameters:
      scriptId - Id of the script to search in.
      query - String to search for.
      Returns:
      List of search matches.
    • setBreakpoint

      public SetBreakpointResult setBreakpoint​(Location location)
      Description copied from interface: Debugger
      Sets JavaScript breakpoint at a given location.
      Specified by:
      setBreakpoint in interface Debugger
      Parameters:
      location - Location to set breakpoint in.
      Returns:
      SetBreakpointResult
    • setBreakpointByUrl

      public SetBreakpointByUrlResult setBreakpointByUrl​(java.lang.Integer lineNumber)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBreakpointByUrl in interface Debugger
      Parameters:
      lineNumber - Line number to set breakpoint at.
      Returns:
      SetBreakpointByUrlResult
    • setBreakpointOnFunctionCall

      public java.lang.String setBreakpointOnFunctionCall​(java.lang.String objectId)
      Description copied from interface: Debugger
      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.
      Specified by:
      setBreakpointOnFunctionCall in interface Debugger
      Parameters:
      objectId - Function object id.
      Returns:
      Id of the created breakpoint for further reference.
    • setScriptSource

      public SetScriptSourceResult setScriptSource​(java.lang.String scriptId, java.lang.String scriptSource)
      Description copied from interface: Debugger
      Edits JavaScript source live.
      Specified by:
      setScriptSource in interface Debugger
      Parameters:
      scriptId - Id of the script to edit.
      scriptSource - New content of the script.
      Returns:
      SetScriptSourceResult
    • stepInto

      public void stepInto()
      Description copied from interface: Debugger
      Steps into the function call.
      Specified by:
      stepInto in interface Debugger