runtime

package
Version: v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 8 Imported by: 112

Documentation

Overview

Package runtime implements 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Runtime domain with the connection set to conn.

Types

type AddBindingArgs added in v0.18.4

type AddBindingArgs struct {
	Name               string              `json:"name"`                         // No description.
	ExecutionContextID *ExecutionContextID `json:"executionContextId,omitempty"` // If specified, the binding would only be exposed to the specified execution context. If omitted and `executionContextName` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with `executionContextName`.
	// ExecutionContextName If specified, the binding is exposed to the
	// executionContext with matching name, even for contexts created after
	// the binding is added. See also `ExecutionContext.name` and
	// `worldName` parameter to `Page.addScriptToEvaluateOnNewDocument`.
	// This parameter is mutually exclusive with `executionContextId`.
	//
	// Note: This property is experimental.
	ExecutionContextName *string `json:"executionContextName,omitempty"`
}

AddBindingArgs represents the arguments for AddBinding in the Runtime domain.

func NewAddBindingArgs added in v0.18.4

func NewAddBindingArgs(name string) *AddBindingArgs

NewAddBindingArgs initializes AddBindingArgs with the required arguments.

func (*AddBindingArgs) SetExecutionContextID added in v0.18.4

func (a *AddBindingArgs) SetExecutionContextID(executionContextID ExecutionContextID) *AddBindingArgs

SetExecutionContextID sets the ExecutionContextID optional argument. If specified, the binding would only be exposed to the specified execution context. If omitted and `executionContextName` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with `executionContextName`.

func (*AddBindingArgs) SetExecutionContextName added in v0.31.0

func (a *AddBindingArgs) SetExecutionContextName(executionContextName string) *AddBindingArgs

SetExecutionContextName sets the ExecutionContextName optional argument. If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See also `ExecutionContext.name` and `worldName` parameter to `Page.addScriptToEvaluateOnNewDocument`. This parameter is mutually exclusive with `executionContextId`.

Note: This property is experimental.

type AwaitPromiseArgs

type AwaitPromiseArgs 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.
}

AwaitPromiseArgs represents the arguments for AwaitPromise in the Runtime domain.

func NewAwaitPromiseArgs

func NewAwaitPromiseArgs(promiseObjectID RemoteObjectID) *AwaitPromiseArgs

NewAwaitPromiseArgs initializes AwaitPromiseArgs with the required arguments.

func (*AwaitPromiseArgs) SetGeneratePreview

func (a *AwaitPromiseArgs) SetGeneratePreview(generatePreview bool) *AwaitPromiseArgs

SetGeneratePreview sets the GeneratePreview optional argument. Whether preview should be generated for the result.

func (*AwaitPromiseArgs) SetReturnByValue

func (a *AwaitPromiseArgs) SetReturnByValue(returnByValue bool) *AwaitPromiseArgs

SetReturnByValue sets the ReturnByValue optional argument. Whether the result is expected to be a JSON object that should be sent by value.

type AwaitPromiseReply

type AwaitPromiseReply struct {
	Result           RemoteObject      `json:"result"`                     // Promise result. Will contain rejected value if promise was rejected.
	ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details if stack strace is available.
}

AwaitPromiseReply represents the return values for AwaitPromise in the Runtime domain.

type BindingCalledClient added in v0.18.4

type BindingCalledClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*BindingCalledReply, error)
	rpcc.Stream
}

BindingCalledClient is a client for BindingCalled events. Notification is issued every time when binding is called.

type BindingCalledReply added in v0.18.4

type BindingCalledReply struct {
	Name               string             `json:"name"`               // No description.
	Payload            string             `json:"payload"`            // No description.
	ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made.
}

BindingCalledReply is the reply for BindingCalled events.

type CallArgument

type CallArgument struct {
	Value               json.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.
}

CallArgument Represents function call argument. Either remote object id `objectId`, primitive `value`, unserializable primitive value or neither of (for undefined) them should be specified.

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   int      `json:"lineNumber"`   // JavaScript script line number (0-based).
	ColumnNumber int      `json:"columnNumber"` // JavaScript script column number (0-based).
}

CallFrame Stack entry for runtime errors and assertions.

type CallFunctionOnArgs

type CallFunctionOnArgs 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 Whether preview should be generated for the result.
	//
	// Note: This property is experimental.
	GeneratePreview    *bool               `json:"generatePreview,omitempty"`
	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.
}

