Package io.webfolder.cdp.command
Interface Debugger
-
public interface Debugger
Debugger domain exposes JavaScript debugging capabilities It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc
-
-
Method Summary
Modifier and Type Method Description void
continueToLocation(Location location)
Continues execution until specific location is reached.void
continueToLocation(Location location, TargetCallFrames targetCallFrames)
Continues execution until specific location is reached.void
disable()
Disables debugger for given page.java.lang.String
enable()
Enables debugger for the given page.EvaluateOnCallFrameResult
evaluateOnCallFrame(java.lang.String callFrameId, java.lang.String expression)
Evaluates expression on a given call frame.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)
Evaluates expression on a given call frame.java.util.List<BreakLocation>
getPossibleBreakpoints(Location start)
Returns possible locations for breakpoint.java.util.List<BreakLocation>
getPossibleBreakpoints(Location start, Location end, java.lang.Boolean restrictToFunction)
Returns possible locations for breakpoint.java.lang.String
getScriptSource(java.lang.String scriptId)
Returns source for the script with given id.StackTrace
getStackTrace(StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId
.void
pause()
Stops on the next JavaScript statement.void
pauseOnAsyncCall(StackTraceId parentStackTraceId)
void
removeBreakpoint(java.lang.String breakpointId)
Removes JavaScript breakpoint.RestartFrameResult
restartFrame(java.lang.String callFrameId)
Restarts particular call frame from the beginning.void
resume()
Resumes JavaScript execution.void
scheduleStepIntoAsync()
This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead.java.util.List<SearchMatch>
searchInContent(java.lang.String scriptId, java.lang.String query)
Searches for given string in script content.java.util.List<SearchMatch>
searchInContent(java.lang.String scriptId, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
Searches for given string in script content.void
setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.void
setBlackboxedRanges(java.lang.String scriptId, java.util.List<ScriptPosition> positions)
Makes backend skip steps in the script in blackboxed ranges.void
setBlackboxPatterns(java.util.List<java.lang.String> patterns)
Replace previous blackbox patterns with passed ones.SetBreakpointResult
setBreakpoint(Location location)
Sets JavaScript breakpoint at a given location.SetBreakpointResult
setBreakpoint(Location location, java.lang.String condition)
Sets JavaScript breakpoint at a given location.SetBreakpointByUrlResult
setBreakpointByUrl(java.lang.Integer lineNumber)
Sets JavaScript breakpoint at given location specified either by URL or URL regex.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)
Sets JavaScript breakpoint at given location specified either by URL or URL regex.java.lang.String
setBreakpointOnFunctionCall(java.lang.String objectId)
Sets JavaScript breakpoint before each call to the given function.java.lang.String
setBreakpointOnFunctionCall(java.lang.String objectId, java.lang.String condition)
Sets JavaScript breakpoint before each call to the given function.void
setBreakpointsActive(java.lang.Boolean active)
Activates / deactivates all breakpoints on the page.void
setPauseOnExceptions(PauseOnExceptionState state)
Defines pause on exceptions state.void
setReturnValue(CallArgument newValue)
Changes return value in top frame.SetScriptSourceResult
setScriptSource(java.lang.String scriptId, java.lang.String scriptSource)
Edits JavaScript source live.SetScriptSourceResult
setScriptSource(java.lang.String scriptId, java.lang.String scriptSource, java.lang.Boolean dryRun)
Edits JavaScript source live.void
setSkipAllPauses(java.lang.Boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).void
setVariableValue(java.lang.Integer scopeNumber, java.lang.String variableName, CallArgument newValue, java.lang.String callFrameId)
Changes value of variable in a callframe.void
stepInto()
Steps into the function call.void
stepInto(java.lang.Boolean breakOnAsyncCall)
Steps into the function call.void
stepOut()
Steps out of the function call.void
stepOver()
Steps over the statement.
-
-
-
Method Detail
-
continueToLocation
void continueToLocation(Location location, TargetCallFrames targetCallFrames)
Continues execution until specific location is reached.- Parameters:
location
- Location to continue to.
-
disable
void disable()
Disables debugger for given page.
-
enable
java.lang.String enable()
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.- Returns:
- Unique identifier of the debugger.
-
evaluateOnCallFrame
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)
Evaluates expression on a given call frame.- 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 usingreleaseObjectGroup
).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. OverridessetPauseOnException
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
java.util.List<BreakLocation> getPossibleBreakpoints(Location start, Location end, java.lang.Boolean restrictToFunction)
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.- 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
java.lang.String getScriptSource(java.lang.String scriptId)
Returns source for the script with given id.- Parameters:
scriptId
- Id of the script to get source for.- Returns:
- Script source.
-
getStackTrace
StackTrace getStackTrace(StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId
.
-
pause
void pause()
Stops on the next JavaScript statement.
-
pauseOnAsyncCall
void pauseOnAsyncCall(StackTraceId parentStackTraceId)
-
removeBreakpoint
void removeBreakpoint(java.lang.String breakpointId)
Removes JavaScript breakpoint.
-
restartFrame
RestartFrameResult restartFrame(java.lang.String callFrameId)
Restarts particular call frame from the beginning.- Parameters:
callFrameId
- Call frame identifier to evaluate on.- Returns:
- RestartFrameResult
-
resume
void resume()
Resumes JavaScript execution.
-
scheduleStepIntoAsync
void scheduleStepIntoAsync()
This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called.
-
searchInContent
java.util.List<SearchMatch> searchInContent(java.lang.String scriptId, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
Searches for given string in script content.- 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
void setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.- Parameters:
maxDepth
- Maximum depth of async call stacks. Setting to0
will effectively disable collecting async call stacks (default).
-
setBlackboxPatterns
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.- Parameters:
patterns
- Array of regexps that will be used to check script url for blackbox state.
-
setBlackboxedRanges
void setBlackboxedRanges(java.lang.String 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.- Parameters:
scriptId
- Id of the script.
-
setBreakpoint
SetBreakpointResult setBreakpoint(Location location, java.lang.String condition)
Sets JavaScript breakpoint at a given location.- 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
-
setBreakpointByUrl
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)
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 inlocations
property. Further matching script parsing will result in subsequentbreakpointResolved
events issued. This logical breakpoint will survive page reloads.- 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. Eitherurl
orurlRegex
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
java.lang.String setBreakpointOnFunctionCall(java.lang.String objectId, 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.- 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
void setBreakpointsActive(java.lang.Boolean active)
Activates / deactivates all breakpoints on the page.- Parameters:
active
- New value for breakpoints active state.
-
setPauseOnExceptions
void setPauseOnExceptions(PauseOnExceptionState state)
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state isnone
.- Parameters:
state
- Pause on exceptions mode.
-
setReturnValue
void setReturnValue(CallArgument newValue)
Changes return value in top frame. Available only at return break position.- Parameters:
newValue
- New return value.
-
setScriptSource
SetScriptSourceResult setScriptSource(java.lang.String scriptId, java.lang.String scriptSource, java.lang.Boolean dryRun)
Edits JavaScript source live.- 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
void setSkipAllPauses(java.lang.Boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).- Parameters:
skip
- New value for skip pauses state.
-
setVariableValue
void setVariableValue(java.lang.Integer scopeNumber, java.lang.String variableName, CallArgument newValue, java.lang.String callFrameId)
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.- 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
void stepInto(java.lang.Boolean breakOnAsyncCall)
Steps into the function call.- Parameters:
breakOnAsyncCall
- Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause.
-
stepOut
void stepOut()
Steps out of the function call.
-
stepOver
void stepOver()
Steps over the statement.
-
continueToLocation
void continueToLocation(Location location)
Continues execution until specific location is reached.- Parameters:
location
- Location to continue to.
-
evaluateOnCallFrame
EvaluateOnCallFrameResult evaluateOnCallFrame(java.lang.String callFrameId, java.lang.String expression)
Evaluates expression on a given call frame.- Parameters:
callFrameId
- Call frame identifier to evaluate on.expression
- Expression to evaluate.- Returns:
- EvaluateOnCallFrameResult
-
getPossibleBreakpoints
java.util.List<BreakLocation> getPossibleBreakpoints(Location start)
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.- Parameters:
start
- Start of range to search possible breakpoint locations in.- Returns:
- List of the possible breakpoint locations.
-
searchInContent
java.util.List<SearchMatch> searchInContent(java.lang.String scriptId, java.lang.String query)
Searches for given string in script content.- Parameters:
scriptId
- Id of the script to search in.query
- String to search for.- Returns:
- List of search matches.
-
setBreakpoint
SetBreakpointResult setBreakpoint(Location location)
Sets JavaScript breakpoint at a given location.- Parameters:
location
- Location to set breakpoint in.- Returns:
- SetBreakpointResult
-
setBreakpointByUrl
SetBreakpointByUrlResult setBreakpointByUrl(java.lang.Integer lineNumber)
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 inlocations
property. Further matching script parsing will result in subsequentbreakpointResolved
events issued. This logical breakpoint will survive page reloads.- Parameters:
lineNumber
- Line number to set breakpoint at.- Returns:
- SetBreakpointByUrlResult
-
setBreakpointOnFunctionCall
java.lang.String setBreakpointOnFunctionCall(java.lang.String objectId)
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.- Parameters:
objectId
- Function object id.- Returns:
- Id of the created breakpoint for further reference.
-
setScriptSource
SetScriptSourceResult setScriptSource(java.lang.String scriptId, java.lang.String scriptSource)
Edits JavaScript source live.- Parameters:
scriptId
- Id of the script to edit.scriptSource
- New content of the script.- Returns:
- SetScriptSourceResult
-
stepInto
void stepInto()
Steps into the function call.
-
-