mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Add cdp support for xpath scrapers (#625)
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
4978
vendor/github.com/chromedp/cdproto/runtime/easyjson.go
generated
vendored
Normal file
4978
vendor/github.com/chromedp/cdproto/runtime/easyjson.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
74
vendor/github.com/chromedp/cdproto/runtime/events.go
generated
vendored
Normal file
74
vendor/github.com/chromedp/cdproto/runtime/events.go
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
package runtime
|
||||
|
||||
// Code generated by cdproto-gen. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EventBindingCalled notification is issued every time when binding is
|
||||
// called.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-bindingCalled
|
||||
type EventBindingCalled struct {
|
||||
Name string `json:"name"`
|
||||
Payload string `json:"payload"`
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made.
|
||||
}
|
||||
|
||||
// EventConsoleAPICalled issued when console API was called.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-consoleAPICalled
|
||||
type EventConsoleAPICalled struct {
|
||||
Type APIType `json:"type"` // Type of the call.
|
||||
Args []*RemoteObject `json:"args"` // Call arguments.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made.
|
||||
Timestamp *Timestamp `json:"timestamp"` // Call timestamp.
|
||||
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made. The async stack chain is automatically reported for the following call types: assert, error, trace, warning. For other types the async call chain can be retrieved using Debugger.getStackTrace and stackTrace.parentId field.
|
||||
Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
|
||||
}
|
||||
|
||||
// EventExceptionRevoked issued when unhandled exception was revoked.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-exceptionRevoked
|
||||
type EventExceptionRevoked struct {
|
||||
Reason string `json:"reason"` // Reason describing why exception was revoked.
|
||||
ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionThrown.
|
||||
}
|
||||
|
||||
// EventExceptionThrown issued when exception was thrown and unhandled.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-exceptionThrown
|
||||
type EventExceptionThrown struct {
|
||||
Timestamp *Timestamp `json:"timestamp"` // Timestamp of the exception.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails"`
|
||||
}
|
||||
|
||||
// EventExecutionContextCreated issued when new execution context is created.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-executionContextCreated
|
||||
type EventExecutionContextCreated struct {
|
||||
Context *ExecutionContextDescription `json:"context"` // A newly created execution context.
|
||||
}
|
||||
|
||||
// EventExecutionContextDestroyed issued when execution context is destroyed.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-executionContextDestroyed
|
||||
type EventExecutionContextDestroyed struct {
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId"` // Id of the destroyed context
|
||||
}
|
||||
|
||||
// EventExecutionContextsCleared issued when all executionContexts were
|
||||
// cleared in browser.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-executionContextsCleared
|
||||
type EventExecutionContextsCleared struct{}
|
||||
|
||||
// EventInspectRequested issued when object should be inspected (for example,
|
||||
// as a result of inspect() command line API call).
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-inspectRequested
|
||||
type EventInspectRequested struct {
|
||||
Object *RemoteObject `json:"object"`
|
||||
Hints easyjson.RawMessage `json:"hints"`
|
||||
}
|
||||
957
vendor/github.com/chromedp/cdproto/runtime/runtime.go
generated
vendored
Normal file
957
vendor/github.com/chromedp/cdproto/runtime/runtime.go
generated
vendored
Normal file
@@ -0,0 +1,957 @@
|
||||
// Package runtime provides the Chrome DevTools Protocol
|
||||
// commands, types, and events for the Runtime domain.
|
||||
//
|
||||
// Runtime domain exposes JavaScript runtime by means of remote evaluation
|
||||
// and mirror objects. Evaluation results are returned as mirror object that
|
||||
// expose object type, string representation and unique identifier that can be
|
||||
// used for further object reference. Original objects are maintained in memory
|
||||
// unless they are either explicitly released or are released along with the
|
||||
// other objects in their object group.
|
||||
//
|
||||
// Generated by the cdproto-gen command.
|
||||
package runtime
|
||||
|
||||
// Code generated by cdproto-gen. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/chromedp/cdproto/cdp"
|
||||
)
|
||||
|
||||
// AwaitPromiseParams add handler to promise with given promise object id.
|
||||
type AwaitPromiseParams struct {
|
||||
PromiseObjectID RemoteObjectID `json:"promiseObjectId"` // Identifier of the promise.
|
||||
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.
|
||||
}
|
||||
|
||||
// AwaitPromise add handler to promise with given promise object id.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-awaitPromise
|
||||
//
|
||||
// parameters:
|
||||
// promiseObjectID - Identifier of the promise.
|
||||
func AwaitPromise(promiseObjectID RemoteObjectID) *AwaitPromiseParams {
|
||||
return &AwaitPromiseParams{
|
||||
PromiseObjectID: promiseObjectID,
|
||||
}
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object that
|
||||
// should be sent by value.
|
||||
func (p AwaitPromiseParams) WithReturnByValue(returnByValue bool) *AwaitPromiseParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p AwaitPromiseParams) WithGeneratePreview(generatePreview bool) *AwaitPromiseParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// AwaitPromiseReturns return values.
|
||||
type AwaitPromiseReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Promise result. Will contain rejected value if promise was rejected.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details if stack strace is available.
|
||||
}
|
||||
|
||||
// Do executes Runtime.awaitPromise against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// result - Promise result. Will contain rejected value if promise was rejected.
|
||||
// exceptionDetails - Exception details if stack strace is available.
|
||||
func (p *AwaitPromiseParams) Do(ctx context.Context) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res AwaitPromiseReturns
|
||||
err = cdp.Execute(ctx, CommandAwaitPromise, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// CallFunctionOnParams calls function with given declaration on the given
|
||||
// object. Object group of the result is inherited from the target object.
|
||||
type CallFunctionOnParams struct {
|
||||
FunctionDeclaration string `json:"functionDeclaration"` // Declaration of the function to call.
|
||||
ObjectID RemoteObjectID `json:"objectId,omitempty"` // Identifier of the object to call function on. Either objectId or executionContextId should be specified.
|
||||
Arguments []*CallArgument `json:"arguments,omitempty"` // Call arguments. All call arguments must belong to the same JavaScript world as the target object.
|
||||
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 which should be sent by value.
|
||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
||||
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
|
||||
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
|
||||
}
|
||||
|
||||
// CallFunctionOn calls function with given declaration on the given object.
|
||||
// Object group of the result is inherited from the target object.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-callFunctionOn
|
||||
//
|
||||
// parameters:
|
||||
// functionDeclaration - Declaration of the function to call.
|
||||
func CallFunctionOn(functionDeclaration string) *CallFunctionOnParams {
|
||||
return &CallFunctionOnParams{
|
||||
FunctionDeclaration: functionDeclaration,
|
||||
}
|
||||
}
|
||||
|
||||
// WithObjectID identifier of the object to call function on. Either objectId
|
||||
// or executionContextId should be specified.
|
||||
func (p CallFunctionOnParams) WithObjectID(objectID RemoteObjectID) *CallFunctionOnParams {
|
||||
p.ObjectID = objectID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithArguments call arguments. All call arguments must belong to the same
|
||||
// JavaScript world as the target object.
|
||||
func (p CallFunctionOnParams) WithArguments(arguments []*CallArgument) *CallFunctionOnParams {
|
||||
p.Arguments = arguments
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithSilent in silent mode exceptions thrown during evaluation are not
|
||||
// reported and do not pause execution. Overrides setPauseOnException state.
|
||||
func (p CallFunctionOnParams) WithSilent(silent bool) *CallFunctionOnParams {
|
||||
p.Silent = silent
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object which
|
||||
// should be sent by value.
|
||||
func (p CallFunctionOnParams) WithReturnByValue(returnByValue bool) *CallFunctionOnParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p CallFunctionOnParams) WithGeneratePreview(generatePreview bool) *CallFunctionOnParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithUserGesture whether execution should be treated as initiated by user
|
||||
// in the UI.
|
||||
func (p CallFunctionOnParams) WithUserGesture(userGesture bool) *CallFunctionOnParams {
|
||||
p.UserGesture = userGesture
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAwaitPromise whether execution should await for resulting value and
|
||||
// return once awaited promise is resolved.
|
||||
func (p CallFunctionOnParams) WithAwaitPromise(awaitPromise bool) *CallFunctionOnParams {
|
||||
p.AwaitPromise = awaitPromise
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies execution context which global object
|
||||
// will be used to call function on. Either executionContextId or objectId
|
||||
// should be specified.
|
||||
func (p CallFunctionOnParams) WithExecutionContextID(executionContextID ExecutionContextID) *CallFunctionOnParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release multiple
|
||||
// objects. If objectGroup is not specified and objectId is, objectGroup will be
|
||||
// inherited from object.
|
||||
func (p CallFunctionOnParams) WithObjectGroup(objectGroup string) *CallFunctionOnParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// CallFunctionOnReturns return values.
|
||||
type CallFunctionOnReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Call result.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.callFunctionOn against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// result - Call result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CallFunctionOnParams) Do(ctx context.Context) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res CallFunctionOnReturns
|
||||
err = cdp.Execute(ctx, CommandCallFunctionOn, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// CompileScriptParams compiles expression.
|
||||
type CompileScriptParams struct {
|
||||
Expression string `json:"expression"` // Expression to compile.
|
||||
SourceURL string `json:"sourceURL"` // Source url to be set for the script.
|
||||
PersistScript bool `json:"persistScript"` // Specifies whether the compiled script should be persisted.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
}
|
||||
|
||||
// CompileScript compiles expression.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-compileScript
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to compile.
|
||||
// sourceURL - Source url to be set for the script.
|
||||
// persistScript - Specifies whether the compiled script should be persisted.
|
||||
func CompileScript(expression string, sourceURL string, persistScript bool) *CompileScriptParams {
|
||||
return &CompileScriptParams{
|
||||
Expression: expression,
|
||||
SourceURL: sourceURL,
|
||||
PersistScript: persistScript,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to perform
|
||||
// script run. If the parameter is omitted the evaluation will be performed in
|
||||
// the context of the inspected page.
|
||||
func (p CompileScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *CompileScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// CompileScriptReturns return values.
|
||||
type CompileScriptReturns struct {
|
||||
ScriptID ScriptID `json:"scriptId,omitempty"` // Id of the script.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.compileScript against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// scriptID - Id of the script.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CompileScriptParams) Do(ctx context.Context) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res CompileScriptReturns
|
||||
err = cdp.Execute(ctx, CommandCompileScript, p, &res)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
return res.ScriptID, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// DisableParams disables reporting of execution contexts creation.
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable disables reporting of execution contexts creation.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-disable
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.disable against the provided context.
|
||||
func (p *DisableParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandDisable, nil, nil)
|
||||
}
|
||||
|
||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||
// calls.
|
||||
type DiscardConsoleEntriesParams struct{}
|
||||
|
||||
// DiscardConsoleEntries discards collected exceptions and console API calls.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-discardConsoleEntries
|
||||
func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
||||
return &DiscardConsoleEntriesParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.discardConsoleEntries against the provided context.
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandDiscardConsoleEntries, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-enable
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.enable against the provided context.
|
||||
func (p *EnableParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandEnable, nil, nil)
|
||||
}
|
||||
|
||||
// EvaluateParams evaluates expression on global object.
|
||||
type EvaluateParams struct {
|
||||
Expression string `json:"expression"` // Expression to evaluate.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
|
||||
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Determines whether Command Line API should be available during the evaluation.
|
||||
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
||||
ContextID ExecutionContextID `json:"contextId,omitempty"` // Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
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.
|
||||
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
|
||||
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
|
||||
ThrowOnSideEffect bool `json:"throwOnSideEffect,omitempty"` // Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies disableBreaks below.
|
||||
Timeout TimeDelta `json:"timeout,omitempty"` // Terminate execution after timing out (number of milliseconds).
|
||||
DisableBreaks bool `json:"disableBreaks,omitempty"` // Disable breakpoints during execution.
|
||||
ReplMode bool `json:"replMode,omitempty"` // Setting this flag to true enables let re-declaration and top-level await. Note that let variables can only be re-declared if they originate from replMode themselves.
|
||||
}
|
||||
|
||||
// Evaluate evaluates expression on global object.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-evaluate
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to evaluate.
|
||||
func Evaluate(expression string) *EvaluateParams {
|
||||
return &EvaluateParams{
|
||||
Expression: expression,
|
||||
}
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release multiple
|
||||
// objects.
|
||||
func (p EvaluateParams) WithObjectGroup(objectGroup string) *EvaluateParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithIncludeCommandLineAPI determines whether Command Line API should be
|
||||
// available during the evaluation.
|
||||
func (p EvaluateParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateParams {
|
||||
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 EvaluateParams) WithSilent(silent bool) *EvaluateParams {
|
||||
p.Silent = silent
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithContextID specifies in which execution context to perform evaluation.
|
||||
// If the parameter is omitted the evaluation will be performed in the context
|
||||
// of the inspected page.
|
||||
func (p EvaluateParams) WithContextID(contextID ExecutionContextID) *EvaluateParams {
|
||||
p.ContextID = contextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object that
|
||||
// should be sent by value.
|
||||
func (p EvaluateParams) WithReturnByValue(returnByValue bool) *EvaluateParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p EvaluateParams) WithGeneratePreview(generatePreview bool) *EvaluateParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithUserGesture whether execution should be treated as initiated by user
|
||||
// in the UI.
|
||||
func (p EvaluateParams) WithUserGesture(userGesture bool) *EvaluateParams {
|
||||
p.UserGesture = userGesture
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAwaitPromise whether execution should await for resulting value and
|
||||
// return once awaited promise is resolved.
|
||||
func (p EvaluateParams) WithAwaitPromise(awaitPromise bool) *EvaluateParams {
|
||||
p.AwaitPromise = awaitPromise
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithThrowOnSideEffect whether to throw an exception if side effect cannot
|
||||
// be ruled out during evaluation. This implies disableBreaks below.
|
||||
func (p EvaluateParams) WithThrowOnSideEffect(throwOnSideEffect bool) *EvaluateParams {
|
||||
p.ThrowOnSideEffect = throwOnSideEffect
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithTimeout terminate execution after timing out (number of milliseconds).
|
||||
func (p EvaluateParams) WithTimeout(timeout TimeDelta) *EvaluateParams {
|
||||
p.Timeout = timeout
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithDisableBreaks disable breakpoints during execution.
|
||||
func (p EvaluateParams) WithDisableBreaks(disableBreaks bool) *EvaluateParams {
|
||||
p.DisableBreaks = disableBreaks
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReplMode setting this flag to true enables let re-declaration and
|
||||
// top-level await. Note that let variables can only be re-declared if they
|
||||
// originate from replMode themselves.
|
||||
func (p EvaluateParams) WithReplMode(replMode bool) *EvaluateParams {
|
||||
p.ReplMode = replMode
|
||||
return &p
|
||||
}
|
||||
|
||||
// EvaluateReturns return values.
|
||||
type EvaluateReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Evaluation result.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.evaluate against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// result - Evaluation result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *EvaluateParams) Do(ctx context.Context) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res EvaluateReturns
|
||||
err = cdp.Execute(ctx, CommandEvaluate, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// GetIsolateIDParams returns the isolate id.
|
||||
type GetIsolateIDParams struct{}
|
||||
|
||||
// GetIsolateID returns the isolate id.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-getIsolateId
|
||||
func GetIsolateID() *GetIsolateIDParams {
|
||||
return &GetIsolateIDParams{}
|
||||
}
|
||||
|
||||
// GetIsolateIDReturns return values.
|
||||
type GetIsolateIDReturns struct {
|
||||
ID string `json:"id,omitempty"` // The isolate id.
|
||||
}
|
||||
|
||||
// Do executes Runtime.getIsolateId against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// id - The isolate id.
|
||||
func (p *GetIsolateIDParams) Do(ctx context.Context) (id string, err error) {
|
||||
// execute
|
||||
var res GetIsolateIDReturns
|
||||
err = cdp.Execute(ctx, CommandGetIsolateID, nil, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res.ID, nil
|
||||
}
|
||||
|
||||
// GetHeapUsageParams returns the JavaScript heap usage. It is the total
|
||||
// usage of the corresponding isolate not scoped to a particular Runtime.
|
||||
type GetHeapUsageParams struct{}
|
||||
|
||||
// GetHeapUsage returns the JavaScript heap usage. It is the total usage of
|
||||
// the corresponding isolate not scoped to a particular Runtime.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-getHeapUsage
|
||||
func GetHeapUsage() *GetHeapUsageParams {
|
||||
return &GetHeapUsageParams{}
|
||||
}
|
||||
|
||||
// GetHeapUsageReturns return values.
|
||||
type GetHeapUsageReturns struct {
|
||||
UsedSize float64 `json:"usedSize,omitempty"` // Used heap size in bytes.
|
||||
TotalSize float64 `json:"totalSize,omitempty"` // Allocated heap size in bytes.
|
||||
}
|
||||
|
||||
// Do executes Runtime.getHeapUsage against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// usedSize - Used heap size in bytes.
|
||||
// totalSize - Allocated heap size in bytes.
|
||||
func (p *GetHeapUsageParams) Do(ctx context.Context) (usedSize float64, totalSize float64, err error) {
|
||||
// execute
|
||||
var res GetHeapUsageReturns
|
||||
err = cdp.Execute(ctx, CommandGetHeapUsage, nil, &res)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
return res.UsedSize, res.TotalSize, nil
|
||||
}
|
||||
|
||||
// GetPropertiesParams returns properties of a given object. Object group of
|
||||
// the result is inherited from the target object.
|
||||
type GetPropertiesParams struct {
|
||||
ObjectID RemoteObjectID `json:"objectId"` // Identifier of the object to return properties for.
|
||||
OwnProperties bool `json:"ownProperties,omitempty"` // If true, returns properties belonging only to the element itself, not to its prototype chain.
|
||||
AccessorPropertiesOnly bool `json:"accessorPropertiesOnly,omitempty"` // If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
|
||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the results.
|
||||
}
|
||||
|
||||
// GetProperties returns properties of a given object. Object group of the
|
||||
// result is inherited from the target object.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-getProperties
|
||||
//
|
||||
// parameters:
|
||||
// objectID - Identifier of the object to return properties for.
|
||||
func GetProperties(objectID RemoteObjectID) *GetPropertiesParams {
|
||||
return &GetPropertiesParams{
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
// WithOwnProperties if true, returns properties belonging only to the
|
||||
// element itself, not to its prototype chain.
|
||||
func (p GetPropertiesParams) WithOwnProperties(ownProperties bool) *GetPropertiesParams {
|
||||
p.OwnProperties = ownProperties
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAccessorPropertiesOnly if true, returns accessor properties (with
|
||||
// getter/setter) only; internal properties are not returned either.
|
||||
func (p GetPropertiesParams) WithAccessorPropertiesOnly(accessorPropertiesOnly bool) *GetPropertiesParams {
|
||||
p.AccessorPropertiesOnly = accessorPropertiesOnly
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the results.
|
||||
func (p GetPropertiesParams) WithGeneratePreview(generatePreview bool) *GetPropertiesParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// GetPropertiesReturns return values.
|
||||
type GetPropertiesReturns struct {
|
||||
Result []*PropertyDescriptor `json:"result,omitempty"` // Object properties.
|
||||
InternalProperties []*InternalPropertyDescriptor `json:"internalProperties,omitempty"` // Internal object properties (only of the element itself).
|
||||
PrivateProperties []*PrivatePropertyDescriptor `json:"privateProperties,omitempty"` // Object private properties.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.getProperties against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// result - Object properties.
|
||||
// internalProperties - Internal object properties (only of the element itself).
|
||||
// privateProperties - Object private properties.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *GetPropertiesParams) Do(ctx context.Context) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, privateProperties []*PrivatePropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res GetPropertiesReturns
|
||||
err = cdp.Execute(ctx, CommandGetProperties, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.InternalProperties, res.PrivateProperties, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesParams returns all let, const and class variables
|
||||
// from global scope.
|
||||
type GlobalLexicalScopeNamesParams struct {
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to lookup global scope variables.
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNames returns all let, const and class variables from
|
||||
// global scope.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-globalLexicalScopeNames
|
||||
//
|
||||
// parameters:
|
||||
func GlobalLexicalScopeNames() *GlobalLexicalScopeNamesParams {
|
||||
return &GlobalLexicalScopeNamesParams{}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to lookup
|
||||
// global scope variables.
|
||||
func (p GlobalLexicalScopeNamesParams) WithExecutionContextID(executionContextID ExecutionContextID) *GlobalLexicalScopeNamesParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesReturns return values.
|
||||
type GlobalLexicalScopeNamesReturns struct {
|
||||
Names []string `json:"names,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Runtime.globalLexicalScopeNames against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// names
|
||||
func (p *GlobalLexicalScopeNamesParams) Do(ctx context.Context) (names []string, err error) {
|
||||
// execute
|
||||
var res GlobalLexicalScopeNamesReturns
|
||||
err = cdp.Execute(ctx, CommandGlobalLexicalScopeNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Names, nil
|
||||
}
|
||||
|
||||
// QueryObjectsParams [no description].
|
||||
type QueryObjectsParams struct {
|
||||
PrototypeObjectID RemoteObjectID `json:"prototypeObjectId"` // Identifier of the prototype to return objects for.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release the results.
|
||||
}
|
||||
|
||||
// QueryObjects [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-queryObjects
|
||||
//
|
||||
// parameters:
|
||||
// prototypeObjectID - Identifier of the prototype to return objects for.
|
||||
func QueryObjects(prototypeObjectID RemoteObjectID) *QueryObjectsParams {
|
||||
return &QueryObjectsParams{
|
||||
PrototypeObjectID: prototypeObjectID,
|
||||
}
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release the
|
||||
// results.
|
||||
func (p QueryObjectsParams) WithObjectGroup(objectGroup string) *QueryObjectsParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// QueryObjectsReturns return values.
|
||||
type QueryObjectsReturns struct {
|
||||
Objects *RemoteObject `json:"objects,omitempty"` // Array with objects.
|
||||
}
|
||||
|
||||
// Do executes Runtime.queryObjects against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// objects - Array with objects.
|
||||
func (p *QueryObjectsParams) Do(ctx context.Context) (objects *RemoteObject, err error) {
|
||||
// execute
|
||||
var res QueryObjectsReturns
|
||||
err = cdp.Execute(ctx, CommandQueryObjects, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Objects, nil
|
||||
}
|
||||
|
||||
// ReleaseObjectParams releases remote object with given id.
|
||||
type ReleaseObjectParams struct {
|
||||
ObjectID RemoteObjectID `json:"objectId"` // Identifier of the object to release.
|
||||
}
|
||||
|
||||
// ReleaseObject releases remote object with given id.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-releaseObject
|
||||
//
|
||||
// parameters:
|
||||
// objectID - Identifier of the object to release.
|
||||
func ReleaseObject(objectID RemoteObjectID) *ReleaseObjectParams {
|
||||
return &ReleaseObjectParams{
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.releaseObject against the provided context.
|
||||
func (p *ReleaseObjectParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandReleaseObject, p, nil)
|
||||
}
|
||||
|
||||
// ReleaseObjectGroupParams releases all remote objects that belong to a
|
||||
// given group.
|
||||
type ReleaseObjectGroupParams struct {
|
||||
ObjectGroup string `json:"objectGroup"` // Symbolic object group name.
|
||||
}
|
||||
|
||||
// ReleaseObjectGroup releases all remote objects that belong to a given
|
||||
// group.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-releaseObjectGroup
|
||||
//
|
||||
// parameters:
|
||||
// objectGroup - Symbolic object group name.
|
||||
func ReleaseObjectGroup(objectGroup string) *ReleaseObjectGroupParams {
|
||||
return &ReleaseObjectGroupParams{
|
||||
ObjectGroup: objectGroup,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.releaseObjectGroup against the provided context.
|
||||
func (p *ReleaseObjectGroupParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandReleaseObjectGroup, p, nil)
|
||||
}
|
||||
|
||||
// RunIfWaitingForDebuggerParams tells inspected instance to run if it was
|
||||
// waiting for debugger to attach.
|
||||
type RunIfWaitingForDebuggerParams struct{}
|
||||
|
||||
// RunIfWaitingForDebugger tells inspected instance to run if it was waiting
|
||||
// for debugger to attach.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-runIfWaitingForDebugger
|
||||
func RunIfWaitingForDebugger() *RunIfWaitingForDebuggerParams {
|
||||
return &RunIfWaitingForDebuggerParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.runIfWaitingForDebugger against the provided context.
|
||||
func (p *RunIfWaitingForDebuggerParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandRunIfWaitingForDebugger, nil, nil)
|
||||
}
|
||||
|
||||
// RunScriptParams runs script with given id in a given context.
|
||||
type RunScriptParams struct {
|
||||
ScriptID ScriptID `json:"scriptId"` // Id of the script to run.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
|
||||
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
||||
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Determines whether Command Line API should be available during the evaluation.
|
||||
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object which should be sent by value.
|
||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
||||
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
|
||||
}
|
||||
|
||||
// RunScript runs script with given id in a given context.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-runScript
|
||||
//
|
||||
// parameters:
|
||||
// scriptID - Id of the script to run.
|
||||
func RunScript(scriptID ScriptID) *RunScriptParams {
|
||||
return &RunScriptParams{
|
||||
ScriptID: scriptID,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to perform
|
||||
// script run. If the parameter is omitted the evaluation will be performed in
|
||||
// the context of the inspected page.
|
||||
func (p RunScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *RunScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release multiple
|
||||
// objects.
|
||||
func (p RunScriptParams) WithObjectGroup(objectGroup string) *RunScriptParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithSilent in silent mode exceptions thrown during evaluation are not
|
||||
// reported and do not pause execution. Overrides setPauseOnException state.
|
||||
func (p RunScriptParams) WithSilent(silent bool) *RunScriptParams {
|
||||
p.Silent = silent
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithIncludeCommandLineAPI determines whether Command Line API should be
|
||||
// available during the evaluation.
|
||||
func (p RunScriptParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *RunScriptParams {
|
||||
p.IncludeCommandLineAPI = includeCommandLineAPI
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object which
|
||||
// should be sent by value.
|
||||
func (p RunScriptParams) WithReturnByValue(returnByValue bool) *RunScriptParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p RunScriptParams) WithGeneratePreview(generatePreview bool) *RunScriptParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAwaitPromise whether execution should await for resulting value and
|
||||
// return once awaited promise is resolved.
|
||||
func (p RunScriptParams) WithAwaitPromise(awaitPromise bool) *RunScriptParams {
|
||||
p.AwaitPromise = awaitPromise
|
||||
return &p
|
||||
}
|
||||
|
||||
// RunScriptReturns return values.
|
||||
type RunScriptReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Run result.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.runScript against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// result - Run result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *RunScriptParams) Do(ctx context.Context) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res RunScriptReturns
|
||||
err = cdp.Execute(ctx, CommandRunScript, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabledParams [no description].
|
||||
type SetCustomObjectFormatterEnabledParams struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabled [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-setCustomObjectFormatterEnabled
|
||||
//
|
||||
// parameters:
|
||||
// enabled
|
||||
func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnabledParams {
|
||||
return &SetCustomObjectFormatterEnabledParams{
|
||||
Enabled: enabled,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context.
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetCustomObjectFormatterEnabled, p, nil)
|
||||
}
|
||||
|
||||
// SetMaxCallStackSizeToCaptureParams [no description].
|
||||
type SetMaxCallStackSizeToCaptureParams struct {
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
// SetMaxCallStackSizeToCapture [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-setMaxCallStackSizeToCapture
|
||||
//
|
||||
// parameters:
|
||||
// size
|
||||
func SetMaxCallStackSizeToCapture(size int64) *SetMaxCallStackSizeToCaptureParams {
|
||||
return &SetMaxCallStackSizeToCaptureParams{
|
||||
Size: size,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.setMaxCallStackSizeToCapture against the provided context.
|
||||
func (p *SetMaxCallStackSizeToCaptureParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetMaxCallStackSizeToCapture, p, nil)
|
||||
}
|
||||
|
||||
// TerminateExecutionParams terminate current or next JavaScript execution.
|
||||
// Will cancel the termination when the outer-most script execution ends.
|
||||
type TerminateExecutionParams struct{}
|
||||
|
||||
// TerminateExecution terminate current or next JavaScript execution. Will
|
||||
// cancel the termination when the outer-most script execution ends.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-terminateExecution
|
||||
func TerminateExecution() *TerminateExecutionParams {
|
||||
return &TerminateExecutionParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.terminateExecution against the provided context.
|
||||
func (p *TerminateExecutionParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandTerminateExecution, nil, nil)
|
||||
}
|
||||
|
||||
// AddBindingParams if executionContextId is empty, adds binding with the
|
||||
// given name on the global objects of all inspected contexts, including those
|
||||
// created later, bindings survive reloads. If executionContextId is specified,
|
||||
// adds binding only on global object of given execution context. Binding
|
||||
// function takes exactly one argument, this argument should be string, in case
|
||||
// of any other input, function throws an exception. Each binding function call
|
||||
// produces Runtime.bindingCalled notification.
|
||||
type AddBindingParams struct {
|
||||
Name string `json:"name"`
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"`
|
||||
}
|
||||
|
||||
// AddBinding if executionContextId is empty, adds binding with the given
|
||||
// name on the global objects of all inspected contexts, including those created
|
||||
// later, bindings survive reloads. If executionContextId is specified, adds
|
||||
// binding only on global object of given execution context. Binding function
|
||||
// takes exactly one argument, this argument should be string, in case of any
|
||||
// other input, function throws an exception. Each binding function call
|
||||
// produces Runtime.bindingCalled notification.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-addBinding
|
||||
//
|
||||
// parameters:
|
||||
// name
|
||||
func AddBinding(name string) *AddBindingParams {
|
||||
return &AddBindingParams{
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExecutionContextID [no description].
|
||||
func (p AddBindingParams) WithExecutionContextID(executionContextID ExecutionContextID) *AddBindingParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Runtime.addBinding against the provided context.
|
||||
func (p *AddBindingParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandAddBinding, p, nil)
|
||||
}
|
||||
|
||||
// RemoveBindingParams this method does not remove binding function from
|
||||
// global object but unsubscribes current runtime agent from
|
||||
// Runtime.bindingCalled notifications.
|
||||
type RemoveBindingParams struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// RemoveBinding this method does not remove binding function from global
|
||||
// object but unsubscribes current runtime agent from Runtime.bindingCalled
|
||||
// notifications.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#method-removeBinding
|
||||
//
|
||||
// parameters:
|
||||
// name
|
||||
func RemoveBinding(name string) *RemoveBindingParams {
|
||||
return &RemoveBindingParams{
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.removeBinding against the provided context.
|
||||
func (p *RemoveBindingParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandRemoveBinding, p, nil)
|
||||
}
|
||||
|
||||
// Command names.
|
||||
const (
|
||||
CommandAwaitPromise = "Runtime.awaitPromise"
|
||||
CommandCallFunctionOn = "Runtime.callFunctionOn"
|
||||
CommandCompileScript = "Runtime.compileScript"
|
||||
CommandDisable = "Runtime.disable"
|
||||
CommandDiscardConsoleEntries = "Runtime.discardConsoleEntries"
|
||||
CommandEnable = "Runtime.enable"
|
||||
CommandEvaluate = "Runtime.evaluate"
|
||||
CommandGetIsolateID = "Runtime.getIsolateId"
|
||||
CommandGetHeapUsage = "Runtime.getHeapUsage"
|
||||
CommandGetProperties = "Runtime.getProperties"
|
||||
CommandGlobalLexicalScopeNames = "Runtime.globalLexicalScopeNames"
|
||||
CommandQueryObjects = "Runtime.queryObjects"
|
||||
CommandReleaseObject = "Runtime.releaseObject"
|
||||
CommandReleaseObjectGroup = "Runtime.releaseObjectGroup"
|
||||
CommandRunIfWaitingForDebugger = "Runtime.runIfWaitingForDebugger"
|
||||
CommandRunScript = "Runtime.runScript"
|
||||
CommandSetCustomObjectFormatterEnabled = "Runtime.setCustomObjectFormatterEnabled"
|
||||
CommandSetMaxCallStackSizeToCapture = "Runtime.setMaxCallStackSizeToCapture"
|
||||
CommandTerminateExecution = "Runtime.terminateExecution"
|
||||
CommandAddBinding = "Runtime.addBinding"
|
||||
CommandRemoveBinding = "Runtime.removeBinding"
|
||||
)
|
||||
540
vendor/github.com/chromedp/cdproto/runtime/types.go
generated
vendored
Normal file
540
vendor/github.com/chromedp/cdproto/runtime/types.go
generated
vendored
Normal file
@@ -0,0 +1,540 @@
|
||||
package runtime
|
||||
|
||||
// Code generated by cdproto-gen. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
// ScriptID unique script identifier.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-ScriptId
|
||||
type ScriptID string
|
||||
|
||||
// String returns the ScriptID as string value.
|
||||
func (t ScriptID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// RemoteObjectID unique object identifier.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-RemoteObjectId
|
||||
type RemoteObjectID string
|
||||
|
||||
// String returns the RemoteObjectID as string value.
|
||||
func (t RemoteObjectID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// UnserializableValue primitive value which cannot be JSON-stringified.
|
||||
// Includes values -0, NaN, Infinity, -Infinity, and bigint literals.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-UnserializableValue
|
||||
type UnserializableValue string
|
||||
|
||||
// String returns the UnserializableValue as string value.
|
||||
func (t UnserializableValue) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// RemoteObject mirror object referencing original JavaScript object.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-RemoteObject
|
||||
type RemoteObject struct {
|
||||
Type Type `json:"type"` // Object type.
|
||||
Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object or wasm type values only.
|
||||
ClassName string `json:"className,omitempty"` // Object class (constructor) name. Specified for object type values only.
|
||||
Value easyjson.RawMessage `json:"value,omitempty"` // Remote object value in case of primitive values or JSON values (if it was requested).
|
||||
UnserializableValue UnserializableValue `json:"unserializableValue,omitempty"` // Primitive value which can not be JSON-stringified does not have value, but gets this property.
|
||||
Description string `json:"description,omitempty"` // String representation of the object.
|
||||
ObjectID RemoteObjectID `json:"objectId,omitempty"` // Unique object identifier (for non-primitive values).
|
||||
Preview *ObjectPreview `json:"preview,omitempty"` // Preview containing abbreviated property values. Specified for object type values only.
|
||||
CustomPreview *CustomPreview `json:"customPreview,omitempty"`
|
||||
}
|
||||
|
||||
// CustomPreview [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-CustomPreview
|
||||
type CustomPreview struct {
|
||||
Header string `json:"header"` // The JSON-stringified result of formatter.header(object, config) call. It contains json ML array that represents RemoteObject.
|
||||
BodyGetterID RemoteObjectID `json:"bodyGetterId,omitempty"` // If formatter returns true as a result of formatter.hasBody call then bodyGetterId will contain RemoteObjectId for the function that returns result of formatter.body(object, config) call. The result value is json ML array.
|
||||
}
|
||||
|
||||
// ObjectPreview object containing abbreviated remote object value.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-ObjectPreview
|
||||
type ObjectPreview struct {
|
||||
Type Type `json:"type"` // Object type.
|
||||
Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only.
|
||||
Description string `json:"description,omitempty"` // String representation of the object.
|
||||
Overflow bool `json:"overflow"` // True iff some of the properties or entries of the original object did not fit.
|
||||
Properties []*PropertyPreview `json:"properties"` // List of the properties.
|
||||
Entries []*EntryPreview `json:"entries,omitempty"` // List of the entries. Specified for map and set subtype values only.
|
||||
}
|
||||
|
||||
// PropertyPreview [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-PropertyPreview
|
||||
type PropertyPreview struct {
|
||||
Name string `json:"name"` // Property name.
|
||||
Type Type `json:"type"` // Object type. Accessor means that the property itself is an accessor property.
|
||||
Value string `json:"value,omitempty"` // User-friendly property value string.
|
||||
ValuePreview *ObjectPreview `json:"valuePreview,omitempty"` // Nested value preview.
|
||||
Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only.
|
||||
}
|
||||
|
||||
// EntryPreview [no description].
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-EntryPreview
|
||||
type EntryPreview struct {
|
||||
Key *ObjectPreview `json:"key,omitempty"` // Preview of the key. Specified for map-like collection entries.
|
||||
Value *ObjectPreview `json:"value"` // Preview of the value.
|
||||
}
|
||||
|
||||
// PropertyDescriptor object property descriptor.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-PropertyDescriptor
|
||||
type PropertyDescriptor struct {
|
||||
Name string `json:"name"` // Property name or symbol description.
|
||||
Value *RemoteObject `json:"value,omitempty"` // The value associated with the property.
|
||||
Writable bool `json:"writable,omitempty"` // True if the value associated with the property may be changed (data descriptors only).
|
||||
Get *RemoteObject `json:"get,omitempty"` // A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only).
|
||||
Set *RemoteObject `json:"set,omitempty"` // A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only).
|
||||
Configurable bool `json:"configurable"` // True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
|
||||
Enumerable bool `json:"enumerable"` // True if this property shows up during enumeration of the properties on the corresponding object.
|
||||
WasThrown bool `json:"wasThrown,omitempty"` // True if the result was thrown during the evaluation.
|
||||
IsOwn bool `json:"isOwn,omitempty"` // True if the property is owned for the object.
|
||||
Symbol *RemoteObject `json:"symbol,omitempty"` // Property symbol object, if the property is of the symbol type.
|
||||
}
|
||||
|
||||
// InternalPropertyDescriptor object internal property descriptor. This
|
||||
// property isn't normally visible in JavaScript code.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-InternalPropertyDescriptor
|
||||
type InternalPropertyDescriptor struct {
|
||||
Name string `json:"name"` // Conventional property name.
|
||||
Value *RemoteObject `json:"value,omitempty"` // The value associated with the property.
|
||||
}
|
||||
|
||||
// PrivatePropertyDescriptor object private field descriptor.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-PrivatePropertyDescriptor
|
||||
type PrivatePropertyDescriptor struct {
|
||||
Name string `json:"name"` // Private property name.
|
||||
Value *RemoteObject `json:"value,omitempty"` // The value associated with the private property.
|
||||
Get *RemoteObject `json:"get,omitempty"` // A function which serves as a getter for the private property, or undefined if there is no getter (accessor descriptors only).
|
||||
Set *RemoteObject `json:"set,omitempty"` // A function which serves as a setter for the private property, or undefined if there is no setter (accessor descriptors only).
|
||||
}
|
||||
|
||||
// CallArgument represents function call argument. Either remote object id
|
||||
// objectId, primitive value, unserializable primitive value or neither of (for
|
||||
// undefined) them should be specified.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-CallArgument
|
||||
type CallArgument struct {
|
||||
Value easyjson.RawMessage `json:"value,omitempty"` // Primitive value or serializable javascript object.
|
||||
UnserializableValue UnserializableValue `json:"unserializableValue,omitempty"` // Primitive value which can not be JSON-stringified.
|
||||
ObjectID RemoteObjectID `json:"objectId,omitempty"` // Remote object handle.
|
||||
}
|
||||
|
||||
// ExecutionContextID ID of an execution context.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-ExecutionContextId
|
||||
type ExecutionContextID int64
|
||||
|
||||
// Int64 returns the ExecutionContextID as int64 value.
|
||||
func (t ExecutionContextID) Int64() int64 {
|
||||
return int64(t)
|
||||
}
|
||||
|
||||
// ExecutionContextDescription description of an isolated world.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-ExecutionContextDescription
|
||||
type ExecutionContextDescription struct {
|
||||
ID ExecutionContextID `json:"id"` // Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
|
||||
Origin string `json:"origin"` // Execution context origin.
|
||||
Name string `json:"name"` // Human readable name describing given context.
|
||||
AuxData easyjson.RawMessage `json:"auxData,omitempty"`
|
||||
}
|
||||
|
||||
// ExceptionDetails detailed information about exception (or error) that was
|
||||
// thrown during script compilation or execution.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-ExceptionDetails
|
||||
type ExceptionDetails struct {
|
||||
ExceptionID int64 `json:"exceptionId"` // Exception id.
|
||||
Text string `json:"text"` // Exception text, which should be used together with exception object when available.
|
||||
LineNumber int64 `json:"lineNumber"` // Line number of the exception location (0-based).
|
||||
ColumnNumber int64 `json:"columnNumber"` // Column number of the exception location (0-based).
|
||||
ScriptID ScriptID `json:"scriptId,omitempty"` // Script ID of the exception location.
|
||||
URL string `json:"url,omitempty"` // URL of the exception location, to be used when the script was not reported.
|
||||
StackTrace *StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace if available.
|
||||
Exception *RemoteObject `json:"exception,omitempty"` // Exception object if available.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where exception happened.
|
||||
}
|
||||
|
||||
// Error satisfies the error interface.
|
||||
func (e *ExceptionDetails) Error() string {
|
||||
// TODO: watch script parsed events and match the ExceptionDetails.ScriptID
|
||||
// to the name/location of the actual code and display here
|
||||
return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
|
||||
}
|
||||
|
||||
// Timestamp number of milliseconds since epoch.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-Timestamp
|
||||
type Timestamp time.Time
|
||||
|
||||
// Time returns the Timestamp as time.Time value.
|
||||
func (t Timestamp) Time() time.Time {
|
||||
return time.Time(t)
|
||||
}
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t Timestamp) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
v := float64(time.Time(t).UnixNano() / int64(time.Millisecond))
|
||||
|
||||
out.Buffer.EnsureSpace(20)
|
||||
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t Timestamp) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *Timestamp) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
*t = Timestamp(time.Unix(0, int64(in.Float64()*float64(time.Millisecond))))
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *Timestamp) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// TimeDelta number of milliseconds.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-TimeDelta
|
||||
type TimeDelta float64
|
||||
|
||||
// Float64 returns the TimeDelta as float64 value.
|
||||
func (t TimeDelta) Float64() float64 {
|
||||
return float64(t)
|
||||
}
|
||||
|
||||
// CallFrame stack entry for runtime errors and assertions.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-CallFrame
|
||||
type CallFrame struct {
|
||||
FunctionName string `json:"functionName"` // JavaScript function name.
|
||||
ScriptID ScriptID `json:"scriptId"` // JavaScript script id.
|
||||
URL string `json:"url"` // JavaScript script name or url.
|
||||
LineNumber int64 `json:"lineNumber"` // JavaScript script line number (0-based).
|
||||
ColumnNumber int64 `json:"columnNumber"` // JavaScript script column number (0-based).
|
||||
}
|
||||
|
||||
// StackTrace call frames for assertions or error messages.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-StackTrace
|
||||
type StackTrace struct {
|
||||
Description string `json:"description,omitempty"` // String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
|
||||
CallFrames []*CallFrame `json:"callFrames"` // JavaScript function name.
|
||||
Parent *StackTrace `json:"parent,omitempty"` // Asynchronous JavaScript stack trace that preceded this stack, if available.
|
||||
ParentID *StackTraceID `json:"parentId,omitempty"` // Asynchronous JavaScript stack trace that preceded this stack, if available.
|
||||
}
|
||||
|
||||
// UniqueDebuggerID unique identifier of current debugger.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-UniqueDebuggerId
|
||||
type UniqueDebuggerID string
|
||||
|
||||
// String returns the UniqueDebuggerID as string value.
|
||||
func (t UniqueDebuggerID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// StackTraceID if debuggerId is set stack trace comes from another debugger
|
||||
// and can be resolved there. This allows to track cross-debugger calls. See
|
||||
// Runtime.StackTrace and Debugger.paused for usages.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-StackTraceId
|
||||
type StackTraceID struct {
|
||||
ID string `json:"id"`
|
||||
DebuggerID UniqueDebuggerID `json:"debuggerId,omitempty"`
|
||||
}
|
||||
|
||||
// Type object type.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-RemoteObject
|
||||
type Type string
|
||||
|
||||
// String returns the Type as string value.
|
||||
func (t Type) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// Type values.
|
||||
const (
|
||||
TypeObject Type = "object"
|
||||
TypeFunction Type = "function"
|
||||
TypeUndefined Type = "undefined"
|
||||
TypeString Type = "string"
|
||||
TypeNumber Type = "number"
|
||||
TypeBoolean Type = "boolean"
|
||||
TypeSymbol Type = "symbol"
|
||||
TypeBigint Type = "bigint"
|
||||
TypeWasm Type = "wasm"
|
||||
TypeAccessor Type = "accessor"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t Type) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch Type(in.String()) {
|
||||
case TypeObject:
|
||||
*t = TypeObject
|
||||
case TypeFunction:
|
||||
*t = TypeFunction
|
||||
case TypeUndefined:
|
||||
*t = TypeUndefined
|
||||
case TypeString:
|
||||
*t = TypeString
|
||||
case TypeNumber:
|
||||
*t = TypeNumber
|
||||
case TypeBoolean:
|
||||
*t = TypeBoolean
|
||||
case TypeSymbol:
|
||||
*t = TypeSymbol
|
||||
case TypeBigint:
|
||||
*t = TypeBigint
|
||||
case TypeWasm:
|
||||
*t = TypeWasm
|
||||
case TypeAccessor:
|
||||
*t = TypeAccessor
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown Type value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *Type) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// Subtype object subtype hint. Specified for object or wasm type values
|
||||
// only.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#type-RemoteObject
|
||||
type Subtype string
|
||||
|
||||
// String returns the Subtype as string value.
|
||||
func (t Subtype) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// Subtype values.
|
||||
const (
|
||||
SubtypeArray Subtype = "array"
|
||||
SubtypeNull Subtype = "null"
|
||||
SubtypeNode Subtype = "node"
|
||||
SubtypeRegexp Subtype = "regexp"
|
||||
SubtypeDate Subtype = "date"
|
||||
SubtypeMap Subtype = "map"
|
||||
SubtypeSet Subtype = "set"
|
||||
SubtypeWeakmap Subtype = "weakmap"
|
||||
SubtypeWeakset Subtype = "weakset"
|
||||
SubtypeIterator Subtype = "iterator"
|
||||
SubtypeGenerator Subtype = "generator"
|
||||
SubtypeError Subtype = "error"
|
||||
SubtypeProxy Subtype = "proxy"
|
||||
SubtypePromise Subtype = "promise"
|
||||
SubtypeTypedarray Subtype = "typedarray"
|
||||
SubtypeArraybuffer Subtype = "arraybuffer"
|
||||
SubtypeDataview Subtype = "dataview"
|
||||
SubtypeI32 Subtype = "i32"
|
||||
SubtypeI64 Subtype = "i64"
|
||||
SubtypeF32 Subtype = "f32"
|
||||
SubtypeF64 Subtype = "f64"
|
||||
SubtypeV128 Subtype = "v128"
|
||||
SubtypeAnyref Subtype = "anyref"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t Subtype) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t Subtype) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *Subtype) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch Subtype(in.String()) {
|
||||
case SubtypeArray:
|
||||
*t = SubtypeArray
|
||||
case SubtypeNull:
|
||||
*t = SubtypeNull
|
||||
case SubtypeNode:
|
||||
*t = SubtypeNode
|
||||
case SubtypeRegexp:
|
||||
*t = SubtypeRegexp
|
||||
case SubtypeDate:
|
||||
*t = SubtypeDate
|
||||
case SubtypeMap:
|
||||
*t = SubtypeMap
|
||||
case SubtypeSet:
|
||||
*t = SubtypeSet
|
||||
case SubtypeWeakmap:
|
||||
*t = SubtypeWeakmap
|
||||
case SubtypeWeakset:
|
||||
*t = SubtypeWeakset
|
||||
case SubtypeIterator:
|
||||
*t = SubtypeIterator
|
||||
case SubtypeGenerator:
|
||||
*t = SubtypeGenerator
|
||||
case SubtypeError:
|
||||
*t = SubtypeError
|
||||
case SubtypeProxy:
|
||||
*t = SubtypeProxy
|
||||
case SubtypePromise:
|
||||
*t = SubtypePromise
|
||||
case SubtypeTypedarray:
|
||||
*t = SubtypeTypedarray
|
||||
case SubtypeArraybuffer:
|
||||
*t = SubtypeArraybuffer
|
||||
case SubtypeDataview:
|
||||
*t = SubtypeDataview
|
||||
case SubtypeI32:
|
||||
*t = SubtypeI32
|
||||
case SubtypeI64:
|
||||
*t = SubtypeI64
|
||||
case SubtypeF32:
|
||||
*t = SubtypeF32
|
||||
case SubtypeF64:
|
||||
*t = SubtypeF64
|
||||
case SubtypeV128:
|
||||
*t = SubtypeV128
|
||||
case SubtypeAnyref:
|
||||
*t = SubtypeAnyref
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown Subtype value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *Subtype) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// APIType type of the call.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Runtime#event-consoleAPICalled
|
||||
type APIType string
|
||||
|
||||
// String returns the APIType as string value.
|
||||
func (t APIType) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// APIType values.
|
||||
const (
|
||||
APITypeLog APIType = "log"
|
||||
APITypeDebug APIType = "debug"
|
||||
APITypeInfo APIType = "info"
|
||||
APITypeError APIType = "error"
|
||||
APITypeWarning APIType = "warning"
|
||||
APITypeDir APIType = "dir"
|
||||
APITypeDirxml APIType = "dirxml"
|
||||
APITypeTable APIType = "table"
|
||||
APITypeTrace APIType = "trace"
|
||||
APITypeClear APIType = "clear"
|
||||
APITypeStartGroup APIType = "startGroup"
|
||||
APITypeStartGroupCollapsed APIType = "startGroupCollapsed"
|
||||
APITypeEndGroup APIType = "endGroup"
|
||||
APITypeAssert APIType = "assert"
|
||||
APITypeProfile APIType = "profile"
|
||||
APITypeProfileEnd APIType = "profileEnd"
|
||||
APITypeCount APIType = "count"
|
||||
APITypeTimeEnd APIType = "timeEnd"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t APIType) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t APIType) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *APIType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch APIType(in.String()) {
|
||||
case APITypeLog:
|
||||
*t = APITypeLog
|
||||
case APITypeDebug:
|
||||
*t = APITypeDebug
|
||||
case APITypeInfo:
|
||||
*t = APITypeInfo
|
||||
case APITypeError:
|
||||
*t = APITypeError
|
||||
case APITypeWarning:
|
||||
*t = APITypeWarning
|
||||
case APITypeDir:
|
||||
*t = APITypeDir
|
||||
case APITypeDirxml:
|
||||
*t = APITypeDirxml
|
||||
case APITypeTable:
|
||||
*t = APITypeTable
|
||||
case APITypeTrace:
|
||||
*t = APITypeTrace
|
||||
case APITypeClear:
|
||||
*t = APITypeClear
|
||||
case APITypeStartGroup:
|
||||
*t = APITypeStartGroup
|
||||
case APITypeStartGroupCollapsed:
|
||||
*t = APITypeStartGroupCollapsed
|
||||
case APITypeEndGroup:
|
||||
*t = APITypeEndGroup
|
||||
case APITypeAssert:
|
||||
*t = APITypeAssert
|
||||
case APITypeProfile:
|
||||
*t = APITypeProfile
|
||||
case APITypeProfileEnd:
|
||||
*t = APITypeProfileEnd
|
||||
case APITypeCount:
|
||||
*t = APITypeCount
|
||||
case APITypeTimeEnd:
|
||||
*t = APITypeTimeEnd
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown APIType value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *APIType) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
Reference in New Issue
Block a user