CallFunctionOnArgs represents the arguments for CallFunctionOn in the Runtime domain.

func NewCallFunctionOnArgs

func NewCallFunctionOnArgs(functionDeclaration string) *CallFunctionOnArgs

NewCallFunctionOnArgs initializes CallFunctionOnArgs with the required arguments.

func (*CallFunctionOnArgs) SetArguments

func (a *CallFunctionOnArgs) SetArguments(arguments []CallArgument) *CallFunctionOnArgs

SetArguments sets the Arguments optional argument. Call arguments. All call arguments must belong to the same JavaScript world as the target object.

func (*CallFunctionOnArgs) SetAwaitPromise

func (a *CallFunctionOnArgs) SetAwaitPromise(awaitPromise bool) *CallFunctionOnArgs

SetAwaitPromise sets the AwaitPromise optional argument. Whether execution should `await` for resulting value and return once awaited promise is resolved.

func (*CallFunctionOnArgs) SetExecutionContextID added in v0.12.1

func (a *CallFunctionOnArgs) SetExecutionContextID(executionContextID ExecutionContextID) *CallFunctionOnArgs

SetExecutionContextID sets the ExecutionContextID optional argument. Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.

func (*CallFunctionOnArgs) SetGeneratePreview

func (a *CallFunctionOnArgs) SetGeneratePreview(generatePreview bool) *CallFunctionOnArgs

SetGeneratePreview sets the GeneratePreview optional argument. Whether preview should be generated for the result.

Note: This property is experimental.

func (*CallFunctionOnArgs) SetObjectGroup added in v0.12.1

func (a *CallFunctionOnArgs) SetObjectGroup(objectGroup string) *CallFunctionOnArgs

SetObjectGroup sets the ObjectGroup optional argument. 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 (*CallFunctionOnArgs) SetObjectID added in v0.12.1

func (a *CallFunctionOnArgs) SetObjectID(objectID RemoteObjectID) *CallFunctionOnArgs

SetObjectID sets the ObjectID optional argument. Identifier of the object to call function on. Either objectId or executionContextId should be specified.

func (*CallFunctionOnArgs) SetReturnByValue

func (a *CallFunctionOnArgs) SetReturnByValue(returnByValue bool) *CallFunctionOnArgs

SetReturnByValue sets the ReturnByValue optional argument. Whether the result is expected to be a JSON object which should be sent by value.

func (*CallFunctionOnArgs) SetSilent

func (a *CallFunctionOnArgs) SetSilent(silent bool) *CallFunctionOnArgs

SetSilent sets the Silent optional argument. In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides `setPauseOnException` state.

func (*CallFunctionOnArgs) SetUserGesture

func (a *CallFunctionOnArgs) SetUserGesture(userGesture bool) *CallFunctionOnArgs

SetUserGesture sets the UserGesture optional argument. Whether execution should be treated as initiated by user in the UI.

type CallFunctionOnReply

type CallFunctionOnReply struct {
	Result           RemoteObject      `json:"result"`                     // Call result.
	ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}

CallFunctionOnReply represents the return values for CallFunctionOn in the Runtime domain.

type CompileScriptArgs

type CompileScriptArgs 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.
}

CompileScriptArgs represents the arguments for CompileScript in the Runtime domain.

func NewCompileScriptArgs

func NewCompileScriptArgs(expression string, sourceURL string, persistScript bool) *CompileScriptArgs

NewCompileScriptArgs initializes CompileScriptArgs with the required arguments.

func (*CompileScriptArgs) SetExecutionContextID

func (a *CompileScriptArgs) SetExecutionContextID(executionContextID ExecutionContextID) *CompileScriptArgs

SetExecutionContextID sets the ExecutionContextID optional argument. 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.

type CompileScriptReply

type CompileScriptReply struct {
	ScriptID         *ScriptID         `json:"scriptId,omitempty"`         // Id of the script.
	ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}

CompileScriptReply represents the return values for CompileScript in the Runtime domain.

type ConsoleAPICalledClient

type ConsoleAPICalledClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ConsoleAPICalledReply, error)
	rpcc.Stream
}

ConsoleAPICalledClient is a client for ConsoleAPICalled events. Issued when console API was called.

type ConsoleAPICalledReply

