Update chromedp to fix console errors (#1521)

This commit is contained in:
peolic
2021-06-23 01:05:58 +03:00
committed by GitHub
parent ae3400a9b1
commit be2fe1de26
526 changed files with 55061 additions and 30300 deletions

View File

@@ -204,57 +204,6 @@ func (p *EvaluateOnCallFrameParams) Do(ctx context.Context) (result *runtime.Rem
return res.Result, res.ExceptionDetails, nil
}
// ExecuteWasmEvaluatorParams execute a Wasm Evaluator module on a given call
// frame.
type ExecuteWasmEvaluatorParams struct {
CallFrameID CallFrameID `json:"callFrameId"` // WebAssembly call frame identifier to evaluate on.
Evaluator string `json:"evaluator"` // Code of the evaluator module.
Timeout runtime.TimeDelta `json:"timeout,omitempty"` // Terminate execution after timing out (number of milliseconds).
}
// ExecuteWasmEvaluator execute a Wasm Evaluator module on a given call
// frame.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-executeWasmEvaluator
//
// parameters:
// callFrameID - WebAssembly call frame identifier to evaluate on.
// evaluator - Code of the evaluator module.
func ExecuteWasmEvaluator(callFrameID CallFrameID, evaluator string) *ExecuteWasmEvaluatorParams {
return &ExecuteWasmEvaluatorParams{
CallFrameID: callFrameID,
Evaluator: evaluator,
}
}
// WithTimeout terminate execution after timing out (number of milliseconds).
func (p ExecuteWasmEvaluatorParams) WithTimeout(timeout runtime.TimeDelta) *ExecuteWasmEvaluatorParams {
p.Timeout = timeout
return &p
}
// ExecuteWasmEvaluatorReturns return values.
type ExecuteWasmEvaluatorReturns struct {
Result *runtime.RemoteObject `json:"result,omitempty"` // Object wrapper for the evaluation result.
ExceptionDetails *runtime.ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Debugger.executeWasmEvaluator against the provided context.
//
// returns:
// result - Object wrapper for the evaluation result.
// exceptionDetails - Exception details.
func (p *ExecuteWasmEvaluatorParams) Do(ctx context.Context) (result *runtime.RemoteObject, exceptionDetails *runtime.ExceptionDetails, err error) {
// execute
var res ExecuteWasmEvaluatorReturns
err = cdp.Execute(ctx, CommandExecuteWasmEvaluator, p, &res)
if err != nil {
return nil, nil, err
}
return res.Result, res.ExceptionDetails, nil
}
// GetPossibleBreakpointsParams returns possible locations for breakpoint.
// scriptId in start and end range locations should be the same.
type GetPossibleBreakpointsParams struct {
@@ -429,47 +378,6 @@ func (p *RemoveBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveBreakpoint, p, nil)
}
// 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.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-restartFrame
//
// parameters:
// callFrameID - Call frame identifier to evaluate on.
func RestartFrame(callFrameID CallFrameID) *RestartFrameParams {
return &RestartFrameParams{
CallFrameID: callFrameID,
}
}
// RestartFrameReturns return values.
type RestartFrameReturns struct {
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.
}
// Do executes Debugger.restartFrame against the provided context.
//
// returns:
// callFrames - New stack trace.
// asyncStackTrace - Async stack trace, if any.
// asyncStackTraceID - Async stack trace, if any.
func (p *RestartFrameParams) Do(ctx context.Context) (callFrames []*CallFrame, asyncStackTrace *runtime.StackTrace, asyncStackTraceID *runtime.StackTraceID, err error) {
// execute
var res RestartFrameReturns
err = cdp.Execute(ctx, CommandRestartFrame, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.CallFrames, res.AsyncStackTrace, res.AsyncStackTraceID, nil
}
// ResumeParams resumes JavaScript execution.
type ResumeParams struct {
TerminateOnResume bool `json:"terminateOnResume,omitempty"` // Set to true to terminate execution upon resuming execution. In contrast to Runtime.terminateExecution, this will allows to execute further JavaScript (i.e. via evaluation) until execution of the paused code is actually resumed, at which point termination is triggered. If execution is currently not paused, this parameter has no effect.
@@ -1045,7 +953,8 @@ func (p *SetVariableValueParams) Do(ctx context.Context) (err error) {
// StepIntoParams steps into the function call.
type StepIntoParams struct {
BreakOnAsyncCall bool `json:"breakOnAsyncCall,omitempty"` // Debugger will pause on the execution of the first async task which was scheduled before next pause.
BreakOnAsyncCall bool `json:"breakOnAsyncCall,omitempty"` // Debugger will pause on the execution of the first async task which was scheduled before next pause.
SkipList []*LocationRange `json:"skipList,omitempty"` // The skipList specifies location ranges that should be skipped on step into.
}
// StepInto steps into the function call.
@@ -1064,6 +973,13 @@ func (p StepIntoParams) WithBreakOnAsyncCall(breakOnAsyncCall bool) *StepIntoPar
return &p
}
// WithSkipList the skipList specifies location ranges that should be skipped
// on step into.
func (p StepIntoParams) WithSkipList(skipList []*LocationRange) *StepIntoParams {
p.SkipList = skipList
return &p
}
// Do executes Debugger.stepInto against the provided context.
func (p *StepIntoParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStepInto, p, nil)
@@ -1085,18 +1001,29 @@ func (p *StepOutParams) Do(ctx context.Context) (err error) {
}
// StepOverParams steps over the statement.
type StepOverParams struct{}
type StepOverParams struct {
SkipList []*LocationRange `json:"skipList,omitempty"` // The skipList specifies location ranges that should be skipped on step over.
}
// StepOver steps over the statement.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-stepOver
//
// parameters:
func StepOver() *StepOverParams {
return &StepOverParams{}
}
// WithSkipList the skipList specifies location ranges that should be skipped
// on step over.
func (p StepOverParams) WithSkipList(skipList []*LocationRange) *StepOverParams {
p.SkipList = skipList
return &p
}
// Do executes Debugger.stepOver against the provided context.
func (p *StepOverParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStepOver, nil, nil)
return cdp.Execute(ctx, CommandStepOver, p, nil)
}
// Command names.
@@ -1105,13 +1032,11 @@ const (
CommandDisable = "Debugger.disable"
CommandEnable = "Debugger.enable"
CommandEvaluateOnCallFrame = "Debugger.evaluateOnCallFrame"
CommandExecuteWasmEvaluator = "Debugger.executeWasmEvaluator"
CommandGetPossibleBreakpoints = "Debugger.getPossibleBreakpoints"
CommandGetScriptSource = "Debugger.getScriptSource"
CommandGetStackTrace = "Debugger.getStackTrace"
CommandPause = "Debugger.pause"
CommandRemoveBreakpoint = "Debugger.removeBreakpoint"
CommandRestartFrame = "Debugger.restartFrame"
CommandResume = "Debugger.resume"
CommandSearchInContent = "Debugger.searchInContent"
CommandSetAsyncCallStackDepth = "Debugger.setAsyncCallStackDepth"

File diff suppressed because it is too large Load Diff

View File

@@ -55,6 +55,7 @@ type EventScriptFailedToParse struct {
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript top stack frame of where the script parsed event was triggered if available.
CodeOffset int64 `json:"codeOffset,omitempty"` // If the scriptLanguage is WebAssembly, the code section offset in the module.
ScriptLanguage ScriptLanguage `json:"scriptLanguage,omitempty"` // The language of the script.
EmbedderName string `json:"embedderName,omitempty"` // The name the embedder supplied for this script.
}
// EventScriptParsed fired when virtual machine parses script. This event is
@@ -80,4 +81,5 @@ type EventScriptParsed struct {
CodeOffset int64 `json:"codeOffset,omitempty"` // If the scriptLanguage is WebAssembly, the code section offset in the module.
ScriptLanguage ScriptLanguage `json:"scriptLanguage,omitempty"` // The language of the script.
DebugSymbols *DebugSymbols `json:"debugSymbols,omitempty"` // If the scriptLanguage is WebASsembly, the source of debug symbols for the module.
EmbedderName string `json:"embedderName,omitempty"` // The name the embedder supplied for this script.
}

View File

@@ -48,6 +48,15 @@ type ScriptPosition struct {
ColumnNumber int64 `json:"columnNumber"`
}
// LocationRange location range within one script.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-LocationRange
type LocationRange struct {
ScriptID runtime.ScriptID `json:"scriptId"`
Start *ScriptPosition `json:"start"`
End *ScriptPosition `json:"end"`
}
// CallFrame JavaScript call frame. Array of call frames form the call stack.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-CallFrame
@@ -322,6 +331,7 @@ func (t PausedReason) String() string {
const (
PausedReasonAmbiguous PausedReason = "ambiguous"
PausedReasonAssert PausedReason = "assert"
PausedReasonCSPViolation PausedReason = "CSPViolation"
PausedReasonDebugCommand PausedReason = "debugCommand"
PausedReasonDOM PausedReason = "DOM"
PausedReasonEventListener PausedReason = "EventListener"
@@ -350,6 +360,8 @@ func (t *PausedReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = PausedReasonAmbiguous
case PausedReasonAssert:
*t = PausedReasonAssert
case PausedReasonCSPViolation:
*t = PausedReasonCSPViolation
case PausedReasonDebugCommand:
*t = PausedReasonDebugCommand
case PausedReasonDOM: