2017-01-24 15:09:23 +00:00
// Package debugger provides the Chrome Debugging Protocol
2017-02-12 04:59:33 +00:00
// commands, types, and events for the Debugger domain.
2017-01-24 15:09:23 +00:00
//
// Debugger domain exposes JavaScript debugging capabilities. It allows
// setting and removing breakpoints, stepping through execution, exploring stack
// traces, etc.
//
// Generated by the chromedp-gen command.
package debugger
2017-07-09 02:05:19 +00:00
// Code generated by chromedp-gen. DO NOT EDIT.
2017-01-24 15:09:23 +00:00
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
"github.com/knq/chromedp/cdp/runtime"
)
// EnableParams enables debugger for the given page. Clients should not
// assume that the debugging has been enabled until the result for this command
// is received.
type EnableParams struct { }
// 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.
func Enable ( ) * EnableParams {
return & EnableParams { }
}
2017-11-28 02:41:21 +00:00
// EnableReturns return values.
type EnableReturns struct {
DebuggerID runtime . UniqueDebuggerID ` json:"debuggerId,omitempty" ` // Unique identifier of the debugger.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.enable against the provided context and
// target handler.
2017-11-28 02:41:21 +00:00
//
// returns:
// debuggerID - Unique identifier of the debugger.
func ( p * EnableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( debuggerID runtime . UniqueDebuggerID , err error ) {
// execute
var res EnableReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerEnable , nil , & res )
if err != nil {
return "" , err
}
return res . DebuggerID , nil
2017-01-24 15:09:23 +00:00
}
// DisableParams disables debugger for given page.
type DisableParams struct { }
// Disable disables debugger for given page.
func Disable ( ) * DisableParams {
return & DisableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.disable against the provided context and
// target handler.
func ( p * DisableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerDisable , nil , nil )
2017-01-24 15:09:23 +00:00
}
// SetBreakpointsActiveParams activates / deactivates all breakpoints on the
// page.
type SetBreakpointsActiveParams struct {
Active bool ` json:"active" ` // New value for breakpoints active state.
}
// SetBreakpointsActive activates / deactivates all breakpoints on the page.
//
// parameters:
// active - New value for breakpoints active state.
func SetBreakpointsActive ( active bool ) * SetBreakpointsActiveParams {
return & SetBreakpointsActiveParams {
Active : active ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setBreakpointsActive against the provided context and
// target handler.
func ( p * SetBreakpointsActiveParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetBreakpointsActive , p , nil )
2017-01-24 15:09:23 +00:00
}
// SetSkipAllPausesParams makes page not interrupt on any pauses (breakpoint,
// exception, dom exception etc).
type SetSkipAllPausesParams struct {
Skip bool ` json:"skip" ` // New value for skip pauses state.
}
// SetSkipAllPauses makes page not interrupt on any pauses (breakpoint,
// exception, dom exception etc).
//
// parameters:
// skip - New value for skip pauses state.
func SetSkipAllPauses ( skip bool ) * SetSkipAllPausesParams {
return & SetSkipAllPausesParams {
Skip : skip ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setSkipAllPauses against the provided context and
// target handler.
func ( p * SetSkipAllPausesParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetSkipAllPauses , p , nil )
2017-01-24 15:09:23 +00:00
}
// SetBreakpointByURLParams 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.
type SetBreakpointByURLParams struct {
LineNumber int64 ` json:"lineNumber" ` // Line number to set breakpoint at.
URL string ` json:"url,omitempty" ` // URL of the resources to set breakpoint on.
URLRegex string ` json:"urlRegex,omitempty" ` // Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.
2017-10-15 05:47:06 +00:00
ScriptHash string ` json:"scriptHash,omitempty" ` // Script hash of the resources to set breakpoint on.
2017-01-24 15:09:23 +00:00
ColumnNumber int64 ` json:"columnNumber,omitempty" ` // Offset in the line to set breakpoint at.
Condition string ` json:"condition,omitempty" ` // Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
}
// SetBreakpointByURL 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.
//
// parameters:
// lineNumber - Line number to set breakpoint at.
func SetBreakpointByURL ( lineNumber int64 ) * SetBreakpointByURLParams {
return & SetBreakpointByURLParams {
LineNumber : lineNumber ,
}
}
2017-09-28 08:41:05 +00:00
// WithURL URL of the resources to set breakpoint on.
2017-01-24 15:09:23 +00:00
func ( p SetBreakpointByURLParams ) WithURL ( url string ) * SetBreakpointByURLParams {
p . URL = url
return & p
}
// WithURLRegex regex pattern for the URLs of the resources to set
// breakpoints on. Either url or urlRegex must be specified.
func ( p SetBreakpointByURLParams ) WithURLRegex ( urlRegex string ) * SetBreakpointByURLParams {
p . URLRegex = urlRegex
return & p
}
2017-10-15 05:47:06 +00:00
// WithScriptHash script hash of the resources to set breakpoint on.
func ( p SetBreakpointByURLParams ) WithScriptHash ( scriptHash string ) * SetBreakpointByURLParams {
p . ScriptHash = scriptHash
return & p
}
2017-01-24 15:09:23 +00:00
// WithColumnNumber offset in the line to set breakpoint at.
func ( p SetBreakpointByURLParams ) WithColumnNumber ( columnNumber int64 ) * SetBreakpointByURLParams {
p . ColumnNumber = columnNumber
return & p
}
// WithCondition expression to use as a breakpoint condition. When specified,
// debugger will only stop on the breakpoint if this expression evaluates to
// true.
func ( p SetBreakpointByURLParams ) WithCondition ( condition string ) * SetBreakpointByURLParams {
p . Condition = condition
return & p
}
// SetBreakpointByURLReturns return values.
type SetBreakpointByURLReturns struct {
BreakpointID BreakpointID ` json:"breakpointId,omitempty" ` // Id of the created breakpoint for further reference.
Locations [ ] * Location ` json:"locations,omitempty" ` // List of the locations this breakpoint resolved into upon addition.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setBreakpointByUrl against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// breakpointID - Id of the created breakpoint for further reference.
2017-01-24 15:09:23 +00:00
// locations - List of the locations this breakpoint resolved into upon addition.
2017-02-12 04:59:33 +00:00
func ( p * SetBreakpointByURLParams ) Do ( ctxt context . Context , h cdp . Handler ) ( breakpointID BreakpointID , locations [ ] * Location , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetBreakpointByURLReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerSetBreakpointByURL , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , nil , err
}
2017-02-14 08:41:23 +00:00
return res . BreakpointID , res . Locations , nil
2017-01-24 15:09:23 +00:00
}
// SetBreakpointParams sets JavaScript breakpoint at a given location.
type SetBreakpointParams struct {
Location * Location ` json:"location" ` // Location to set breakpoint in.
Condition string ` json:"condition,omitempty" ` // Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
}
// SetBreakpoint sets JavaScript breakpoint at a given location.
//
// parameters:
// location - Location to set breakpoint in.
func SetBreakpoint ( location * Location ) * SetBreakpointParams {
return & SetBreakpointParams {
Location : location ,
}
}
// WithCondition expression to use as a breakpoint condition. When specified,
// debugger will only stop on the breakpoint if this expression evaluates to
// true.
func ( p SetBreakpointParams ) WithCondition ( condition string ) * SetBreakpointParams {
p . Condition = condition
return & p
}
// SetBreakpointReturns return values.
type SetBreakpointReturns struct {
BreakpointID BreakpointID ` json:"breakpointId,omitempty" ` // Id of the created breakpoint for further reference.
ActualLocation * Location ` json:"actualLocation,omitempty" ` // Location this breakpoint resolved into.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setBreakpoint against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// breakpointID - Id of the created breakpoint for further reference.
2017-01-24 15:09:23 +00:00
// actualLocation - Location this breakpoint resolved into.
2017-02-12 04:59:33 +00:00
func ( p * SetBreakpointParams ) Do ( ctxt context . Context , h cdp . Handler ) ( breakpointID BreakpointID , actualLocation * Location , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetBreakpointReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerSetBreakpoint , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , nil , err
}
2017-02-14 08:41:23 +00:00
return res . BreakpointID , res . ActualLocation , nil
2017-01-24 15:09:23 +00:00
}
// RemoveBreakpointParams removes JavaScript breakpoint.
type RemoveBreakpointParams struct {
BreakpointID BreakpointID ` json:"breakpointId" `
}
// RemoveBreakpoint removes JavaScript breakpoint.
//
// parameters:
2017-01-26 07:28:34 +00:00
// breakpointID
func RemoveBreakpoint ( breakpointID BreakpointID ) * RemoveBreakpointParams {
2017-01-24 15:09:23 +00:00
return & RemoveBreakpointParams {
2017-01-26 07:28:34 +00:00
BreakpointID : breakpointID ,
2017-01-24 15:09:23 +00:00
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.removeBreakpoint against the provided context and
// target handler.
func ( p * RemoveBreakpointParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerRemoveBreakpoint , p , nil )
2017-01-24 15:09:23 +00:00
}
// GetPossibleBreakpointsParams returns possible locations for breakpoint.
// scriptId in start and end range locations should be the same.
type GetPossibleBreakpointsParams struct {
2017-03-02 01:16:48 +00:00
Start * Location ` json:"start" ` // Start of range to search possible breakpoint locations in.
2017-03-02 03:24:35 +00:00
End * Location ` json:"end,omitempty" ` // End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
2017-03-02 01:16:48 +00:00
RestrictToFunction bool ` json:"restrictToFunction,omitempty" ` // Only consider locations which are in the same (non-nested) function as start.
2017-01-24 15:09:23 +00:00
}
// GetPossibleBreakpoints 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.
func GetPossibleBreakpoints ( start * Location ) * GetPossibleBreakpointsParams {
return & GetPossibleBreakpointsParams {
Start : start ,
}
}
// WithEnd end of range to search possible breakpoint locations in
2017-03-02 03:24:35 +00:00
// (excluding). When not specified, end of scripts is used as end of range.
2017-01-24 15:09:23 +00:00
func ( p GetPossibleBreakpointsParams ) WithEnd ( end * Location ) * GetPossibleBreakpointsParams {
p . End = end
return & p
}
2017-03-02 01:16:48 +00:00
// WithRestrictToFunction only consider locations which are in the same
// (non-nested) function as start.
func ( p GetPossibleBreakpointsParams ) WithRestrictToFunction ( restrictToFunction bool ) * GetPossibleBreakpointsParams {
p . RestrictToFunction = restrictToFunction
return & p
}
2017-01-24 15:09:23 +00:00
// GetPossibleBreakpointsReturns return values.
type GetPossibleBreakpointsReturns struct {
2017-03-13 02:29:26 +00:00
Locations [ ] * BreakLocation ` json:"locations,omitempty" ` // List of the possible breakpoint locations.
2017-01-24 15:09:23 +00:00
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.getPossibleBreakpoints against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// locations - List of the possible breakpoint locations.
2017-03-13 02:29:26 +00:00
func ( p * GetPossibleBreakpointsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( locations [ ] * BreakLocation , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetPossibleBreakpointsReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerGetPossibleBreakpoints , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Locations , nil
2017-01-24 15:09:23 +00:00
}
// ContinueToLocationParams continues execution until specific location is
// reached.
type ContinueToLocationParams struct {
2017-05-19 01:09:21 +00:00
Location * Location ` json:"location" ` // Location to continue to.
TargetCallFrames ContinueToLocationTargetCallFrames ` json:"targetCallFrames,omitempty" `
2017-01-24 15:09:23 +00:00
}
// ContinueToLocation continues execution until specific location is reached.
//
// parameters:
// location - Location to continue to.
func ContinueToLocation ( location * Location ) * ContinueToLocationParams {
return & ContinueToLocationParams {
Location : location ,
}
}
2017-05-19 01:09:21 +00:00
// WithTargetCallFrames [no description].
func ( p ContinueToLocationParams ) WithTargetCallFrames ( targetCallFrames ContinueToLocationTargetCallFrames ) * ContinueToLocationParams {
p . TargetCallFrames = targetCallFrames
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.continueToLocation against the provided context and
// target handler.
func ( p * ContinueToLocationParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerContinueToLocation , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-11-28 02:41:21 +00:00
// PauseOnAsyncCallParams [no description].
type PauseOnAsyncCallParams struct {
ParentStackTraceID * runtime . StackTraceID ` json:"parentStackTraceId" ` // Debugger will pause when async call with given stack trace is started.
2017-11-22 05:01:27 +00:00
}
2017-11-28 02:41:21 +00:00
// PauseOnAsyncCall [no description].
2017-11-22 05:01:27 +00:00
//
// parameters:
2017-11-28 02:41:21 +00:00
// parentStackTraceID - Debugger will pause when async call with given stack trace is started.
func PauseOnAsyncCall ( parentStackTraceID * runtime . StackTraceID ) * PauseOnAsyncCallParams {
return & PauseOnAsyncCallParams {
ParentStackTraceID : parentStackTraceID ,
2017-11-22 05:01:27 +00:00
}
}
2017-11-28 02:41:21 +00:00
// Do executes Debugger.pauseOnAsyncCall against the provided context and
2017-11-22 05:01:27 +00:00
// target handler.
2017-11-28 02:41:21 +00:00
func ( p * PauseOnAsyncCallParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
return h . Execute ( ctxt , cdp . CommandDebuggerPauseOnAsyncCall , p , nil )
2017-11-22 05:01:27 +00:00
}
2017-01-24 15:09:23 +00:00
// StepOverParams steps over the statement.
type StepOverParams struct { }
// StepOver steps over the statement.
func StepOver ( ) * StepOverParams {
return & StepOverParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.stepOver against the provided context and
// target handler.
func ( p * StepOverParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerStepOver , nil , nil )
2017-01-24 15:09:23 +00:00
}
// StepIntoParams steps into the function call.
2017-11-22 05:01:27 +00:00
type StepIntoParams struct {
BreakOnAsyncCall bool ` json:"breakOnAsyncCall,omitempty" ` // Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause.
}
2017-01-24 15:09:23 +00:00
// StepInto steps into the function call.
2017-11-22 05:01:27 +00:00
//
// parameters:
2017-01-24 15:09:23 +00:00
func StepInto ( ) * StepIntoParams {
return & StepIntoParams { }
}
2017-11-22 05:01:27 +00:00
// WithBreakOnAsyncCall debugger will issue additional Debugger.paused
// notification if any async task is scheduled before next pause.
func ( p StepIntoParams ) WithBreakOnAsyncCall ( breakOnAsyncCall bool ) * StepIntoParams {
p . BreakOnAsyncCall = breakOnAsyncCall
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.stepInto against the provided context and
// target handler.
func ( p * StepIntoParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-11-22 05:01:27 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerStepInto , p , nil )
2017-01-24 15:09:23 +00:00
}
// StepOutParams steps out of the function call.
type StepOutParams struct { }
// StepOut steps out of the function call.
func StepOut ( ) * StepOutParams {
return & StepOutParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.stepOut against the provided context and
// target handler.
func ( p * StepOutParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerStepOut , nil , nil )
2017-01-24 15:09:23 +00:00
}
// PauseParams stops on the next JavaScript statement.
type PauseParams struct { }
// Pause stops on the next JavaScript statement.
func Pause ( ) * PauseParams {
return & PauseParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.pause against the provided context and
// target handler.
func ( p * PauseParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerPause , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-11-22 05:01:27 +00:00
// ScheduleStepIntoAsyncParams 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.
2017-03-13 02:29:26 +00:00
type ScheduleStepIntoAsyncParams struct { }
2017-11-22 05:01:27 +00:00
// 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.
2017-03-13 02:29:26 +00:00
func ScheduleStepIntoAsync ( ) * ScheduleStepIntoAsyncParams {
return & ScheduleStepIntoAsyncParams { }
}
// Do executes Debugger.scheduleStepIntoAsync against the provided context and
// target handler.
func ( p * ScheduleStepIntoAsyncParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
return h . Execute ( ctxt , cdp . CommandDebuggerScheduleStepIntoAsync , nil , nil )
}
2017-01-24 15:09:23 +00:00
// ResumeParams resumes JavaScript execution.
type ResumeParams struct { }
// Resume resumes JavaScript execution.
func Resume ( ) * ResumeParams {
return & ResumeParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.resume against the provided context and
// target handler.
func ( p * ResumeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerResume , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-11-28 02:41:21 +00:00
// GetStackTraceParams returns stack trace with given stackTraceId.
type GetStackTraceParams struct {
StackTraceID * runtime . StackTraceID ` json:"stackTraceId" `
}
// GetStackTrace returns stack trace with given stackTraceId.
//
// parameters:
// stackTraceID
func GetStackTrace ( stackTraceID * runtime . StackTraceID ) * GetStackTraceParams {
return & GetStackTraceParams {
StackTraceID : stackTraceID ,
}
}
// GetStackTraceReturns return values.
type GetStackTraceReturns struct {
StackTrace * runtime . StackTrace ` json:"stackTrace,omitempty" `
}
// Do executes Debugger.getStackTrace against the provided context and
// target handler.
//
// returns:
// stackTrace
func ( p * GetStackTraceParams ) Do ( ctxt context . Context , h cdp . Handler ) ( stackTrace * runtime . StackTrace , err error ) {
// execute
var res GetStackTraceReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerGetStackTrace , p , & res )
if err != nil {
return nil , err
}
return res . StackTrace , nil
}
2017-01-24 15:09:23 +00:00
// SearchInContentParams searches for given string in script content.
type SearchInContentParams struct {
ScriptID runtime . ScriptID ` json:"scriptId" ` // Id of the script to search in.
Query string ` json:"query" ` // String to search for.
CaseSensitive bool ` json:"caseSensitive,omitempty" ` // If true, search is case sensitive.
IsRegex bool ` json:"isRegex,omitempty" ` // If true, treats string parameter as regex.
}
// SearchInContent searches for given string in script content.
//
// parameters:
2017-01-26 07:28:34 +00:00
// scriptID - Id of the script to search in.
2017-01-24 15:09:23 +00:00
// query - String to search for.
2017-01-26 07:28:34 +00:00
func SearchInContent ( scriptID runtime . ScriptID , query string ) * SearchInContentParams {
2017-01-24 15:09:23 +00:00
return & SearchInContentParams {
2017-01-26 07:28:34 +00:00
ScriptID : scriptID ,
2017-01-24 15:09:23 +00:00
Query : query ,
}
}
// WithCaseSensitive if true, search is case sensitive.
func ( p SearchInContentParams ) WithCaseSensitive ( caseSensitive bool ) * SearchInContentParams {
p . CaseSensitive = caseSensitive
return & p
}
// WithIsRegex if true, treats string parameter as regex.
func ( p SearchInContentParams ) WithIsRegex ( isRegex bool ) * SearchInContentParams {
p . IsRegex = isRegex
return & p
}
// SearchInContentReturns return values.
type SearchInContentReturns struct {
Result [ ] * SearchMatch ` json:"result,omitempty" ` // List of search matches.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.searchInContent against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// result - List of search matches.
2017-02-12 04:59:33 +00:00
func ( p * SearchInContentParams ) Do ( ctxt context . Context , h cdp . Handler ) ( result [ ] * SearchMatch , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SearchInContentReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerSearchInContent , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Result , nil
2017-01-24 15:09:23 +00:00
}
// SetScriptSourceParams edits JavaScript source live.
type SetScriptSourceParams struct {
ScriptID runtime . ScriptID ` json:"scriptId" ` // Id of the script to edit.
ScriptSource string ` json:"scriptSource" ` // New content of the script.
DryRun bool ` json:"dryRun,omitempty" ` // If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
}
// SetScriptSource edits JavaScript source live.
//
// parameters:
2017-01-26 07:28:34 +00:00
// scriptID - Id of the script to edit.
2017-01-24 15:09:23 +00:00
// scriptSource - New content of the script.
2017-01-26 07:28:34 +00:00
func SetScriptSource ( scriptID runtime . ScriptID , scriptSource string ) * SetScriptSourceParams {
2017-01-24 15:09:23 +00:00
return & SetScriptSourceParams {
2017-01-26 07:28:34 +00:00
ScriptID : scriptID ,
2017-01-24 15:09:23 +00:00
ScriptSource : scriptSource ,
}
}
2017-09-28 08:41:05 +00:00
// WithDryRun if true the change will not actually be applied. Dry run may be
2017-01-24 15:09:23 +00:00
// used to get result description without actually modifying the code.
func ( p SetScriptSourceParams ) WithDryRun ( dryRun bool ) * SetScriptSourceParams {
p . DryRun = dryRun
return & p
}
// SetScriptSourceReturns return values.
type SetScriptSourceReturns struct {
2017-11-28 02:41:21 +00:00
CallFrames [ ] * CallFrame ` json:"callFrames,omitempty" ` // New stack trace in case editing has happened while VM was stopped.
StackChanged bool ` json:"stackChanged,omitempty" ` // Whether current call stack was modified after applying the changes.
AsyncStackTrace * runtime . StackTrace ` json:"asyncStackTrace,omitempty" ` // Async stack trace, if any.
AsyncStackTraceID * runtime . StackTraceID ` json:"asyncStackTraceId,omitempty" ` // Async stack trace, if any.
ExceptionDetails * runtime . ExceptionDetails ` json:"exceptionDetails,omitempty" ` // Exception details if any.
2017-01-24 15:09:23 +00:00
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setScriptSource against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// callFrames - New stack trace in case editing has happened while VM was stopped.
// stackChanged - Whether current call stack was modified after applying the changes.
// asyncStackTrace - Async stack trace, if any.
2017-11-28 02:41:21 +00:00
// asyncStackTraceID - Async stack trace, if any.
2017-01-24 15:09:23 +00:00
// exceptionDetails - Exception details if any.
2017-11-28 02:41:21 +00:00
func ( p * SetScriptSourceParams ) Do ( ctxt context . Context , h cdp . Handler ) ( callFrames [ ] * CallFrame , stackChanged bool , asyncStackTrace * runtime . StackTrace , asyncStackTraceID * runtime . StackTraceID , exceptionDetails * runtime . ExceptionDetails , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetScriptSourceReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerSetScriptSource , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
2017-11-28 02:41:21 +00:00
return nil , false , nil , nil , nil , err
2017-01-24 15:09:23 +00:00
}
2017-11-28 02:41:21 +00:00
return res . CallFrames , res . StackChanged , res . AsyncStackTrace , res . AsyncStackTraceID , res . ExceptionDetails , nil
2017-01-24 15:09:23 +00:00
}
// RestartFrameParams restarts particular call frame from the beginning.
type RestartFrameParams struct {
CallFrameID CallFrameID ` json:"callFrameId" ` // Call frame identifier to evaluate on.
}
// RestartFrame restarts particular call frame from the beginning.
//
// parameters:
2017-01-26 07:28:34 +00:00
// callFrameID - Call frame identifier to evaluate on.
func RestartFrame ( callFrameID CallFrameID ) * RestartFrameParams {
2017-01-24 15:09:23 +00:00
return & RestartFrameParams {
2017-01-26 07:28:34 +00:00
CallFrameID : callFrameID ,
2017-01-24 15:09:23 +00:00
}
}
// RestartFrameReturns return values.
type RestartFrameReturns struct {
2017-11-28 02:41:21 +00:00
CallFrames [ ] * CallFrame ` json:"callFrames,omitempty" ` // New stack trace.
AsyncStackTrace * runtime . StackTrace ` json:"asyncStackTrace,omitempty" ` // Async stack trace, if any.
AsyncStackTraceID * runtime . StackTraceID ` json:"asyncStackTraceId,omitempty" ` // Async stack trace, if any.
2017-01-24 15:09:23 +00:00
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.restartFrame against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// callFrames - New stack trace.
// asyncStackTrace - Async stack trace, if any.
2017-11-28 02:41:21 +00:00
// asyncStackTraceID - Async stack trace, if any.
func ( p * RestartFrameParams ) Do ( ctxt context . Context , h cdp . Handler ) ( callFrames [ ] * CallFrame , asyncStackTrace * runtime . StackTrace , asyncStackTraceID * runtime . StackTraceID , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res RestartFrameReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerRestartFrame , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
2017-11-28 02:41:21 +00:00
return nil , nil , nil , err
2017-01-24 15:09:23 +00:00
}
2017-11-28 02:41:21 +00:00
return res . CallFrames , res . AsyncStackTrace , res . AsyncStackTraceID , nil
2017-01-24 15:09:23 +00:00
}
// GetScriptSourceParams returns source for the script with given id.
type GetScriptSourceParams struct {
ScriptID runtime . ScriptID ` json:"scriptId" ` // Id of the script to get source for.
}
// GetScriptSource returns source for the script with given id.
//
// parameters:
2017-01-26 07:28:34 +00:00
// scriptID - Id of the script to get source for.
func GetScriptSource ( scriptID runtime . ScriptID ) * GetScriptSourceParams {
2017-01-24 15:09:23 +00:00
return & GetScriptSourceParams {
2017-01-26 07:28:34 +00:00
ScriptID : scriptID ,
2017-01-24 15:09:23 +00:00
}
}
// GetScriptSourceReturns return values.
type GetScriptSourceReturns struct {
ScriptSource string ` json:"scriptSource,omitempty" ` // Script source.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.getScriptSource against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// scriptSource - Script source.
2017-02-12 04:59:33 +00:00
func ( p * GetScriptSourceParams ) Do ( ctxt context . Context , h cdp . Handler ) ( scriptSource string , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetScriptSourceReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerGetScriptSource , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , err
}
2017-02-14 08:41:23 +00:00
return res . ScriptSource , nil
2017-01-24 15:09:23 +00:00
}
// SetPauseOnExceptionsParams 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.
type SetPauseOnExceptionsParams struct {
State ExceptionsState ` json:"state" ` // Pause on exceptions mode.
}
// SetPauseOnExceptions 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.
//
// parameters:
// state - Pause on exceptions mode.
func SetPauseOnExceptions ( state ExceptionsState ) * SetPauseOnExceptionsParams {
return & SetPauseOnExceptionsParams {
State : state ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setPauseOnExceptions against the provided context and
// target handler.
func ( p * SetPauseOnExceptionsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetPauseOnExceptions , p , nil )
2017-01-24 15:09:23 +00:00
}
// EvaluateOnCallFrameParams evaluates expression on a given call frame.
type EvaluateOnCallFrameParams struct {
CallFrameID CallFrameID ` json:"callFrameId" ` // Call frame identifier to evaluate on.
Expression string ` json:"expression" ` // Expression to evaluate.
ObjectGroup string ` json:"objectGroup,omitempty" ` // String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).
IncludeCommandLineAPI bool ` json:"includeCommandLineAPI,omitempty" ` // Specifies whether command line API should be available to the evaluated expression, defaults to false.
Silent bool ` json:"silent,omitempty" ` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
ReturnByValue bool ` json:"returnByValue,omitempty" ` // Whether the result is expected to be a JSON object that should be sent by value.
GeneratePreview bool ` json:"generatePreview,omitempty" ` // Whether preview should be generated for the result.
2017-02-09 06:45:44 +00:00
ThrowOnSideEffect bool ` json:"throwOnSideEffect,omitempty" ` // Whether to throw an exception if side effect cannot be ruled out during evaluation.
2017-01-24 15:09:23 +00:00
}
// EvaluateOnCallFrame evaluates expression on a given call frame.
//
// parameters:
2017-01-26 07:28:34 +00:00
// callFrameID - Call frame identifier to evaluate on.
2017-01-24 15:09:23 +00:00
// expression - Expression to evaluate.
2017-01-26 07:28:34 +00:00
func EvaluateOnCallFrame ( callFrameID CallFrameID , expression string ) * EvaluateOnCallFrameParams {
2017-01-24 15:09:23 +00:00
return & EvaluateOnCallFrameParams {
2017-01-26 07:28:34 +00:00
CallFrameID : callFrameID ,
2017-01-24 15:09:23 +00:00
Expression : expression ,
}
}
// WithObjectGroup string object group name to put result into (allows rapid
// releasing resulting object handles using releaseObjectGroup).
func ( p EvaluateOnCallFrameParams ) WithObjectGroup ( objectGroup string ) * EvaluateOnCallFrameParams {
p . ObjectGroup = objectGroup
return & p
}
// WithIncludeCommandLineAPI specifies whether command line API should be
// available to the evaluated expression, defaults to false.
func ( p EvaluateOnCallFrameParams ) WithIncludeCommandLineAPI ( includeCommandLineAPI bool ) * EvaluateOnCallFrameParams {
p . IncludeCommandLineAPI = includeCommandLineAPI
return & p
}
// WithSilent in silent mode exceptions thrown during evaluation are not
// reported and do not pause execution. Overrides setPauseOnException state.
func ( p EvaluateOnCallFrameParams ) WithSilent ( silent bool ) * EvaluateOnCallFrameParams {
p . Silent = silent
return & p
}
// WithReturnByValue whether the result is expected to be a JSON object that
// should be sent by value.
func ( p EvaluateOnCallFrameParams ) WithReturnByValue ( returnByValue bool ) * EvaluateOnCallFrameParams {
p . ReturnByValue = returnByValue
return & p
}
// WithGeneratePreview whether preview should be generated for the result.
func ( p EvaluateOnCallFrameParams ) WithGeneratePreview ( generatePreview bool ) * EvaluateOnCallFrameParams {
p . GeneratePreview = generatePreview
return & p
}
2017-02-09 06:45:44 +00:00
// WithThrowOnSideEffect whether to throw an exception if side effect cannot
// be ruled out during evaluation.
func ( p EvaluateOnCallFrameParams ) WithThrowOnSideEffect ( throwOnSideEffect bool ) * EvaluateOnCallFrameParams {
p . ThrowOnSideEffect = throwOnSideEffect
return & p
}
2017-01-24 15:09:23 +00:00
// EvaluateOnCallFrameReturns return values.
type EvaluateOnCallFrameReturns struct {
Result * runtime . RemoteObject ` json:"result,omitempty" ` // Object wrapper for the evaluation result.
ExceptionDetails * runtime . ExceptionDetails ` json:"exceptionDetails,omitempty" ` // Exception details.
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.evaluateOnCallFrame against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// result - Object wrapper for the evaluation result.
// exceptionDetails - Exception details.
2017-02-12 04:59:33 +00:00
func ( p * EvaluateOnCallFrameParams ) Do ( ctxt context . Context , h cdp . Handler ) ( result * runtime . RemoteObject , exceptionDetails * runtime . ExceptionDetails , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res EvaluateOnCallFrameReturns
err = h . Execute ( ctxt , cdp . CommandDebuggerEvaluateOnCallFrame , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , nil , err
}
2017-02-14 08:41:23 +00:00
return res . Result , res . ExceptionDetails , nil
2017-01-24 15:09:23 +00:00
}
// SetVariableValueParams changes value of variable in a callframe.
// Object-based scopes are not supported and must be mutated manually.
type SetVariableValueParams struct {
ScopeNumber int64 ` json:"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 string ` json:"variableName" ` // Variable name.
NewValue * runtime . CallArgument ` json:"newValue" ` // New variable value.
CallFrameID CallFrameID ` json:"callFrameId" ` // Id of callframe that holds variable.
}
// SetVariableValue 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.
2017-01-26 07:28:34 +00:00
// callFrameID - Id of callframe that holds variable.
func SetVariableValue ( scopeNumber int64 , variableName string , newValue * runtime . CallArgument , callFrameID CallFrameID ) * SetVariableValueParams {
2017-01-24 15:09:23 +00:00
return & SetVariableValueParams {
ScopeNumber : scopeNumber ,
VariableName : variableName ,
NewValue : newValue ,
2017-01-26 07:28:34 +00:00
CallFrameID : callFrameID ,
2017-01-24 15:09:23 +00:00
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setVariableValue against the provided context and
// target handler.
func ( p * SetVariableValueParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetVariableValue , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-11-22 05:01:27 +00:00
// SetReturnValueParams changes return value in top frame. Available only at
// return break position.
type SetReturnValueParams struct {
NewValue * runtime . CallArgument ` json:"newValue" ` // New return value.
}
// SetReturnValue changes return value in top frame. Available only at return
// break position.
//
// parameters:
// newValue - New return value.
func SetReturnValue ( newValue * runtime . CallArgument ) * SetReturnValueParams {
return & SetReturnValueParams {
NewValue : newValue ,
}
}
// Do executes Debugger.setReturnValue against the provided context and
// target handler.
func ( p * SetReturnValueParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
return h . Execute ( ctxt , cdp . CommandDebuggerSetReturnValue , p , nil )
}
2017-01-24 15:09:23 +00:00
// SetAsyncCallStackDepthParams enables or disables async call stacks
// tracking.
type SetAsyncCallStackDepthParams struct {
MaxDepth int64 ` json:"maxDepth" ` // Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).
}
// SetAsyncCallStackDepth enables or disables async call stacks tracking.
//
// parameters:
// maxDepth - Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).
func SetAsyncCallStackDepth ( maxDepth int64 ) * SetAsyncCallStackDepthParams {
return & SetAsyncCallStackDepthParams {
MaxDepth : maxDepth ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setAsyncCallStackDepth against the provided context and
// target handler.
func ( p * SetAsyncCallStackDepthParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetAsyncCallStackDepth , p , nil )
2017-01-24 15:09:23 +00:00
}
// SetBlackboxPatternsParams 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.
type SetBlackboxPatternsParams struct {
Patterns [ ] string ` json:"patterns" ` // Array of regexps that will be used to check script url for blackbox state.
}
// SetBlackboxPatterns 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.
func SetBlackboxPatterns ( patterns [ ] string ) * SetBlackboxPatternsParams {
return & SetBlackboxPatternsParams {
Patterns : patterns ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setBlackboxPatterns against the provided context and
// target handler.
func ( p * SetBlackboxPatternsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetBlackboxPatterns , p , nil )
2017-01-24 15:09:23 +00:00
}
// SetBlackboxedRangesParams 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.
type SetBlackboxedRangesParams struct {
ScriptID runtime . ScriptID ` json:"scriptId" ` // Id of the script.
Positions [ ] * ScriptPosition ` json:"positions" `
}
// SetBlackboxedRanges 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:
2017-01-26 07:28:34 +00:00
// scriptID - Id of the script.
2017-01-24 15:09:23 +00:00
// positions
2017-01-26 07:28:34 +00:00
func SetBlackboxedRanges ( scriptID runtime . ScriptID , positions [ ] * ScriptPosition ) * SetBlackboxedRangesParams {
2017-01-24 15:09:23 +00:00
return & SetBlackboxedRangesParams {
2017-01-26 07:28:34 +00:00
ScriptID : scriptID ,
2017-01-24 15:09:23 +00:00
Positions : positions ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes Debugger.setBlackboxedRanges against the provided context and
// target handler.
func ( p * SetBlackboxedRangesParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandDebuggerSetBlackboxedRanges , p , nil )
2017-01-24 15:09:23 +00:00
}