type ConsoleAPICalledReply struct {
	// Type Type of the call.
	//
	// Values: "log", "debug", "info", "error", "warning", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "profile", "profileEnd", "count", "timeEnd".
	Type               string             `json:"type"`
	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 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.
	//
	// Note: This property is experimental.
	Context *string `json:"context,omitempty"`
}

ConsoleAPICalledReply is the reply for ConsoleAPICalled events.

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.
}

CustomPreview

Note: This type is experimental.

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.
}

EntryPreview

Note: This type is experimental.

func (EntryPreview) String

func (r EntryPreview) String() string

String returns a human readable string of the entry preview.

type EvaluateArgs

type EvaluateArgs 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. This is mutually exclusive with `uniqueContextId`, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.
	ReturnByValue         *bool               `json:"returnByValue,omitempty"`         // Whether the result is expected to be a JSON object that should be sent by value.
	// GeneratePreview Whether preview should be generated for the result.
	//
	// Note: This property is experimental.
	GeneratePreview *bool `json:"generatePreview,omitempty"`
	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 Whether to throw an exception if side effect
	// cannot be ruled out during evaluation. This implies `disableBreaks`
	// below.
	//
	// Note: This property is experimental.
	ThrowOnSideEffect *bool `json:"throwOnSideEffect,omitempty"`
	// Timeout Terminate execution after timing out (number of
	// milliseconds).
	//
	// Note: This property is experimental.
	Timeout *TimeDelta `json:"timeout,omitempty"`
	// DisableBreaks Disable breakpoints during execution.
	//
	// Note: This property is experimental.
	DisableBreaks *bool `json:"disableBreaks,omitempty"`
	// ReplMode 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.
	//
	// Note: This property is experimental.
	ReplMode *bool `json:"replMode,omitempty"`
	// AllowUnsafeEvalBlockedByCSP The Content Security Policy (CSP) for
	// the target might block 'unsafe-eval' which includes eval(),
	// Function(), setTimeout() and setInterval() when called with
	// non-callable arguments. This flag bypasses CSP for this evaluation
	// and allows unsafe-eval. Defaults to true.
	//
	// Note: This property is experimental.
	AllowUnsafeEvalBlockedByCSP *bool `json:"allowUnsafeEvalBlockedByCSP,omitempty"`
	// UniqueContextID An alternative way to specify the execution context
	// to evaluate in. Compared to contextId that may be reused across
	// processes, this is guaranteed to be system-unique, so it can be used
	// to prevent accidental evaluation of the expression in context
	// different than intended (e.g. as a result of navigation across
	// process boundaries). This is mutually exclusive with `contextId`.
	//
	// Note: This property is experimental.
	UniqueContextID *string `json:"uniqueContextId,omitempty"`
}

EvaluateArgs represents the arguments for Evaluate in the Runtime domain.

func NewEvaluateArgs

func NewEvaluateArgs(expression string) *EvaluateArgs

NewEvaluateArgs initializes EvaluateArgs with the required arguments.

func (*EvaluateArgs) SetAllowUnsafeEvalBlockedByCSP added in v0.31.0

func (a *EvaluateArgs) SetAllowUnsafeEvalBlockedByCSP(allowUnsafeEvalBlockedByCSP bool) *EvaluateArgs

SetAllowUnsafeEvalBlockedByCSP sets the AllowUnsafeEvalBlockedByCSP optional argument. The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true.

Note: This property is experimental.

func (*EvaluateArgs) SetAwaitPromise

func (a *EvaluateArgs) SetAwaitPromise(awaitPromise bool) *EvaluateArgs

SetAwaitPromise sets the AwaitPromise optional argument. Whether execution should `await` for resulting value and return once awaited promise is resolved.

func (*EvaluateArgs) SetContextID

func (a *EvaluateArgs) SetContextID(contextID ExecutionContextID) *EvaluateArgs

SetContextID sets the ContextID optional argument. 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. This is mutually exclusive with `uniqueContextId`, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.

func (*EvaluateArgs) SetDisableBreaks added in v0.25.0

func (a *EvaluateArgs) SetDisableBreaks(disableBreaks bool) *EvaluateArgs

SetDisableBreaks sets the DisableBreaks optional argument. Disable breakpoints during execution.

Note: This property is experimental.

func (*EvaluateArgs) SetGeneratePreview

func (a *EvaluateArgs) SetGeneratePreview(generatePreview bool) *EvaluateArgs

SetGeneratePreview sets the GeneratePreview optional argument. Whether preview should be generated for the result.

Note: This property is experimental.

func (*EvaluateArgs) SetIncludeCommandLineAPI

func (a *EvaluateArgs) SetIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateArgs

SetIncludeCommandLineAPI sets the IncludeCommandLineAPI optional argument. Determines whether Command Line API should be available during the evaluation.

func (*EvaluateArgs) SetObjectGroup

func (a *EvaluateArgs) SetObjectGroup(objectGroup string) *EvaluateArgs

SetObjectGroup sets the ObjectGroup optional argument. Symbolic group name that can be used to release multiple objects.

func (*EvaluateArgs) SetReplMode added in v0.25.0

func (a *EvaluateArgs) SetReplMode(replMode bool) *EvaluateArgs

SetReplMode sets the ReplMode optional argument. 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.

Note: This property is experimental.

func (*EvaluateArgs) SetReturnByValue

func (a *EvaluateArgs) SetReturnByValue(returnByValue bool) *EvaluateArgs

SetReturnByValue sets the ReturnByValue optional argument. Whether the result is expected to be a JSON object that should be sent by value.

func (*EvaluateArgs) SetSilent

func (a *EvaluateArgs) SetSilent(silent bool) *EvaluateArgs

SetSilent sets the Silent optional argument. In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides `setPauseOnException` state.

func (*EvaluateArgs) SetThrowOnSideEffect added in v0.17.1

func (a *EvaluateArgs) SetThrowOnSideEffect(throwOnSideEffect bool) *EvaluateArgs

SetThrowOnSideEffect sets the ThrowOnSideEffect optional argument. Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies `disableBreaks` below.

Note: This property is experimental.

func (*EvaluateArgs) SetTimeout added in v0.18.1

func (a *EvaluateArgs) SetTimeout(timeout TimeDelta) *EvaluateArgs

SetTimeout sets the Timeout optional argument. Terminate execution after timing out (number of milliseconds).

Note: This property is experimental.

func (*EvaluateArgs) SetUniqueContextID added in v0.31.0

func (a *EvaluateArgs) SetUniqueContextID(uniqueContextID string) *EvaluateArgs

SetUniqueContextID sets the UniqueContextID optional argument. An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with `contextId`.

Note: This property is experimental.

func (*EvaluateArgs) SetUserGesture

func (a *EvaluateArgs) SetUserGesture(userGesture bool) *EvaluateArgs

SetUserGesture sets the UserGesture optional argument. Whether execution should be treated as initiated by user in the UI.

type EvaluateReply

type EvaluateReply struct {
	Result           RemoteObject      `json:"result"`                     // Evaluation result.
	ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}

EvaluateReply represents the return values for Evaluate in the Runtime domain.

type ExceptionDetails

type ExceptionDetails struct {
	ExceptionID        int                 `json:"exceptionId"`                  // Exception id.
	Text               string              `json:"text"`                         // Exception text, which should be used together with exception object when available.
	LineNumber         int                 `json:"lineNumber"`                   // Line number of the exception location (0-based).
	ColumnNumber       int                 `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.
}

ExceptionDetails Detailed information about exception (or error) that was thrown during script compilation or execution.

func (ExceptionDetails) Error

func (r ExceptionDetails) Error() string

Error implements error for ExceptionDetails.

type ExceptionRevokedClient

type ExceptionRevokedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ExceptionRevokedReply, error)
	rpcc.Stream
}

ExceptionRevokedClient is a client for ExceptionRevoked events. Issued when unhandled exception was revoked.

type ExceptionRevokedReply

type ExceptionRevokedReply struct {
	Reason      string `json:"reason"`      // Reason describing why exception was revoked.
	ExceptionID int    `json:"exceptionId"` // The id of revoked exception, as reported in `exceptionThrown`.
}

ExceptionRevokedReply is the reply for ExceptionRevoked events.

type ExceptionThrownClient

type ExceptionThrownClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ExceptionThrownReply, error)
	rpcc.Stream
}

ExceptionThrownClient is a client for ExceptionThrown events. Issued when exception was thrown and unhandled.

type ExceptionThrownReply

type ExceptionThrownReply struct {
	Timestamp        Timestamp        `json:"timestamp"`        // Timestamp of the exception.
	ExceptionDetails ExceptionDetails `json:"exceptionDetails"` // No description.
}

ExceptionThrownReply is the reply for ExceptionThrown events.

type ExecutionContextCreatedClient

type ExecutionContextCreatedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ExecutionContextCreatedReply, error)
	rpcc.Stream
}

ExecutionContextCreatedClient is a client for ExecutionContextCreated events. Issued when new execution context is created.

type ExecutionContextCreatedReply

type ExecutionContextCreatedReply struct {
	Context ExecutionContextDescription `json:"context"` // A newly created execution context.
}

ExecutionContextCreatedReply is the reply for ExecutionContextCreated events.

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.
	// UniqueID A system-unique execution context identifier. Unlike the
	// id, this is unique across multiple processes, so can be reliably
	// used to identify specific context while backend performs a
	// cross-process navigation.
	//
	// Note: This property is experimental.
	UniqueID string          `json:"uniqueId"`
	AuxData  json.RawMessage `json:"auxData,omitempty"` // Embedder-specific auxiliary data.
}

ExecutionContextDescription Description of an isolated world.

type ExecutionContextDestroyedClient

type ExecutionContextDestroyedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ExecutionContextDestroyedReply, error)
	rpcc.Stream
}

ExecutionContextDestroyedClient is a client for ExecutionContextDestroyed events. Issued when execution context is destroyed.

type ExecutionContextDestroyedReply

type ExecutionContextDestroyedReply struct {
	ExecutionContextID ExecutionContextID `json:"executionContextId"` // Id of the destroyed context
}

ExecutionContextDestroyedReply is the reply for ExecutionContextDestroyed events.

type ExecutionContextID

type ExecutionContextID int

ExecutionContextID Id of an execution context.

type ExecutionContextsClearedClient

type ExecutionContextsClearedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ExecutionContextsClearedReply, error)
	rpcc.Stream
}

ExecutionContextsClearedClient is a client for ExecutionContextsCleared events. Issued when all executionContexts were cleared in browser

type ExecutionContextsClearedReply

type ExecutionContextsClearedReply struct {
}

ExecutionContextsClearedReply is the reply for ExecutionContextsCleared events.

type GetHeapUsageReply added in v0.17.2

type GetHeapUsageReply struct {
	UsedSize  float64 `json:"usedSize"`  // Used heap size in bytes.
	TotalSize float64 `json:"totalSize"` // Allocated heap size in bytes.
}

GetHeapUsageReply represents the return values for GetHeapUsage in the Runtime domain.

type GetIsolateIDReply added in v0.17.2

type GetIsolateIDReply struct {
	ID string `json:"id"` // The isolate id.
}

GetIsolateIDReply represents the return values for GetIsolateID in the Runtime domain.

type GetPropertiesArgs

type GetPropertiesArgs 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 If true, returns accessor properties (with
	// getter/setter) only; internal properties are not returned either.
	//
	// Note: This property is experimental.
	AccessorPropertiesOnly *bool `json:"accessorPropertiesOnly,omitempty"`
	// GeneratePreview Whether preview should be generated for the
	// results.
	//
	// Note: This property is experimental.
	GeneratePreview *bool `json:"generatePreview,omitempty"`
}

GetPropertiesArgs represents the arguments for GetProperties in the Runtime domain.

func NewGetPropertiesArgs

func NewGetPropertiesArgs(objectID RemoteObjectID) *GetPropertiesArgs

NewGetPropertiesArgs initializes GetPropertiesArgs with the required arguments.

func (*GetPropertiesArgs) SetAccessorPropertiesOnly

func (a *GetPropertiesArgs) SetAccessorPropertiesOnly(accessorPropertiesOnly bool) *GetPropertiesArgs

SetAccessorPropertiesOnly sets the AccessorPropertiesOnly optional argument. If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.

Note: This property is experimental.

func (*GetPropertiesArgs) SetGeneratePreview

func (a *GetPropertiesArgs) SetGeneratePreview(generatePreview bool) *GetPropertiesArgs

SetGeneratePreview sets the GeneratePreview optional argument. Whether preview should be generated for the results.

Note: This property is experimental.

func (*GetPropertiesArgs) SetOwnProperties

func (a *GetPropertiesArgs) SetOwnProperties(ownProperties bool) *GetPropertiesArgs

SetOwnProperties sets the OwnProperties optional argument. If true, returns properties belonging only to the element itself, not to its prototype chain.

type GetPropertiesReply

type GetPropertiesReply struct {
	Result             []PropertyDescriptor         `json:"result"`                       // Object properties.
	InternalProperties []InternalPropertyDescriptor `json:"internalProperties,omitempty"` // Internal object properties (only of the element itself).
	// PrivateProperties Object private properties.
	//
	// Note: This property is experimental.
	PrivateProperties []PrivatePropertyDescriptor `json:"privateProperties,omitempty"`
	ExceptionDetails  *ExceptionDetails           `json:"exceptionDetails,omitempty"` // Exception details.
}

GetPropertiesReply represents the return values for GetProperties in the Runtime domain.

type GlobalLexicalScopeNamesArgs added in v0.14.1

type GlobalLexicalScopeNamesArgs struct {
	ExecutionContextID *ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to lookup global scope variables.
}

GlobalLexicalScopeNamesArgs represents the arguments for GlobalLexicalScopeNames in the Runtime domain.

func NewGlobalLexicalScopeNamesArgs added in v0.14.1

func NewGlobalLexicalScopeNamesArgs() *GlobalLexicalScopeNamesArgs

NewGlobalLexicalScopeNamesArgs initializes GlobalLexicalScopeNamesArgs with the required arguments.

func (*GlobalLexicalScopeNamesArgs) SetExecutionContextID added in v0.14.1

func (a *GlobalLexicalScopeNamesArgs) SetExecutionContextID(executionContextID ExecutionContextID) *GlobalLexicalScopeNamesArgs

SetExecutionContextID sets the ExecutionContextID optional argument. Specifies in which execution context to lookup global scope variables.

type GlobalLexicalScopeNamesReply added in v0.14.1

type GlobalLexicalScopeNamesReply struct {
	Names []string `json:"names"` // No description.
}

GlobalLexicalScopeNamesReply represents the return values for GlobalLexicalScopeNames in the Runtime domain.

type InspectRequestedClient

type InspectRequestedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*InspectRequestedReply, error)
	rpcc.Stream
}

InspectRequestedClient is a client for InspectRequested events. Issued when object should be inspected (for example, as a result of inspect() command line API call).

type InspectRequestedReply

type InspectRequestedReply struct {
	Object RemoteObject    `json:"object"` // No description.
	Hints  json.RawMessage `json:"hints"`  // No description.
}

InspectRequestedReply is the reply for InspectRequested events.

type InternalPropertyDescriptor

type InternalPropertyDescriptor struct {
	Name  string        `json:"name"`            // Conventional property name.
	Value *RemoteObject `json:"value,omitempty"` // The value associated with the property.
}

InternalPropertyDescriptor Object internal property descriptor. This property isn't normally visible in JavaScript code.

type ObjectPreview

type ObjectPreview struct {
	// Type Object type.
	//
	// Values: "object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint".
	Type string `json:"type"`
	// Subtype Object subtype hint. Specified for `object` type values
	// only.
	//
	// Values: "array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error", "proxy", "promise", "typedarray", "arraybuffer", "dataview", "webassemblymemory", "wasmvalue".
	Subtype     *string           `json:"subtype,omitempty"`
	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.
}

ObjectPreview Object containing abbreviated remote object value.

Note: This type is experimental.

func (ObjectPreview) String

func (r ObjectPreview) String() string

String returns a human readable string of the object preview.

type PrivatePropertyDescriptor added in v0.22.0

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).
}

PrivatePropertyDescriptor Object private field descriptor.

Note: This type is experimental.

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.
}

PropertyDescriptor Object property descriptor.

type PropertyPreview

type PropertyPreview struct {
	Name string `json:"name"` // Property name.
	// Type Object type. Accessor means that the property itself is an
	// accessor property.
	//
	// Values: "object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor", "bigint".
	Type         string         `json:"type"`
	Value        *string        `json:"value,omitempty"`        // User-friendly property value string.
	ValuePreview *ObjectPreview `json:"valuePreview,omitempty"` // Nested value preview.
	// Subtype Object subtype hint. Specified for `object` type values
	// only.
	//
	// Values: "array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error", "proxy", "promise", "typedarray", "arraybuffer", "dataview", "webassemblymemory", "wasmvalue".
	Subtype *string `json:"subtype,omitempty"`
}

PropertyPreview

Note: This type is experimental.

func (PropertyPreview) String

func (r PropertyPreview) String() string

String returns a human readable string of the property.

type QueryObjectsArgs added in v0.11.4

type QueryObjectsArgs 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.
}

QueryObjectsArgs represents the arguments for QueryObjects in the Runtime domain.

func NewQueryObjectsArgs added in v0.11.4

func NewQueryObjectsArgs(prototypeObjectID RemoteObjectID) *QueryObjectsArgs

NewQueryObjectsArgs initializes QueryObjectsArgs with the required arguments.

func (*QueryObjectsArgs) SetObjectGroup added in v0.17.2

func (a *QueryObjectsArgs) SetObjectGroup(objectGroup string) *QueryObjectsArgs

SetObjectGroup sets the ObjectGroup optional argument. Symbolic group name that can be used to release the results.

type QueryObjectsReply added in v0.11.4

type QueryObjectsReply struct {
	Objects RemoteObject `json:"objects"` // Array with objects.
}

QueryObjectsReply represents the return values for QueryObjects in the Runtime domain.

type ReleaseObjectArgs

type ReleaseObjectArgs struct {
	ObjectID RemoteObjectID `json:"objectId"` // Identifier of the object to release.
}

ReleaseObjectArgs represents the arguments for ReleaseObject in the Runtime domain.

func NewReleaseObjectArgs

func NewReleaseObjectArgs(objectID RemoteObjectID) *ReleaseObjectArgs

NewReleaseObjectArgs initializes ReleaseObjectArgs with the required arguments.

type ReleaseObjectGroupArgs

type ReleaseObjectGroupArgs struct {
	ObjectGroup string `json:"objectGroup"` // Symbolic object group name.
}

ReleaseObjectGroupArgs represents the arguments for ReleaseObjectGroup in the Runtime domain.

func NewReleaseObjectGroupArgs

func NewReleaseObjectGroupArgs(objectGroup string) *ReleaseObjectGroupArgs

NewReleaseObjectGroupArgs initializes ReleaseObjectGroupArgs with the required arguments.

type RemoteObject

type RemoteObject struct {
	// Type Object type.
	//
	// Values: "object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint".
	Type string `json:"type"`
	// Subtype Object subtype hint. Specified for `object` type values
	// only. NOTE: If you change anything here, make sure to also update
	// `subtype` in `ObjectPreview` and `PropertyPreview` below.
	//
	// Values: "array", "null", "node", "regexp", "date", "map", "set", "weakmap", "weakset", "iterator", "generator", "error", "proxy", "promise", "typedarray", "arraybuffer", "dataview", "webassemblymemory", "wasmvalue".
	Subtype             *string              `json:"subtype,omitempty"`
	ClassName           *string              `json:"className,omitempty"`           // Object class (constructor) name. Specified for `object` type values only.
	Value               json.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 Preview containing abbreviated property values. Specified
	// for `object` type values only.
	//
	// Note: This property is experimental.
	Preview *ObjectPreview `json:"preview,omitempty"`
	// CustomPreview
	//
	// Note: This property is experimental.
	CustomPreview *CustomPreview `json:"customPreview,omitempty"`
}

RemoteObject Mirror object referencing original JavaScript object.

func (RemoteObject) String

func (r RemoteObject) String() string

String returns a human readable string of a runtime object.

type RemoteObjectID

type RemoteObjectID string

RemoteObjectID Unique object identifier.

type RemoveBindingArgs added in v0.18.4

type RemoveBindingArgs struct {
	Name string `json:"name"` // No description.
}

RemoveBindingArgs represents the arguments for RemoveBinding in the Runtime domain.

func NewRemoveBindingArgs added in v0.18.4

func NewRemoveBindingArgs(name string) *RemoveBindingArgs

NewRemoveBindingArgs initializes RemoveBindingArgs with the required arguments.

type RunScriptArgs

type RunScriptArgs 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.
}

RunScriptArgs represents the arguments for RunScript in the Runtime domain.

func NewRunScriptArgs

func NewRunScriptArgs(scriptID ScriptID) *RunScriptArgs

NewRunScriptArgs initializes RunScriptArgs with the required arguments.

func (*RunScriptArgs) SetAwaitPromise

func (a *RunScriptArgs) SetAwaitPromise(awaitPromise bool) *RunScriptArgs

SetAwaitPromise sets the AwaitPromise optional argument. Whether execution should `await` for resulting value and return once awaited promise is resolved.

func (*RunScriptArgs) SetExecutionContextID

func (a *RunScriptArgs) SetExecutionContextID(executionContextID ExecutionContextID) *RunScriptArgs

SetExecutionContextID sets the ExecutionContextID optional argument. 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 (*RunScriptArgs) SetGeneratePreview

func (a *RunScriptArgs) SetGeneratePreview(generatePreview bool) *RunScriptArgs

SetGeneratePreview sets the GeneratePreview optional argument. Whether preview should be generated for the result.

func (*RunScriptArgs) SetIncludeCommandLineAPI

func (a *RunScriptArgs) SetIncludeCommandLineAPI(includeCommandLineAPI bool) *RunScriptArgs

SetIncludeCommandLineAPI sets the IncludeCommandLineAPI optional argument. Determines whether Command Line API should be available during the evaluation.

func (*RunScriptArgs) SetObjectGroup

func (a *RunScriptArgs) SetObjectGroup(objectGroup string) *RunScriptArgs

SetObjectGroup sets the ObjectGroup optional argument. Symbolic group name that can be used to release multiple objects.

func (*RunScriptArgs) SetReturnByValue

func (a *RunScriptArgs) SetReturnByValue(returnByValue bool) *RunScriptArgs

SetReturnByValue sets the ReturnByValue optional argument. Whether the result is expected to be a JSON object which should be sent by value.

func (*RunScriptArgs) SetSilent

func (a *RunScriptArgs) SetSilent(silent bool) *RunScriptArgs

SetSilent sets the Silent optional argument. In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides `setPauseOnException` state.

type RunScriptReply

type RunScriptReply struct {
	Result           RemoteObject      `json:"result"`                     // Run result.
	ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}

RunScriptReply represents the return values for RunScript in the Runtime domain.

type ScriptID

type ScriptID string

ScriptID Unique script identifier.

type SetCustomObjectFormatterEnabledArgs

type SetCustomObjectFormatterEnabledArgs struct {
	Enabled bool `json:"enabled"` // No description.
}

SetCustomObjectFormatterEnabledArgs represents the arguments for SetCustomObjectFormatterEnabled in the Runtime domain.

func NewSetCustomObjectFormatterEnabledArgs

func NewSetCustomObjectFormatterEnabledArgs(enabled bool) *SetCustomObjectFormatterEnabledArgs

NewSetCustomObjectFormatterEnabledArgs initializes SetCustomObjectFormatterEnabledArgs with the required arguments.

type SetMaxCallStackSizeToCaptureArgs added in v0.18.4

type SetMaxCallStackSizeToCaptureArgs struct {
	Size int `json:"size"` // No description.
}

SetMaxCallStackSizeToCaptureArgs represents the arguments for SetMaxCallStackSizeToCapture in the Runtime domain.

func NewSetMaxCallStackSizeToCaptureArgs added in v0.18.4

func NewSetMaxCallStackSizeToCaptureArgs(size int) *SetMaxCallStackSizeToCaptureArgs

NewSetMaxCallStackSizeToCaptureArgs initializes SetMaxCallStackSizeToCaptureArgs with the required arguments.

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 Asynchronous JavaScript stack trace that preceded this
	// stack, if available.
	//
	// Note: This property is experimental.
	ParentID *StackTraceID `json:"parentId,omitempty"`
}

StackTrace Call frames for assertions or error messages.

type StackTraceID added in v0.15.2

type StackTraceID struct {
	ID         string            `json:"id"`                   // No description.
	DebuggerID *UniqueDebuggerID `json:"debuggerId,omitempty"` // No description.
}

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.

Note: This type is experimental.

type TimeDelta added in v0.18.1

type TimeDelta float64

TimeDelta Number of milliseconds.

type Timestamp

type Timestamp float64

Timestamp Number of milliseconds since epoch.

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Encodes to null if t is zero.

func (Timestamp) String

func (t Timestamp) String() string

String calls (time.Time).String().

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time parses the Unix time.

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type UniqueDebuggerID added in v0.15.2

type UniqueDebuggerID string

UniqueDebuggerID Unique identifier of current debugger.

Note: This type is experimental.

type UnserializableValue

type UnserializableValue string

UnserializableValue Primitive value which cannot be JSON-stringified. Includes values `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL