Fixing issues with code generation
This commit is contained in:
parent
861578ac70
commit
58283934b9
12
actions.go
12
actions.go
|
@ -4,19 +4,19 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// Action is a single atomic action.
|
||||
type Action interface {
|
||||
Do(context.Context, FrameHandler) error
|
||||
Do(context.Context, cdp.FrameHandler) error
|
||||
}
|
||||
|
||||
// ActionFunc is a single action func.
|
||||
type ActionFunc func(context.Context, FrameHandler) error
|
||||
type ActionFunc func(context.Context, cdp.FrameHandler) error
|
||||
|
||||
// Do executes the action using the provided context.
|
||||
func (f ActionFunc) Do(ctxt context.Context, h FrameHandler) error {
|
||||
func (f ActionFunc) Do(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
return f(ctxt, h)
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ func (f ActionFunc) Do(ctxt context.Context, h FrameHandler) error {
|
|||
type Tasks []Action
|
||||
|
||||
// Do executes the list of Tasks using the provided context.
|
||||
func (t Tasks) Do(ctxt context.Context, h FrameHandler) error {
|
||||
func (t Tasks) Do(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
var err error
|
||||
|
||||
// TODO: put individual task timeouts from context here
|
||||
|
@ -42,7 +42,7 @@ func (t Tasks) Do(ctxt context.Context, h FrameHandler) error {
|
|||
|
||||
// Sleep is an empty action that calls time.Sleep with the specified duration.
|
||||
func Sleep(d time.Duration) Action {
|
||||
return ActionFunc(func(context.Context, FrameHandler) error {
|
||||
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
|
||||
time.Sleep(d)
|
||||
return nil
|
||||
})
|
||||
|
|
|
@ -9,34 +9,14 @@ package accessibility
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GetPartialAXTreeParams fetches the accessibility node and partial
|
||||
// accessibility tree for this DOM node, if it exists.
|
||||
type GetPartialAXTreeParams struct {
|
||||
NodeID NodeID `json:"nodeId"` // ID of node to get the partial accessibility tree for.
|
||||
NodeID cdp.NodeID `json:"nodeId"` // ID of node to get the partial accessibility tree for.
|
||||
FetchRelatives bool `json:"fetchRelatives,omitempty"` // Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
|
||||
}
|
||||
|
||||
|
@ -44,10 +24,10 @@ type GetPartialAXTreeParams struct {
|
|||
// tree for this DOM node, if it exists.
|
||||
//
|
||||
// parameters:
|
||||
// nodeId - ID of node to get the partial accessibility tree for.
|
||||
func GetPartialAXTree(nodeId NodeID) *GetPartialAXTreeParams {
|
||||
// nodeID - ID of node to get the partial accessibility tree for.
|
||||
func GetPartialAXTree(nodeID cdp.NodeID) *GetPartialAXTreeParams {
|
||||
return &GetPartialAXTreeParams{
|
||||
NodeID: nodeId,
|
||||
NodeID: nodeID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +47,7 @@ type GetPartialAXTreeReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
|
||||
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h FrameHandler) (nodes []*AXNode, err error) {
|
||||
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodes []*AXNode, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -79,13 +59,13 @@ func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h FrameHandler) (nodes
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAccessibilityGetPartialAXTree, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAccessibilityGetPartialAXTree, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -94,7 +74,7 @@ func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h FrameHandler) (nodes
|
|||
var r GetPartialAXTreeReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Nodes, nil
|
||||
|
@ -104,8 +84,8 @@ func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h FrameHandler) (nodes
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -5,32 +5,12 @@ package accessibility
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// AXNodeID unique accessibility node identifier.
|
||||
type AXNodeID string
|
||||
|
||||
|
@ -254,12 +234,14 @@ type AXValueSource struct {
|
|||
InvalidReason string `json:"invalidReason,omitempty"` // Reason for the value being invalid, if it is.
|
||||
}
|
||||
|
||||
// AXRelatedNode [no description].
|
||||
type AXRelatedNode struct {
|
||||
BackendDOMNodeID BackendNodeID `json:"backendDOMNodeId,omitempty"` // The BackendNodeId of the related DOM node.
|
||||
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId,omitempty"` // The BackendNodeId of the related DOM node.
|
||||
Idref string `json:"idref,omitempty"` // The IDRef value provided, if any.
|
||||
Text string `json:"text,omitempty"` // The text alternative of this node in the current context.
|
||||
}
|
||||
|
||||
// AXProperty [no description].
|
||||
type AXProperty struct {
|
||||
Name string `json:"name,omitempty"` // The name of this property.
|
||||
Value *AXValue `json:"value,omitempty"` // The value of this property.
|
||||
|
@ -555,5 +537,5 @@ type AXNode struct {
|
|||
Value *AXValue `json:"value,omitempty"` // The value for this Node.
|
||||
Properties []*AXProperty `json:"properties,omitempty"` // All other properties
|
||||
ChildIds []AXNodeID `json:"childIds,omitempty"` // IDs for each of this node's child nodes.
|
||||
BackendDOMNodeID BackendNodeID `json:"backendDOMNodeId,omitempty"` // The backend ID for the associated DOM node, if any.
|
||||
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId,omitempty"` // The backend ID for the associated DOM node, if any.
|
||||
}
|
||||
|
|
|
@ -9,31 +9,11 @@ package animation
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables animation domain notifications.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -43,19 +23,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Animation.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -67,10 +47,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables animation domain notifications.
|
||||
|
@ -82,19 +62,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Animation.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -106,10 +86,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetPlaybackRateParams gets the playback rate of the document timeline.
|
||||
|
@ -129,19 +109,19 @@ type GetPlaybackRateReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// playbackRate - Playback rate for animations on page.
|
||||
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (playbackRate float64, err error) {
|
||||
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (playbackRate float64, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationGetPlaybackRate, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return 0, ErrChannelClosed
|
||||
return 0, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -150,7 +130,7 @@ func (p *GetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (playba
|
|||
var r GetPlaybackRateReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return 0, ErrInvalidResult
|
||||
return 0, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.PlaybackRate, nil
|
||||
|
@ -160,10 +140,10 @@ func (p *GetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (playba
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return 0, ErrContextDone
|
||||
return 0, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return 0, ErrUnknownResult
|
||||
return 0, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetPlaybackRateParams sets the playback rate of the document timeline.
|
||||
|
@ -182,7 +162,7 @@ func SetPlaybackRate(playbackRate float64) *SetPlaybackRateParams {
|
|||
}
|
||||
|
||||
// Do executes Animation.setPlaybackRate.
|
||||
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -194,13 +174,13 @@ func (p *SetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (err er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationSetPlaybackRate, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetPlaybackRate, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -212,10 +192,10 @@ func (p *SetPlaybackRateParams) Do(ctxt context.Context, h FrameHandler) (err er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetCurrentTimeParams returns the current time of the an animation.
|
||||
|
@ -242,7 +222,7 @@ type GetCurrentTimeReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// currentTime - Current time of the page.
|
||||
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h FrameHandler) (currentTime float64, err error) {
|
||||
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.FrameHandler) (currentTime float64, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -254,13 +234,13 @@ func (p *GetCurrentTimeParams) Do(ctxt context.Context, h FrameHandler) (current
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationGetCurrentTime, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationGetCurrentTime, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return 0, ErrChannelClosed
|
||||
return 0, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -269,7 +249,7 @@ func (p *GetCurrentTimeParams) Do(ctxt context.Context, h FrameHandler) (current
|
|||
var r GetCurrentTimeReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return 0, ErrInvalidResult
|
||||
return 0, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.CurrentTime, nil
|
||||
|
@ -279,10 +259,10 @@ func (p *GetCurrentTimeParams) Do(ctxt context.Context, h FrameHandler) (current
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return 0, ErrContextDone
|
||||
return 0, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return 0, ErrUnknownResult
|
||||
return 0, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetPausedParams sets the paused state of a set of animations.
|
||||
|
@ -304,7 +284,7 @@ func SetPaused(animations []string, paused bool) *SetPausedParams {
|
|||
}
|
||||
|
||||
// Do executes Animation.setPaused.
|
||||
func (p *SetPausedParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -316,13 +296,13 @@ func (p *SetPausedParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationSetPaused, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetPaused, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -334,10 +314,10 @@ func (p *SetPausedParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetTimingParams sets the timing of an animation node.
|
||||
|
@ -350,19 +330,19 @@ type SetTimingParams struct {
|
|||
// SetTiming sets the timing of an animation node.
|
||||
//
|
||||
// parameters:
|
||||
// animationId - Animation id.
|
||||
// animationID - Animation id.
|
||||
// duration - Duration of the animation.
|
||||
// delay - Delay of the animation.
|
||||
func SetTiming(animationId string, duration float64, delay float64) *SetTimingParams {
|
||||
func SetTiming(animationID string, duration float64, delay float64) *SetTimingParams {
|
||||
return &SetTimingParams{
|
||||
AnimationID: animationId,
|
||||
AnimationID: animationID,
|
||||
Duration: duration,
|
||||
Delay: delay,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Animation.setTiming.
|
||||
func (p *SetTimingParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -374,13 +354,13 @@ func (p *SetTimingParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationSetTiming, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetTiming, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -392,10 +372,10 @@ func (p *SetTimingParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SeekAnimationsParams seek a set of animations to a particular time within
|
||||
|
@ -419,7 +399,7 @@ func SeekAnimations(animations []string, currentTime float64) *SeekAnimationsPar
|
|||
}
|
||||
|
||||
// Do executes Animation.seekAnimations.
|
||||
func (p *SeekAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -431,13 +411,13 @@ func (p *SeekAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationSeekAnimations, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationSeekAnimations, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -449,10 +429,10 @@ func (p *SeekAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReleaseAnimationsParams releases a set of animations to no longer be
|
||||
|
@ -473,7 +453,7 @@ func ReleaseAnimations(animations []string) *ReleaseAnimationsParams {
|
|||
}
|
||||
|
||||
// Do executes Animation.releaseAnimations.
|
||||
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -485,13 +465,13 @@ func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationReleaseAnimations, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationReleaseAnimations, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -503,10 +483,10 @@ func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ResolveAnimationParams gets the remote object of the Animation.
|
||||
|
@ -517,10 +497,10 @@ type ResolveAnimationParams struct {
|
|||
// ResolveAnimation gets the remote object of the Animation.
|
||||
//
|
||||
// parameters:
|
||||
// animationId - Animation id.
|
||||
func ResolveAnimation(animationId string) *ResolveAnimationParams {
|
||||
// animationID - Animation id.
|
||||
func ResolveAnimation(animationID string) *ResolveAnimationParams {
|
||||
return &ResolveAnimationParams{
|
||||
AnimationID: animationId,
|
||||
AnimationID: animationID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -533,7 +513,7 @@ type ResolveAnimationReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// remoteObject - Corresponding remote object.
|
||||
func (p *ResolveAnimationParams) Do(ctxt context.Context, h FrameHandler) (remoteObject *runtime.RemoteObject, err error) {
|
||||
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.FrameHandler) (remoteObject *runtime.RemoteObject, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -545,13 +525,13 @@ func (p *ResolveAnimationParams) Do(ctxt context.Context, h FrameHandler) (remot
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandAnimationResolveAnimation, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationResolveAnimation, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -560,7 +540,7 @@ func (p *ResolveAnimationParams) Do(ctxt context.Context, h FrameHandler) (remot
|
|||
var r ResolveAnimationReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.RemoteObject, nil
|
||||
|
@ -570,8 +550,8 @@ func (p *ResolveAnimationParams) Do(ctxt context.Context, h FrameHandler) (remot
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1357,66 +1357,7 @@ func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
|||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation16(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(in *jlexer.Lexer, out *DisableParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(out *jwriter.Writer, in DisableParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DisableParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation18(in *jlexer.Lexer, out *AnimationEffect) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(in *jlexer.Lexer, out *Effect) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1473,7 +1414,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation18(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation18(out *jwriter.Writer, in AnimationEffect) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(out *jwriter.Writer, in Effect) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1565,26 +1506,85 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation18(out *jwriter.Write
|
|||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v AnimationEffect) MarshalJSON() ([]byte, error) {
|
||||
func (v Effect) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Effect) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Effect) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *Effect) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation17(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation18(in *jlexer.Lexer, out *DisableParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation18(out *jwriter.Writer, in DisableParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DisableParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation18(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v AnimationEffect) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation18(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *AnimationEffect) UnmarshalJSON(data []byte) error {
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation18(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *AnimationEffect) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation18(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation19(in *jlexer.Lexer, out *Animation) {
|
||||
|
@ -1626,7 +1626,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAnimation19(in *jlexer.Lexer,
|
|||
out.Source = nil
|
||||
} else {
|
||||
if out.Source == nil {
|
||||
out.Source = new(AnimationEffect)
|
||||
out.Source = new(Effect)
|
||||
}
|
||||
(*out.Source).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
|
|
@ -3,27 +3,7 @@ package animation
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventAnimationCreated event for each animation that has been created.
|
||||
|
@ -41,9 +21,9 @@ type EventAnimationCanceled struct {
|
|||
ID string `json:"id,omitempty"` // Id of the animation that was cancelled.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventAnimationAnimationCreated,
|
||||
EventAnimationAnimationStarted,
|
||||
EventAnimationAnimationCanceled,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventAnimationAnimationCreated,
|
||||
cdp.EventAnimationAnimationStarted,
|
||||
cdp.EventAnimationAnimationCanceled,
|
||||
}
|
||||
|
|
|
@ -5,32 +5,12 @@ package animation
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// Animation animation instance.
|
||||
type Animation struct {
|
||||
ID string `json:"id,omitempty"` // Animation's id.
|
||||
|
@ -40,13 +20,13 @@ type Animation struct {
|
|||
PlaybackRate float64 `json:"playbackRate,omitempty"` // Animation's playback rate.
|
||||
StartTime float64 `json:"startTime,omitempty"` // Animation's start time.
|
||||
CurrentTime float64 `json:"currentTime,omitempty"` // Animation's current time.
|
||||
Source *AnimationEffect `json:"source,omitempty"` // Animation's source animation node.
|
||||
Type AnimationType `json:"type,omitempty"` // Animation type of Animation.
|
||||
Source *Effect `json:"source,omitempty"` // Animation's source animation node.
|
||||
Type Type `json:"type,omitempty"` // Animation type of Animation.
|
||||
CSSID string `json:"cssId,omitempty"` // A unique ID for Animation representing the sources that triggered this CSS animation/transition.
|
||||
}
|
||||
|
||||
// AnimationEffect animationEffect instance.
|
||||
type AnimationEffect struct {
|
||||
// Effect animationEffect instance.
|
||||
type Effect struct {
|
||||
Delay float64 `json:"delay,omitempty"` // AnimationEffect's delay.
|
||||
EndDelay float64 `json:"endDelay,omitempty"` // AnimationEffect's end delay.
|
||||
IterationStart float64 `json:"iterationStart,omitempty"` // AnimationEffect's iteration start.
|
||||
|
@ -54,7 +34,7 @@ type AnimationEffect struct {
|
|||
Duration float64 `json:"duration,omitempty"` // AnimationEffect's iteration duration.
|
||||
Direction string `json:"direction,omitempty"` // AnimationEffect's playback direction.
|
||||
Fill string `json:"fill,omitempty"` // AnimationEffect's fill mode.
|
||||
BackendNodeID BackendNodeID `json:"backendNodeId,omitempty"` // AnimationEffect's target node.
|
||||
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // AnimationEffect's target node.
|
||||
KeyframesRule *KeyframesRule `json:"keyframesRule,omitempty"` // AnimationEffect's keyframes.
|
||||
Easing string `json:"easing,omitempty"` // AnimationEffect's timing function.
|
||||
}
|
||||
|
@ -71,47 +51,47 @@ type KeyframeStyle struct {
|
|||
Easing string `json:"easing,omitempty"` // AnimationEffect's timing function.
|
||||
}
|
||||
|
||||
// AnimationType animation type of Animation.
|
||||
type AnimationType string
|
||||
// Type animation type of Animation.
|
||||
type Type string
|
||||
|
||||
// String returns the AnimationType as string value.
|
||||
func (t AnimationType) String() string {
|
||||
// String returns the Type as string value.
|
||||
func (t Type) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// AnimationType values.
|
||||
// Type values.
|
||||
const (
|
||||
AnimationTypeCSSTransition AnimationType = "CSSTransition"
|
||||
AnimationTypeCSSAnimation AnimationType = "CSSAnimation"
|
||||
AnimationTypeWebAnimation AnimationType = "WebAnimation"
|
||||
TypeCSSTransition Type = "CSSTransition"
|
||||
TypeCSSAnimation Type = "CSSAnimation"
|
||||
TypeWebAnimation Type = "WebAnimation"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t AnimationType) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t AnimationType) MarshalJSON() ([]byte, error) {
|
||||
func (t Type) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *AnimationType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch AnimationType(in.String()) {
|
||||
case AnimationTypeCSSTransition:
|
||||
*t = AnimationTypeCSSTransition
|
||||
case AnimationTypeCSSAnimation:
|
||||
*t = AnimationTypeCSSAnimation
|
||||
case AnimationTypeWebAnimation:
|
||||
*t = AnimationTypeWebAnimation
|
||||
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch Type(in.String()) {
|
||||
case TypeCSSTransition:
|
||||
*t = TypeCSSTransition
|
||||
case TypeCSSAnimation:
|
||||
*t = TypeCSSAnimation
|
||||
case TypeWebAnimation:
|
||||
*t = TypeWebAnimation
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown AnimationType value"))
|
||||
in.AddError(errors.New("unknown Type value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *AnimationType) UnmarshalJSON(buf []byte) error {
|
||||
func (t *Type) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
|
|
@ -9,30 +9,10 @@ package applicationcache
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GetFramesWithManifestsParams returns array of frame identifiers with
|
||||
// manifest urls for each frame containing a document associated with some
|
||||
// application cache.
|
||||
|
@ -54,19 +34,19 @@ type GetFramesWithManifestsReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
|
||||
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h FrameHandler) (frameIds []*FrameWithManifest, err error) {
|
||||
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.FrameHandler) (frameIds []*FrameWithManifest, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandApplicationCacheGetFramesWithManifests, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -75,7 +55,7 @@ func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h FrameHandler)
|
|||
var r GetFramesWithManifestsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.FrameIds, nil
|
||||
|
@ -85,10 +65,10 @@ func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// EnableParams enables application cache domain notifications.
|
||||
|
@ -100,19 +80,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes ApplicationCache.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandApplicationCacheEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -124,25 +104,25 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetManifestForFrameParams returns manifest URL for document in the given
|
||||
// frame.
|
||||
type GetManifestForFrameParams struct {
|
||||
FrameID FrameID `json:"frameId"` // Identifier of the frame containing document whose manifest is retrieved.
|
||||
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose manifest is retrieved.
|
||||
}
|
||||
|
||||
// GetManifestForFrame returns manifest URL for document in the given frame.
|
||||
//
|
||||
// parameters:
|
||||
// frameId - Identifier of the frame containing document whose manifest is retrieved.
|
||||
func GetManifestForFrame(frameId FrameID) *GetManifestForFrameParams {
|
||||
// frameID - Identifier of the frame containing document whose manifest is retrieved.
|
||||
func GetManifestForFrame(frameID cdp.FrameID) *GetManifestForFrameParams {
|
||||
return &GetManifestForFrameParams{
|
||||
FrameID: frameId,
|
||||
FrameID: frameID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +135,7 @@ type GetManifestForFrameReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// manifestURL - Manifest URL for document in the given frame.
|
||||
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h FrameHandler) (manifestURL string, err error) {
|
||||
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (manifestURL string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -167,13 +147,13 @@ func (p *GetManifestForFrameParams) Do(ctxt context.Context, h FrameHandler) (ma
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandApplicationCacheGetManifestForFrame, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetManifestForFrame, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -182,7 +162,7 @@ func (p *GetManifestForFrameParams) Do(ctxt context.Context, h FrameHandler) (ma
|
|||
var r GetManifestForFrameReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.ManifestURL, nil
|
||||
|
@ -192,26 +172,26 @@ func (p *GetManifestForFrameParams) Do(ctxt context.Context, h FrameHandler) (ma
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetApplicationCacheForFrameParams returns relevant application cache data
|
||||
// for the document in given frame.
|
||||
type GetApplicationCacheForFrameParams struct {
|
||||
FrameID FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache is retrieved.
|
||||
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache is retrieved.
|
||||
}
|
||||
|
||||
// GetApplicationCacheForFrame returns relevant application cache data for
|
||||
// the document in given frame.
|
||||
//
|
||||
// parameters:
|
||||
// frameId - Identifier of the frame containing document whose application cache is retrieved.
|
||||
func GetApplicationCacheForFrame(frameId FrameID) *GetApplicationCacheForFrameParams {
|
||||
// frameID - Identifier of the frame containing document whose application cache is retrieved.
|
||||
func GetApplicationCacheForFrame(frameID cdp.FrameID) *GetApplicationCacheForFrameParams {
|
||||
return &GetApplicationCacheForFrameParams{
|
||||
FrameID: frameId,
|
||||
FrameID: frameID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +204,7 @@ type GetApplicationCacheForFrameReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// applicationCache - Relevant application cache data for the document in given frame.
|
||||
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h FrameHandler) (applicationCache *ApplicationCache, err error) {
|
||||
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (applicationCache *ApplicationCache, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -236,13 +216,13 @@ func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h FrameHand
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandApplicationCacheGetApplicationCacheForFrame, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetApplicationCacheForFrame, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -251,7 +231,7 @@ func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h FrameHand
|
|||
var r GetApplicationCacheForFrameReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.ApplicationCache, nil
|
||||
|
@ -261,8 +241,8 @@ func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h FrameHand
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -17,7 +17,96 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(in *jlexer.Lexer, out *GetManifestForFrameReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(in *jlexer.Lexer, out *Resource) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "url":
|
||||
out.URL = string(in.String())
|
||||
case "size":
|
||||
out.Size = int64(in.Int64())
|
||||
case "type":
|
||||
out.Type = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(out *jwriter.Writer, in Resource) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.URL != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"url\":")
|
||||
out.String(string(in.URL))
|
||||
}
|
||||
if in.Size != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"size\":")
|
||||
out.Int64(int64(in.Size))
|
||||
}
|
||||
if in.Type != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"type\":")
|
||||
out.String(string(in.Type))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v Resource) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Resource) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Resource) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *Resource) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(in *jlexer.Lexer, out *GetManifestForFrameReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -48,7 +137,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(in *jlexer.Le
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(out *jwriter.Writer, in GetManifestForFrameReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(out *jwriter.Writer, in GetManifestForFrameReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -66,27 +155,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(out *jwriter.
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetManifestForFrameReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetManifestForFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetManifestForFrameReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetManifestForFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(in *jlexer.Lexer, out *GetManifestForFrameParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(in *jlexer.Lexer, out *GetManifestForFrameParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -117,7 +206,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(out *jwriter.Writer, in GetManifestForFrameParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(out *jwriter.Writer, in GetManifestForFrameParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -133,27 +222,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetManifestForFrameParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetManifestForFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetManifestForFrameParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetManifestForFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache1(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(in *jlexer.Lexer, out *GetFramesWithManifestsReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(in *jlexer.Lexer, out *GetFramesWithManifestsReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -209,7 +298,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(out *jwriter.Writer, in GetFramesWithManifestsReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(out *jwriter.Writer, in GetFramesWithManifestsReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -242,27 +331,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetFramesWithManifestsReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetFramesWithManifestsReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetFramesWithManifestsReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetFramesWithManifestsReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache2(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(in *jlexer.Lexer, out *GetFramesWithManifestsParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(in *jlexer.Lexer, out *GetFramesWithManifestsParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -291,7 +380,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(out *jwriter.Writer, in GetFramesWithManifestsParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(out *jwriter.Writer, in GetFramesWithManifestsParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -301,27 +390,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetFramesWithManifestsParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetFramesWithManifestsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache3(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetFramesWithManifestsParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetFramesWithManifestsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache3(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(in *jlexer.Lexer, out *GetApplicationCacheForFrameReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(in *jlexer.Lexer, out *GetApplicationCacheForFrameReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -360,7 +449,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(out *jwriter.Writer, in GetApplicationCacheForFrameReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(out *jwriter.Writer, in GetApplicationCacheForFrameReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -382,27 +471,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetApplicationCacheForFrameReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetApplicationCacheForFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache4(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetApplicationCacheForFrameReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetApplicationCacheForFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache4(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(in *jlexer.Lexer, out *GetApplicationCacheForFrameParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(in *jlexer.Lexer, out *GetApplicationCacheForFrameParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -433,7 +522,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(out *jwriter.Writer, in GetApplicationCacheForFrameParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(out *jwriter.Writer, in GetApplicationCacheForFrameParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -449,27 +538,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetApplicationCacheForFrameParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetApplicationCacheForFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache5(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetApplicationCacheForFrameParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetApplicationCacheForFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache5(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(in *jlexer.Lexer, out *FrameWithManifest) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(in *jlexer.Lexer, out *FrameWithManifest) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -504,7 +593,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(out *jwriter.Writer, in FrameWithManifest) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(out *jwriter.Writer, in FrameWithManifest) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -538,27 +627,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v FrameWithManifest) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v FrameWithManifest) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache6(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *FrameWithManifest) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *FrameWithManifest) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache6(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(in *jlexer.Lexer, out *EventNetworkStateUpdated) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(in *jlexer.Lexer, out *EventNetworkStateUpdated) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -589,7 +678,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(out *jwriter.Writer, in EventNetworkStateUpdated) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(out *jwriter.Writer, in EventNetworkStateUpdated) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -607,27 +696,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventNetworkStateUpdated) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventNetworkStateUpdated) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventNetworkStateUpdated) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventNetworkStateUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache7(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(in *jlexer.Lexer, out *EventApplicationCacheStatusUpdated) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(in *jlexer.Lexer, out *EventApplicationCacheStatusUpdated) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -662,7 +751,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(out *jwriter.Writer, in EventApplicationCacheStatusUpdated) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(out *jwriter.Writer, in EventApplicationCacheStatusUpdated) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -696,27 +785,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(out *jwriter
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventApplicationCacheStatusUpdated) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventApplicationCacheStatusUpdated) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventApplicationCacheStatusUpdated) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventApplicationCacheStatusUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache8(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(in *jlexer.Lexer, out *EnableParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache10(in *jlexer.Lexer, out *EnableParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -745,7 +834,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(out *jwriter.Writer, in EnableParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache10(out *jwriter.Writer, in EnableParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -754,114 +843,25 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(out *jwriter
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache9(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache10(in *jlexer.Lexer, out *ApplicationCacheResource) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "url":
|
||||
out.URL = string(in.String())
|
||||
case "size":
|
||||
out.Size = int64(in.Int64())
|
||||
case "type":
|
||||
out.Type = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache10(out *jwriter.Writer, in ApplicationCacheResource) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.URL != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"url\":")
|
||||
out.String(string(in.URL))
|
||||
}
|
||||
if in.Size != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"size\":")
|
||||
out.Int64(int64(in.Size))
|
||||
}
|
||||
if in.Type != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"type\":")
|
||||
out.String(string(in.Type))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ApplicationCacheResource) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache10(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ApplicationCacheResource) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache10(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ApplicationCacheResource) UnmarshalJSON(data []byte) error {
|
||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache10(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ApplicationCacheResource) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache10(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache11(in *jlexer.Lexer, out *ApplicationCache) {
|
||||
|
@ -898,18 +898,18 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpApplicationcache11(in *jlexer.
|
|||
} else {
|
||||
in.Delim('[')
|
||||
if !in.IsDelim(']') {
|
||||
out.Resources = make([]*ApplicationCacheResource, 0, 8)
|
||||
out.Resources = make([]*Resource, 0, 8)
|
||||
} else {
|
||||
out.Resources = []*ApplicationCacheResource{}
|
||||
out.Resources = []*Resource{}
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v4 *ApplicationCacheResource
|
||||
var v4 *Resource
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
v4 = nil
|
||||
} else {
|
||||
if v4 == nil {
|
||||
v4 = new(ApplicationCacheResource)
|
||||
v4 = new(Resource)
|
||||
}
|
||||
(*v4).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
|
|
@ -3,41 +3,23 @@ package applicationcache
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventApplicationCacheStatusUpdated [no description].
|
||||
type EventApplicationCacheStatusUpdated struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Identifier of the frame containing document whose application cache updated status.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Identifier of the frame containing document whose application cache updated status.
|
||||
ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL.
|
||||
Status int64 `json:"status,omitempty"` // Updated application cache status.
|
||||
}
|
||||
|
||||
// EventNetworkStateUpdated [no description].
|
||||
type EventNetworkStateUpdated struct {
|
||||
IsNowOnline bool `json:"isNowOnline,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventApplicationCacheApplicationCacheStatusUpdated,
|
||||
EventApplicationCacheNetworkStateUpdated,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventApplicationCacheApplicationCacheStatusUpdated,
|
||||
cdp.EventApplicationCacheNetworkStateUpdated,
|
||||
}
|
||||
|
|
|
@ -3,31 +3,11 @@ package applicationcache
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// ApplicationCacheResource detailed application cache resource information.
|
||||
type ApplicationCacheResource struct {
|
||||
// Resource detailed application cache resource information.
|
||||
type Resource struct {
|
||||
URL string `json:"url,omitempty"` // Resource url.
|
||||
Size int64 `json:"size,omitempty"` // Resource size.
|
||||
Type string `json:"type,omitempty"` // Resource type.
|
||||
|
@ -39,12 +19,12 @@ type ApplicationCache struct {
|
|||
Size float64 `json:"size,omitempty"` // Application cache size.
|
||||
CreationTime float64 `json:"creationTime,omitempty"` // Application cache creation time.
|
||||
UpdateTime float64 `json:"updateTime,omitempty"` // Application cache update time.
|
||||
Resources []*ApplicationCacheResource `json:"resources,omitempty"` // Application cache resources.
|
||||
Resources []*Resource `json:"resources,omitempty"` // Application cache resources.
|
||||
}
|
||||
|
||||
// FrameWithManifest frame identifier - manifest URL pair.
|
||||
type FrameWithManifest struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL.
|
||||
Status int64 `json:"status,omitempty"` // Application cache status.
|
||||
}
|
||||
|
|
|
@ -9,30 +9,10 @@ package cachestorage
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// RequestCacheNamesParams requests cache names.
|
||||
type RequestCacheNamesParams struct {
|
||||
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
||||
|
@ -57,7 +37,7 @@ type RequestCacheNamesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// caches - Caches for the security origin.
|
||||
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h FrameHandler) (caches []*Cache, err error) {
|
||||
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (caches []*Cache, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -69,13 +49,13 @@ func (p *RequestCacheNamesParams) Do(ctxt context.Context, h FrameHandler) (cach
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandCacheStorageRequestCacheNames, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -84,7 +64,7 @@ func (p *RequestCacheNamesParams) Do(ctxt context.Context, h FrameHandler) (cach
|
|||
var r RequestCacheNamesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Caches, nil
|
||||
|
@ -94,10 +74,10 @@ func (p *RequestCacheNamesParams) Do(ctxt context.Context, h FrameHandler) (cach
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RequestEntriesParams requests data from cache.
|
||||
|
@ -110,12 +90,12 @@ type RequestEntriesParams struct {
|
|||
// RequestEntries requests data from cache.
|
||||
//
|
||||
// parameters:
|
||||
// cacheId - ID of cache to get entries from.
|
||||
// cacheID - ID of cache to get entries from.
|
||||
// skipCount - Number of records to skip.
|
||||
// pageSize - Number of records to fetch.
|
||||
func RequestEntries(cacheId CacheID, skipCount int64, pageSize int64) *RequestEntriesParams {
|
||||
func RequestEntries(cacheID CacheID, skipCount int64, pageSize int64) *RequestEntriesParams {
|
||||
return &RequestEntriesParams{
|
||||
CacheID: cacheId,
|
||||
CacheID: cacheID,
|
||||
SkipCount: skipCount,
|
||||
PageSize: pageSize,
|
||||
}
|
||||
|
@ -132,7 +112,7 @@ type RequestEntriesReturns struct {
|
|||
// returns:
|
||||
// cacheDataEntries - Array of object store data entries.
|
||||
// hasMore - If true, there are more entries to fetch in the given range.
|
||||
func (p *RequestEntriesParams) Do(ctxt context.Context, h FrameHandler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -144,13 +124,13 @@ func (p *RequestEntriesParams) Do(ctxt context.Context, h FrameHandler) (cacheDa
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandCacheStorageRequestEntries, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, false, ErrChannelClosed
|
||||
return nil, false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -159,7 +139,7 @@ func (p *RequestEntriesParams) Do(ctxt context.Context, h FrameHandler) (cacheDa
|
|||
var r RequestEntriesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, false, ErrInvalidResult
|
||||
return nil, false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.CacheDataEntries, r.HasMore, nil
|
||||
|
@ -169,10 +149,10 @@ func (p *RequestEntriesParams) Do(ctxt context.Context, h FrameHandler) (cacheDa
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, false, ErrContextDone
|
||||
return nil, false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, false, ErrUnknownResult
|
||||
return nil, false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DeleteCacheParams deletes a cache.
|
||||
|
@ -183,15 +163,15 @@ type DeleteCacheParams struct {
|
|||
// DeleteCache deletes a cache.
|
||||
//
|
||||
// parameters:
|
||||
// cacheId - Id of cache for deletion.
|
||||
func DeleteCache(cacheId CacheID) *DeleteCacheParams {
|
||||
// cacheID - Id of cache for deletion.
|
||||
func DeleteCache(cacheID CacheID) *DeleteCacheParams {
|
||||
return &DeleteCacheParams{
|
||||
CacheID: cacheId,
|
||||
CacheID: cacheID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes CacheStorage.deleteCache.
|
||||
func (p *DeleteCacheParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -203,13 +183,13 @@ func (p *DeleteCacheParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandCacheStorageDeleteCache, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -221,10 +201,10 @@ func (p *DeleteCacheParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DeleteEntryParams deletes a cache entry.
|
||||
|
@ -236,17 +216,17 @@ type DeleteEntryParams struct {
|
|||
// DeleteEntry deletes a cache entry.
|
||||
//
|
||||
// parameters:
|
||||
// cacheId - Id of cache where the entry will be deleted.
|
||||
// cacheID - Id of cache where the entry will be deleted.
|
||||
// request - URL spec of the request.
|
||||
func DeleteEntry(cacheId CacheID, request string) *DeleteEntryParams {
|
||||
func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
|
||||
return &DeleteEntryParams{
|
||||
CacheID: cacheId,
|
||||
CacheID: cacheID,
|
||||
Request: request,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes CacheStorage.deleteEntry.
|
||||
func (p *DeleteEntryParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -258,13 +238,13 @@ func (p *DeleteEntryParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandCacheStorageDeleteEntry, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -276,8 +256,8 @@ func (p *DeleteEntryParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -2,30 +2,6 @@ package cachestorage
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// CacheID unique identifier of the Cache object.
|
||||
type CacheID string
|
||||
|
||||
|
|
|
@ -1343,7 +1343,7 @@ type FrameHandler interface {
|
|||
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
|
||||
}
|
||||
|
||||
// Empty is an empty JSON object message
|
||||
// Empty is an empty JSON object message.
|
||||
var Empty = easyjson.RawMessage(`{}`)
|
||||
|
||||
// FrameID unique frame identifier.
|
||||
|
@ -1879,8 +1879,3 @@ func (t *NodeType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
func (t *NodeType) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
type ComputedProperty struct {
|
||||
Name string `json:"name,omitempty"` // Computed style property name.
|
||||
Value string `json:"value,omitempty"` // Computed style property value.
|
||||
}
|
||||
|
|
393
cdp/css/css.go
393
cdp/css/css.go
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,6 @@ package css
|
|||
|
||||
import (
|
||||
json "encoding/json"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
dom "github.com/knq/chromedp/cdp/dom"
|
||||
easyjson "github.com/mailru/easyjson"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
|
@ -5206,18 +5205,18 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss47(in *jlexer.Lexer, out *G
|
|||
} else {
|
||||
in.Delim('[')
|
||||
if !in.IsDelim(']') {
|
||||
out.ComputedStyle = make([]*cdp.ComputedProperty, 0, 8)
|
||||
out.ComputedStyle = make([]*ComputedProperty, 0, 8)
|
||||
} else {
|
||||
out.ComputedStyle = []*cdp.ComputedProperty{}
|
||||
out.ComputedStyle = []*ComputedProperty{}
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v70 *cdp.ComputedProperty
|
||||
var v70 *ComputedProperty
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
v70 = nil
|
||||
} else {
|
||||
if v70 == nil {
|
||||
v70 = new(cdp.ComputedProperty)
|
||||
v70 = new(ComputedProperty)
|
||||
}
|
||||
(*v70).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -6240,18 +6239,18 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss61(in *jlexer.Lexer, out *C
|
|||
} else {
|
||||
in.Delim('[')
|
||||
if !in.IsDelim(']') {
|
||||
out.Properties = make([]*cdp.ComputedProperty, 0, 8)
|
||||
out.Properties = make([]*ComputedProperty, 0, 8)
|
||||
} else {
|
||||
out.Properties = []*cdp.ComputedProperty{}
|
||||
out.Properties = []*ComputedProperty{}
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v79 *cdp.ComputedProperty
|
||||
var v79 *ComputedProperty
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
v79 = nil
|
||||
} else {
|
||||
if v79 == nil {
|
||||
v79 = new(cdp.ComputedProperty)
|
||||
v79 = new(ComputedProperty)
|
||||
}
|
||||
(*v79).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -6323,7 +6322,86 @@ func (v *ComputedStyle) UnmarshalJSON(data []byte) error {
|
|||
func (v *ComputedStyle) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss61(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(in *jlexer.Lexer, out *CollectClassNamesReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(in *jlexer.Lexer, out *ComputedProperty) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "name":
|
||||
out.Name = string(in.String())
|
||||
case "value":
|
||||
out.Value = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(out *jwriter.Writer, in ComputedProperty) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Name != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"name\":")
|
||||
out.String(string(in.Name))
|
||||
}
|
||||
if in.Value != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"value\":")
|
||||
out.String(string(in.Value))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ComputedProperty) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ComputedProperty) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ComputedProperty) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ComputedProperty) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(in *jlexer.Lexer, out *CollectClassNamesReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -6371,7 +6449,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(in *jlexer.Lexer, out *C
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(out *jwriter.Writer, in CollectClassNamesReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(out *jwriter.Writer, in CollectClassNamesReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -6400,27 +6478,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(out *jwriter.Writer, in
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v CollectClassNamesReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v CollectClassNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss62(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *CollectClassNamesReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *CollectClassNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss62(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(in *jlexer.Lexer, out *CollectClassNamesParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(in *jlexer.Lexer, out *CollectClassNamesParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -6451,7 +6529,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(in *jlexer.Lexer, out *C
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(out *jwriter.Writer, in CollectClassNamesParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(out *jwriter.Writer, in CollectClassNamesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -6467,27 +6545,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(out *jwriter.Writer, in
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v CollectClassNamesParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v CollectClassNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss63(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *CollectClassNamesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *CollectClassNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss63(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(in *jlexer.Lexer, out *AddRuleReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(in *jlexer.Lexer, out *AddRuleReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -6526,7 +6604,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(in *jlexer.Lexer, out *A
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(out *jwriter.Writer, in AddRuleReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(out *jwriter.Writer, in AddRuleReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -6548,27 +6626,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(out *jwriter.Writer, in
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v AddRuleReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v AddRuleReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss64(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *AddRuleReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *AddRuleReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss64(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(in *jlexer.Lexer, out *AddRuleParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss66(in *jlexer.Lexer, out *AddRuleParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -6611,7 +6689,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(in *jlexer.Lexer, out *A
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(out *jwriter.Writer, in AddRuleParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss66(out *jwriter.Writer, in AddRuleParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -6643,23 +6721,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(out *jwriter.Writer, in
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v AddRuleParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss66(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v AddRuleParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss65(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss66(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *AddRuleParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss66(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *AddRuleParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss65(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss66(l, v)
|
||||
}
|
||||
|
|
|
@ -3,27 +3,7 @@ package css
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventMediaQueryResultChanged fires whenever a MediaQuery result changes
|
||||
|
@ -52,11 +32,11 @@ type EventStyleSheetRemoved struct {
|
|||
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the removed stylesheet.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventCSSMediaQueryResultChanged,
|
||||
EventCSSFontsUpdated,
|
||||
EventCSSStyleSheetChanged,
|
||||
EventCSSStyleSheetAdded,
|
||||
EventCSSStyleSheetRemoved,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventCSSMediaQueryResultChanged,
|
||||
cdp.EventCSSFontsUpdated,
|
||||
cdp.EventCSSStyleSheetChanged,
|
||||
cdp.EventCSSStyleSheetAdded,
|
||||
cdp.EventCSSStyleSheetRemoved,
|
||||
}
|
||||
|
|
|
@ -5,33 +5,14 @@ package css
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/dom"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// StyleSheetID [no description].
|
||||
type StyleSheetID string
|
||||
|
||||
// String returns the StyleSheetID as string value.
|
||||
|
@ -92,7 +73,7 @@ func (t *StyleSheetOrigin) UnmarshalJSON(buf []byte) error {
|
|||
|
||||
// PseudoElementMatches cSS rule collection for a single pseudo style.
|
||||
type PseudoElementMatches struct {
|
||||
PseudoType PseudoType `json:"pseudoType,omitempty"` // Pseudo element type.
|
||||
PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Pseudo element type.
|
||||
Matches []*RuleMatch `json:"matches,omitempty"` // Matches of CSS rules applicable to the pseudo style.
|
||||
}
|
||||
|
||||
|
@ -124,12 +105,12 @@ type SelectorList struct {
|
|||
// StyleSheetHeader cSS stylesheet metainformation.
|
||||
type StyleSheetHeader struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The stylesheet identifier.
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Owner frame identifier.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Owner frame identifier.
|
||||
SourceURL string `json:"sourceURL,omitempty"` // Stylesheet resource URL.
|
||||
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with the stylesheet (if any).
|
||||
Origin StyleSheetOrigin `json:"origin,omitempty"` // Stylesheet origin.
|
||||
Title string `json:"title,omitempty"` // Stylesheet title.
|
||||
OwnerNode BackendNodeID `json:"ownerNode,omitempty"` // The backend id for the owner node of the stylesheet.
|
||||
OwnerNode cdp.BackendNodeID `json:"ownerNode,omitempty"` // The backend id for the owner node of the stylesheet.
|
||||
Disabled bool `json:"disabled,omitempty"` // Denotes whether the stylesheet is disabled.
|
||||
HasSourceURL bool `json:"hasSourceURL,omitempty"` // Whether the sourceURL field value comes from the sourceURL comment.
|
||||
IsInline bool `json:"isInline,omitempty"` // Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags.
|
||||
|
@ -161,12 +142,19 @@ type SourceRange struct {
|
|||
EndColumn int64 `json:"endColumn,omitempty"` // End column of range (exclusive).
|
||||
}
|
||||
|
||||
// ShorthandEntry [no description].
|
||||
type ShorthandEntry struct {
|
||||
Name string `json:"name,omitempty"` // Shorthand name.
|
||||
Value string `json:"value,omitempty"` // Shorthand value.
|
||||
Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent).
|
||||
}
|
||||
|
||||
// ComputedProperty [no description].
|
||||
type ComputedProperty struct {
|
||||
Name string `json:"name,omitempty"` // Computed style property name.
|
||||
Value string `json:"value,omitempty"` // Computed style property value.
|
||||
}
|
||||
|
||||
// Style cSS style representation.
|
||||
type Style struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
|
||||
|
@ -253,7 +241,7 @@ type InlineTextBox struct {
|
|||
|
||||
// LayoutTreeNode details of an element in the DOM tree with a LayoutObject.
|
||||
type LayoutTreeNode struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // The id of the related DOM node matching one from DOM.GetDocument.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // The id of the related DOM node matching one from DOM.GetDocument.
|
||||
BoundingBox *dom.Rect `json:"boundingBox,omitempty"` // The absolute position bounding box.
|
||||
LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText if any
|
||||
InlineTextNodes []*InlineTextBox `json:"inlineTextNodes,omitempty"` // The post layout inline text nodes, if any.
|
||||
|
@ -318,6 +306,7 @@ func (t *MediaSource) UnmarshalJSON(buf []byte) error {
|
|||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// PseudoClass [no description].
|
||||
type PseudoClass string
|
||||
|
||||
// String returns the PseudoClass as string value.
|
||||
|
|
|
@ -9,30 +9,10 @@ package database
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables database tracking, database events will now be
|
||||
// delivered to the client.
|
||||
type EnableParams struct{}
|
||||
|
@ -44,19 +24,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Database.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDatabaseEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandDatabaseEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -68,10 +48,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables database tracking, prevents database events from
|
||||
|
@ -85,19 +65,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Database.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDatabaseDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandDatabaseDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -109,21 +89,24 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetDatabaseTableNamesParams [no description].
|
||||
type GetDatabaseTableNamesParams struct {
|
||||
DatabaseID DatabaseID `json:"databaseId"`
|
||||
DatabaseID ID `json:"databaseId"`
|
||||
}
|
||||
|
||||
// GetDatabaseTableNames [no description].
|
||||
//
|
||||
// parameters:
|
||||
// databaseId
|
||||
func GetDatabaseTableNames(databaseId DatabaseID) *GetDatabaseTableNamesParams {
|
||||
// databaseID
|
||||
func GetDatabaseTableNames(databaseID ID) *GetDatabaseTableNamesParams {
|
||||
return &GetDatabaseTableNamesParams{
|
||||
DatabaseID: databaseId,
|
||||
DatabaseID: databaseID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +119,7 @@ type GetDatabaseTableNamesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// tableNames
|
||||
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h FrameHandler) (tableNames []string, err error) {
|
||||
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (tableNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -148,13 +131,13 @@ func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDatabaseGetDatabaseTableNames, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -163,7 +146,7 @@ func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
var r GetDatabaseTableNamesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.TableNames, nil
|
||||
|
@ -173,23 +156,26 @@ func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ExecuteSQLParams [no description].
|
||||
type ExecuteSQLParams struct {
|
||||
DatabaseID DatabaseID `json:"databaseId"`
|
||||
DatabaseID ID `json:"databaseId"`
|
||||
Query string `json:"query"`
|
||||
}
|
||||
|
||||
// ExecuteSQL [no description].
|
||||
//
|
||||
// parameters:
|
||||
// databaseId
|
||||
// databaseID
|
||||
// query
|
||||
func ExecuteSQL(databaseId DatabaseID, query string) *ExecuteSQLParams {
|
||||
func ExecuteSQL(databaseID ID, query string) *ExecuteSQLParams {
|
||||
return &ExecuteSQLParams{
|
||||
DatabaseID: databaseId,
|
||||
DatabaseID: databaseID,
|
||||
Query: query,
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +193,7 @@ type ExecuteSQLReturns struct {
|
|||
// columnNames
|
||||
// values
|
||||
// sqlError
|
||||
func (p *ExecuteSQLParams) Do(ctxt context.Context, h FrameHandler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
||||
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.FrameHandler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -219,13 +205,13 @@ func (p *ExecuteSQLParams) Do(ctxt context.Context, h FrameHandler) (columnNames
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDatabaseExecuteSQL, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, nil, ErrChannelClosed
|
||||
return nil, nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -234,7 +220,7 @@ func (p *ExecuteSQLParams) Do(ctxt context.Context, h FrameHandler) (columnNames
|
|||
var r ExecuteSQLReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, nil, ErrInvalidResult
|
||||
return nil, nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.ColumnNames, r.Values, r.SQLError, nil
|
||||
|
@ -244,8 +230,8 @@ func (p *ExecuteSQLParams) Do(ctxt context.Context, h FrameHandler) (columnNames
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, nil, ErrContextDone
|
||||
return nil, nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, nil, ErrUnknownResult
|
||||
return nil, nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, ou
|
|||
}
|
||||
switch key {
|
||||
case "databaseId":
|
||||
out.DatabaseID = DatabaseID(in.String())
|
||||
out.DatabaseID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(in *jlexer.Lexer, ou
|
|||
}
|
||||
switch key {
|
||||
case "databaseId":
|
||||
out.DatabaseID = DatabaseID(in.String())
|
||||
out.DatabaseID = ID(in.String())
|
||||
case "query":
|
||||
out.Query = string(in.String())
|
||||
default:
|
||||
|
@ -711,7 +711,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, ou
|
|||
}
|
||||
switch key {
|
||||
case "id":
|
||||
out.ID = DatabaseID(in.String())
|
||||
out.ID = ID(in.String())
|
||||
case "domain":
|
||||
out.Domain = string(in.String())
|
||||
case "name":
|
||||
|
|
|
@ -3,34 +3,15 @@ package database
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventAddDatabase [no description].
|
||||
type EventAddDatabase struct {
|
||||
Database *Database `json:"database,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventDatabaseAddDatabase,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventDatabaseAddDatabase,
|
||||
}
|
||||
|
|
|
@ -2,41 +2,17 @@ package database
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
// ID unique identifier of Database object.
|
||||
type ID string
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// DatabaseID unique identifier of Database object.
|
||||
type DatabaseID string
|
||||
|
||||
// String returns the DatabaseID as string value.
|
||||
func (t DatabaseID) String() string {
|
||||
// String returns the ID as string value.
|
||||
func (t ID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// Database database object.
|
||||
type Database struct {
|
||||
ID DatabaseID `json:"id,omitempty"` // Database ID.
|
||||
ID ID `json:"id,omitempty"` // Database ID.
|
||||
Domain string `json:"domain,omitempty"` // Database domain.
|
||||
Name string `json:"name,omitempty"` // Database name.
|
||||
Version string `json:"version,omitempty"` // Database version.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,31 +3,11 @@ package debugger
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventScriptParsed fired when virtual machine parses script. This event is
|
||||
// also fired for all known and uncollected scripts upon enabling debugger.
|
||||
type EventScriptParsed struct {
|
||||
|
@ -81,11 +61,11 @@ type EventPaused struct {
|
|||
// EventResumed fired when the virtual machine resumed execution.
|
||||
type EventResumed struct{}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventDebuggerScriptParsed,
|
||||
EventDebuggerScriptFailedToParse,
|
||||
EventDebuggerBreakpointResolved,
|
||||
EventDebuggerPaused,
|
||||
EventDebuggerResumed,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventDebuggerScriptParsed,
|
||||
cdp.EventDebuggerScriptFailedToParse,
|
||||
cdp.EventDebuggerBreakpointResolved,
|
||||
cdp.EventDebuggerPaused,
|
||||
cdp.EventDebuggerResumed,
|
||||
}
|
||||
|
|
|
@ -1,36 +1,15 @@
|
|||
package debugger
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// BreakpointID breakpoint identifier.
|
||||
type BreakpointID string
|
||||
|
|
|
@ -9,30 +9,10 @@ package deviceorientation
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
|
||||
type SetDeviceOrientationOverrideParams struct {
|
||||
Alpha float64 `json:"alpha"` // Mock alpha
|
||||
|
@ -55,7 +35,7 @@ func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *S
|
|||
}
|
||||
|
||||
// Do executes DeviceOrientation.setDeviceOrientationOverride.
|
||||
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -67,13 +47,13 @@ func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDeviceOrientationSetDeviceOrientationOverride, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -85,10 +65,10 @@ func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearDeviceOrientationOverrideParams clears the overridden Device
|
||||
|
@ -101,19 +81,19 @@ func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
|
|||
}
|
||||
|
||||
// Do executes DeviceOrientation.clearDeviceOrientationOverride.
|
||||
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDeviceOrientationClearDeviceOrientationOverride, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandDeviceOrientationClearDeviceOrientationOverride, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -125,8 +105,8 @@ func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h FrameH
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
782
cdp/dom/dom.go
782
cdp/dom/dom.go
File diff suppressed because it is too large
Load Diff
|
@ -3,27 +3,7 @@ package dom
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDocumentUpdated fired when Document has been totally updated. Node
|
||||
|
@ -33,114 +13,115 @@ type EventDocumentUpdated struct{}
|
|||
// EventInspectNodeRequested fired when the node should be inspected. This
|
||||
// happens after call to setInspectMode.
|
||||
type EventInspectNodeRequested struct {
|
||||
BackendNodeID BackendNodeID `json:"backendNodeId,omitempty"` // Id of the node to inspect.
|
||||
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Id of the node to inspect.
|
||||
}
|
||||
|
||||
// EventSetChildNodes fired when backend wants to provide client with the
|
||||
// missing DOM structure. This happens upon most of the calls requesting node
|
||||
// ids.
|
||||
type EventSetChildNodes struct {
|
||||
ParentID NodeID `json:"parentId,omitempty"` // Parent node id to populate with children.
|
||||
Nodes []*Node `json:"nodes,omitempty"` // Child nodes array.
|
||||
ParentID cdp.NodeID `json:"parentId,omitempty"` // Parent node id to populate with children.
|
||||
Nodes []*cdp.Node `json:"nodes,omitempty"` // Child nodes array.
|
||||
}
|
||||
|
||||
// EventAttributeModified fired when Element's attribute is modified.
|
||||
type EventAttributeModified struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
Name string `json:"name,omitempty"` // Attribute name.
|
||||
Value string `json:"value,omitempty"` // Attribute value.
|
||||
}
|
||||
|
||||
// EventAttributeRemoved fired when Element's attribute is removed.
|
||||
type EventAttributeRemoved struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
Name string `json:"name,omitempty"` // A ttribute name.
|
||||
}
|
||||
|
||||
// EventInlineStyleInvalidated fired when Element's inline style is modified
|
||||
// via a CSS property modification.
|
||||
type EventInlineStyleInvalidated struct {
|
||||
NodeIds []NodeID `json:"nodeIds,omitempty"` // Ids of the nodes for which the inline styles have been invalidated.
|
||||
NodeIds []cdp.NodeID `json:"nodeIds,omitempty"` // Ids of the nodes for which the inline styles have been invalidated.
|
||||
}
|
||||
|
||||
// EventCharacterDataModified mirrors DOMCharacterDataModified event.
|
||||
type EventCharacterDataModified struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
CharacterData string `json:"characterData,omitempty"` // New text value.
|
||||
}
|
||||
|
||||
// EventChildNodeCountUpdated fired when Container's child node count has
|
||||
// changed.
|
||||
type EventChildNodeCountUpdated struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed.
|
||||
ChildNodeCount int64 `json:"childNodeCount,omitempty"` // New node count.
|
||||
}
|
||||
|
||||
// EventChildNodeInserted mirrors DOMNodeInserted event.
|
||||
type EventChildNodeInserted struct {
|
||||
ParentNodeID NodeID `json:"parentNodeId,omitempty"` // Id of the node that has changed.
|
||||
PreviousNodeID NodeID `json:"previousNodeId,omitempty"` // If of the previous siblint.
|
||||
Node *Node `json:"node,omitempty"` // Inserted node data.
|
||||
ParentNodeID cdp.NodeID `json:"parentNodeId,omitempty"` // Id of the node that has changed.
|
||||
PreviousNodeID cdp.NodeID `json:"previousNodeId,omitempty"` // If of the previous siblint.
|
||||
Node *cdp.Node `json:"node,omitempty"` // Inserted node data.
|
||||
}
|
||||
|
||||
// EventChildNodeRemoved mirrors DOMNodeRemoved event.
|
||||
type EventChildNodeRemoved struct {
|
||||
ParentNodeID NodeID `json:"parentNodeId,omitempty"` // Parent id.
|
||||
NodeID NodeID `json:"nodeId,omitempty"` // Id of the node that has been removed.
|
||||
ParentNodeID cdp.NodeID `json:"parentNodeId,omitempty"` // Parent id.
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has been removed.
|
||||
}
|
||||
|
||||
// EventShadowRootPushed called when shadow root is pushed into the element.
|
||||
type EventShadowRootPushed struct {
|
||||
HostID NodeID `json:"hostId,omitempty"` // Host element id.
|
||||
Root *Node `json:"root,omitempty"` // Shadow root.
|
||||
HostID cdp.NodeID `json:"hostId,omitempty"` // Host element id.
|
||||
Root *cdp.Node `json:"root,omitempty"` // Shadow root.
|
||||
}
|
||||
|
||||
// EventShadowRootPopped called when shadow root is popped from the element.
|
||||
type EventShadowRootPopped struct {
|
||||
HostID NodeID `json:"hostId,omitempty"` // Host element id.
|
||||
RootID NodeID `json:"rootId,omitempty"` // Shadow root id.
|
||||
HostID cdp.NodeID `json:"hostId,omitempty"` // Host element id.
|
||||
RootID cdp.NodeID `json:"rootId,omitempty"` // Shadow root id.
|
||||
}
|
||||
|
||||
// EventPseudoElementAdded called when a pseudo element is added to an
|
||||
// element.
|
||||
type EventPseudoElementAdded struct {
|
||||
ParentID NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id.
|
||||
PseudoElement *Node `json:"pseudoElement,omitempty"` // The added pseudo element.
|
||||
ParentID cdp.NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id.
|
||||
PseudoElement *cdp.Node `json:"pseudoElement,omitempty"` // The added pseudo element.
|
||||
}
|
||||
|
||||
// EventPseudoElementRemoved called when a pseudo element is removed from an
|
||||
// element.
|
||||
type EventPseudoElementRemoved struct {
|
||||
ParentID NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id.
|
||||
PseudoElementID NodeID `json:"pseudoElementId,omitempty"` // The removed pseudo element id.
|
||||
ParentID cdp.NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id.
|
||||
PseudoElementID cdp.NodeID `json:"pseudoElementId,omitempty"` // The removed pseudo element id.
|
||||
}
|
||||
|
||||
// EventDistributedNodesUpdated called when distrubution is changed.
|
||||
type EventDistributedNodesUpdated struct {
|
||||
InsertionPointID NodeID `json:"insertionPointId,omitempty"` // Insertion point where distrubuted nodes were updated.
|
||||
DistributedNodes []*BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point.
|
||||
InsertionPointID cdp.NodeID `json:"insertionPointId,omitempty"` // Insertion point where distrubuted nodes were updated.
|
||||
DistributedNodes []*cdp.BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point.
|
||||
}
|
||||
|
||||
// EventNodeHighlightRequested [no description].
|
||||
type EventNodeHighlightRequested struct {
|
||||
NodeID NodeID `json:"nodeId,omitempty"`
|
||||
NodeID cdp.NodeID `json:"nodeId,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventDOMDocumentUpdated,
|
||||
EventDOMInspectNodeRequested,
|
||||
EventDOMSetChildNodes,
|
||||
EventDOMAttributeModified,
|
||||
EventDOMAttributeRemoved,
|
||||
EventDOMInlineStyleInvalidated,
|
||||
EventDOMCharacterDataModified,
|
||||
EventDOMChildNodeCountUpdated,
|
||||
EventDOMChildNodeInserted,
|
||||
EventDOMChildNodeRemoved,
|
||||
EventDOMShadowRootPushed,
|
||||
EventDOMShadowRootPopped,
|
||||
EventDOMPseudoElementAdded,
|
||||
EventDOMPseudoElementRemoved,
|
||||
EventDOMDistributedNodesUpdated,
|
||||
EventDOMNodeHighlightRequested,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventDOMDocumentUpdated,
|
||||
cdp.EventDOMInspectNodeRequested,
|
||||
cdp.EventDOMSetChildNodes,
|
||||
cdp.EventDOMAttributeModified,
|
||||
cdp.EventDOMAttributeRemoved,
|
||||
cdp.EventDOMInlineStyleInvalidated,
|
||||
cdp.EventDOMCharacterDataModified,
|
||||
cdp.EventDOMChildNodeCountUpdated,
|
||||
cdp.EventDOMChildNodeInserted,
|
||||
cdp.EventDOMChildNodeRemoved,
|
||||
cdp.EventDOMShadowRootPushed,
|
||||
cdp.EventDOMShadowRootPopped,
|
||||
cdp.EventDOMPseudoElementAdded,
|
||||
cdp.EventDOMPseudoElementRemoved,
|
||||
cdp.EventDOMDistributedNodesUpdated,
|
||||
cdp.EventDOMNodeHighlightRequested,
|
||||
}
|
||||
|
|
|
@ -5,32 +5,12 @@ package dom
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// Quad an array of quad vertices, x immediately followed by y for each
|
||||
// point, points clock-wise.
|
||||
type Quad []float64
|
||||
|
@ -67,16 +47,17 @@ type HighlightConfig struct {
|
|||
ShowRulers bool `json:"showRulers,omitempty"` // Whether the rulers should be shown (default: false).
|
||||
ShowExtensionLines bool `json:"showExtensionLines,omitempty"` // Whether the extension lines from node to the rulers should be shown (default: false).
|
||||
DisplayAsMaterial bool `json:"displayAsMaterial,omitempty"`
|
||||
ContentColor *RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
|
||||
PaddingColor *RGBA `json:"paddingColor,omitempty"` // The padding highlight fill color (default: transparent).
|
||||
BorderColor *RGBA `json:"borderColor,omitempty"` // The border highlight fill color (default: transparent).
|
||||
MarginColor *RGBA `json:"marginColor,omitempty"` // The margin highlight fill color (default: transparent).
|
||||
EventTargetColor *RGBA `json:"eventTargetColor,omitempty"` // The event target element highlight fill color (default: transparent).
|
||||
ShapeColor *RGBA `json:"shapeColor,omitempty"` // The shape outside fill color (default: transparent).
|
||||
ShapeMarginColor *RGBA `json:"shapeMarginColor,omitempty"` // The shape margin fill color (default: transparent).
|
||||
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
|
||||
PaddingColor *cdp.RGBA `json:"paddingColor,omitempty"` // The padding highlight fill color (default: transparent).
|
||||
BorderColor *cdp.RGBA `json:"borderColor,omitempty"` // The border highlight fill color (default: transparent).
|
||||
MarginColor *cdp.RGBA `json:"marginColor,omitempty"` // The margin highlight fill color (default: transparent).
|
||||
EventTargetColor *cdp.RGBA `json:"eventTargetColor,omitempty"` // The event target element highlight fill color (default: transparent).
|
||||
ShapeColor *cdp.RGBA `json:"shapeColor,omitempty"` // The shape outside fill color (default: transparent).
|
||||
ShapeMarginColor *cdp.RGBA `json:"shapeMarginColor,omitempty"` // The shape margin fill color (default: transparent).
|
||||
SelectorList string `json:"selectorList,omitempty"` // Selectors to highlight relevant nodes.
|
||||
}
|
||||
|
||||
// InspectMode [no description].
|
||||
type InspectMode string
|
||||
|
||||
// String returns the InspectMode as string value.
|
||||
|
|
|
@ -13,51 +13,31 @@ package domdebugger
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// SetDOMBreakpointParams sets breakpoint on particular operation with DOM.
|
||||
type SetDOMBreakpointParams struct {
|
||||
NodeID NodeID `json:"nodeId"` // Identifier of the node to set breakpoint on.
|
||||
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to set breakpoint on.
|
||||
Type DOMBreakpointType `json:"type"` // Type of the operation to stop upon.
|
||||
}
|
||||
|
||||
// SetDOMBreakpoint sets breakpoint on particular operation with DOM.
|
||||
//
|
||||
// parameters:
|
||||
// nodeId - Identifier of the node to set breakpoint on.
|
||||
// nodeID - Identifier of the node to set breakpoint on.
|
||||
// type - Type of the operation to stop upon.
|
||||
func SetDOMBreakpoint(nodeId NodeID, type_ DOMBreakpointType) *SetDOMBreakpointParams {
|
||||
func SetDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *SetDOMBreakpointParams {
|
||||
return &SetDOMBreakpointParams{
|
||||
NodeID: nodeId,
|
||||
Type: type_,
|
||||
NodeID: nodeID,
|
||||
Type: typeVal,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes DOMDebugger.setDOMBreakpoint.
|
||||
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -69,13 +49,13 @@ func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerSetDOMBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetDOMBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -87,16 +67,16 @@ func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveDOMBreakpointParams removes DOM breakpoint that was set using
|
||||
// setDOMBreakpoint.
|
||||
type RemoveDOMBreakpointParams struct {
|
||||
NodeID NodeID `json:"nodeId"` // Identifier of the node to remove breakpoint from.
|
||||
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to remove breakpoint from.
|
||||
Type DOMBreakpointType `json:"type"` // Type of the breakpoint to remove.
|
||||
}
|
||||
|
||||
|
@ -104,17 +84,17 @@ type RemoveDOMBreakpointParams struct {
|
|||
// setDOMBreakpoint.
|
||||
//
|
||||
// parameters:
|
||||
// nodeId - Identifier of the node to remove breakpoint from.
|
||||
// nodeID - Identifier of the node to remove breakpoint from.
|
||||
// type - Type of the breakpoint to remove.
|
||||
func RemoveDOMBreakpoint(nodeId NodeID, type_ DOMBreakpointType) *RemoveDOMBreakpointParams {
|
||||
func RemoveDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *RemoveDOMBreakpointParams {
|
||||
return &RemoveDOMBreakpointParams{
|
||||
NodeID: nodeId,
|
||||
Type: type_,
|
||||
NodeID: nodeID,
|
||||
Type: typeVal,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes DOMDebugger.removeDOMBreakpoint.
|
||||
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -126,13 +106,13 @@ func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerRemoveDOMBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveDOMBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -144,10 +124,10 @@ func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetEventListenerBreakpointParams sets breakpoint on particular DOM event.
|
||||
|
@ -174,7 +154,7 @@ func (p SetEventListenerBreakpointParams) WithTargetName(targetName string) *Set
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.setEventListenerBreakpoint.
|
||||
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -186,13 +166,13 @@ func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerSetEventListenerBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetEventListenerBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -204,10 +184,10 @@ func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveEventListenerBreakpointParams removes breakpoint on particular DOM
|
||||
|
@ -234,7 +214,7 @@ func (p RemoveEventListenerBreakpointParams) WithTargetName(targetName string) *
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.removeEventListenerBreakpoint.
|
||||
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -246,13 +226,13 @@ func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHa
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerRemoveEventListenerBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveEventListenerBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -264,10 +244,10 @@ func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h FrameHa
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetInstrumentationBreakpointParams sets breakpoint on particular native
|
||||
|
@ -287,7 +267,7 @@ func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpoin
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.setInstrumentationBreakpoint.
|
||||
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -299,13 +279,13 @@ func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerSetInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -317,10 +297,10 @@ func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
|
||||
|
@ -341,7 +321,7 @@ func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBre
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.removeInstrumentationBreakpoint.
|
||||
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -353,13 +333,13 @@ func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h Frame
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerRemoveInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -371,10 +351,10 @@ func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h Frame
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
|
||||
|
@ -393,7 +373,7 @@ func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.setXHRBreakpoint.
|
||||
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -405,13 +385,13 @@ func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerSetXHRBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetXHRBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -423,10 +403,10 @@ func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
|
||||
|
@ -445,7 +425,7 @@ func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
|
|||
}
|
||||
|
||||
// Do executes DOMDebugger.removeXHRBreakpoint.
|
||||
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -457,13 +437,13 @@ func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerRemoveXHRBreakpoint, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveXHRBreakpoint, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -475,10 +455,10 @@ func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetEventListenersParams returns event listeners of the given object.
|
||||
|
@ -489,10 +469,10 @@ type GetEventListenersParams struct {
|
|||
// GetEventListeners returns event listeners of the given object.
|
||||
//
|
||||
// parameters:
|
||||
// objectId - Identifier of the object to return listeners for.
|
||||
func GetEventListeners(objectId runtime.RemoteObjectID) *GetEventListenersParams {
|
||||
// objectID - Identifier of the object to return listeners for.
|
||||
func GetEventListeners(objectID runtime.RemoteObjectID) *GetEventListenersParams {
|
||||
return &GetEventListenersParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,7 +485,7 @@ type GetEventListenersReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// listeners - Array of relevant listeners.
|
||||
func (p *GetEventListenersParams) Do(ctxt context.Context, h FrameHandler) (listeners []*EventListener, err error) {
|
||||
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.FrameHandler) (listeners []*EventListener, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -517,13 +497,13 @@ func (p *GetEventListenersParams) Do(ctxt context.Context, h FrameHandler) (list
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMDebuggerGetEventListeners, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerGetEventListeners, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -532,7 +512,7 @@ func (p *GetEventListenersParams) Do(ctxt context.Context, h FrameHandler) (list
|
|||
var r GetEventListenersReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Listeners, nil
|
||||
|
@ -542,8 +522,8 @@ func (p *GetEventListenersParams) Do(ctxt context.Context, h FrameHandler) (list
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,36 +1,15 @@
|
|||
package domdebugger
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// DOMBreakpointType dOM breakpoint type.
|
||||
type DOMBreakpointType string
|
||||
|
|
|
@ -11,30 +11,10 @@ package domstorage
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables storage tracking, storage events will now be
|
||||
// delivered to the client.
|
||||
type EnableParams struct{}
|
||||
|
@ -46,19 +26,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes DOMStorage.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -70,10 +50,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables storage tracking, prevents storage events from
|
||||
|
@ -87,19 +67,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes DOMStorage.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -111,26 +91,29 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearParams [no description].
|
||||
type ClearParams struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
}
|
||||
|
||||
// Clear [no description].
|
||||
//
|
||||
// parameters:
|
||||
// storageId
|
||||
func Clear(storageId *StorageID) *ClearParams {
|
||||
// storageID
|
||||
func Clear(storageID *StorageID) *ClearParams {
|
||||
return &ClearParams{
|
||||
StorageID: storageId,
|
||||
StorageID: storageID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes DOMStorage.clear.
|
||||
func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -142,13 +125,13 @@ func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageClear, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageClear, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -160,21 +143,24 @@ func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetDOMStorageItemsParams [no description].
|
||||
type GetDOMStorageItemsParams struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
}
|
||||
|
||||
// GetDOMStorageItems [no description].
|
||||
//
|
||||
// parameters:
|
||||
// storageId
|
||||
func GetDOMStorageItems(storageId *StorageID) *GetDOMStorageItemsParams {
|
||||
// storageID
|
||||
func GetDOMStorageItems(storageID *StorageID) *GetDOMStorageItemsParams {
|
||||
return &GetDOMStorageItemsParams{
|
||||
StorageID: storageId,
|
||||
StorageID: storageID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +173,7 @@ type GetDOMStorageItemsReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// entries
|
||||
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h FrameHandler) (entries []Item, err error) {
|
||||
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.FrameHandler) (entries []Item, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -199,13 +185,13 @@ func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h FrameHandler) (ent
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageGetDOMStorageItems, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageGetDOMStorageItems, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -214,7 +200,7 @@ func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h FrameHandler) (ent
|
|||
var r GetDOMStorageItemsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Entries, nil
|
||||
|
@ -224,32 +210,35 @@ func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h FrameHandler) (ent
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetDOMStorageItemParams [no description].
|
||||
type SetDOMStorageItemParams struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// SetDOMStorageItem [no description].
|
||||
//
|
||||
// parameters:
|
||||
// storageId
|
||||
// storageID
|
||||
// key
|
||||
// value
|
||||
func SetDOMStorageItem(storageId *StorageID, key string, value string) *SetDOMStorageItemParams {
|
||||
func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMStorageItemParams {
|
||||
return &SetDOMStorageItemParams{
|
||||
StorageID: storageId,
|
||||
StorageID: storageID,
|
||||
Key: key,
|
||||
Value: value,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes DOMStorage.setDOMStorageItem.
|
||||
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -261,13 +250,13 @@ func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageSetDOMStorageItem, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -279,29 +268,32 @@ func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveDOMStorageItemParams [no description].
|
||||
type RemoveDOMStorageItemParams struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// RemoveDOMStorageItem [no description].
|
||||
//
|
||||
// parameters:
|
||||
// storageId
|
||||
// storageID
|
||||
// key
|
||||
func RemoveDOMStorageItem(storageId *StorageID, key string) *RemoveDOMStorageItemParams {
|
||||
func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageItemParams {
|
||||
return &RemoveDOMStorageItemParams{
|
||||
StorageID: storageId,
|
||||
StorageID: storageID,
|
||||
Key: key,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes DOMStorage.removeDOMStorageItem.
|
||||
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -313,13 +305,13 @@ func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandDOMStorageRemoveDOMStorageItem, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageRemoveDOMStorageItem, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -331,8 +323,8 @@ func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -3,44 +3,28 @@ package domstorage
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDomStorageItemsCleared [no description].
|
||||
type EventDomStorageItemsCleared struct {
|
||||
StorageID *StorageID `json:"storageId,omitempty"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemRemoved [no description].
|
||||
type EventDomStorageItemRemoved struct {
|
||||
StorageID *StorageID `json:"storageId,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemAdded [no description].
|
||||
type EventDomStorageItemAdded struct {
|
||||
StorageID *StorageID `json:"storageId,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
NewValue string `json:"newValue,omitempty"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemUpdated [no description].
|
||||
type EventDomStorageItemUpdated struct {
|
||||
StorageID *StorageID `json:"storageId,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
|
@ -48,10 +32,10 @@ type EventDomStorageItemUpdated struct {
|
|||
NewValue string `json:"newValue,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventDOMStorageDomStorageItemsCleared,
|
||||
EventDOMStorageDomStorageItemRemoved,
|
||||
EventDOMStorageDomStorageItemAdded,
|
||||
EventDOMStorageDomStorageItemUpdated,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventDOMStorageDomStorageItemsCleared,
|
||||
cdp.EventDOMStorageDomStorageItemRemoved,
|
||||
cdp.EventDOMStorageDomStorageItemAdded,
|
||||
cdp.EventDOMStorageDomStorageItemUpdated,
|
||||
}
|
||||
|
|
|
@ -2,30 +2,6 @@ package domstorage
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// StorageID dOM Storage identifier.
|
||||
type StorageID struct {
|
||||
SecurityOrigin string `json:"securityOrigin,omitempty"` // Security origin for the storage.
|
||||
|
|
|
@ -998,86 +998,7 @@ func (v *Frame) UnmarshalJSON(data []byte) error {
|
|||
func (v *Frame) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *ComputedProperty) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "name":
|
||||
out.Name = string(in.String())
|
||||
case "value":
|
||||
out.Value = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in ComputedProperty) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Name != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"name\":")
|
||||
out.String(string(in.Name))
|
||||
}
|
||||
if in.Value != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"value\":")
|
||||
out.String(string(in.Value))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ComputedProperty) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ComputedProperty) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ComputedProperty) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ComputedProperty) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp6(in *jlexer.Lexer, out *BackendNode) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *BackendNode) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1112,7 +1033,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp6(in *jlexer.Lexer, out *Backe
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp6(out *jwriter.Writer, in BackendNode) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in BackendNode) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1146,23 +1067,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp6(out *jwriter.Writer, in Back
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v BackendNode) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp6(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp6(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *BackendNode) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp6(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp6(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(l, v)
|
||||
}
|
||||
|
|
|
@ -11,30 +11,10 @@ package emulation
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// SetDeviceMetricsOverrideParams overrides the values of device screen
|
||||
// dimensions (window.screen.width, window.screen.height, window.innerWidth,
|
||||
// window.innerHeight, and "device-width"/"device-height"-related CSS media
|
||||
|
@ -116,7 +96,7 @@ func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation
|
|||
}
|
||||
|
||||
// Do executes Emulation.setDeviceMetricsOverride.
|
||||
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -128,13 +108,13 @@ func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetDeviceMetricsOverride, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -146,10 +126,10 @@ func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearDeviceMetricsOverrideParams clears the overriden device metrics.
|
||||
|
@ -161,19 +141,19 @@ func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.clearDeviceMetricsOverride.
|
||||
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationClearDeviceMetricsOverride, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationClearDeviceMetricsOverride, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -185,10 +165,10 @@ func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ForceViewportParams overrides the visible area of the page. The change is
|
||||
|
@ -219,7 +199,7 @@ func ForceViewport(x float64, y float64, scale float64) *ForceViewportParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.forceViewport.
|
||||
func (p *ForceViewportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -231,13 +211,13 @@ func (p *ForceViewportParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationForceViewport, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationForceViewport, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -249,10 +229,10 @@ func (p *ForceViewportParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ResetViewportParams resets the visible area of the page to the original
|
||||
|
@ -266,19 +246,19 @@ func ResetViewport() *ResetViewportParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.resetViewport.
|
||||
func (p *ResetViewportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationResetViewport, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationResetViewport, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -290,10 +270,10 @@ func (p *ResetViewportParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ResetPageScaleFactorParams requests that page scale factor is reset to
|
||||
|
@ -307,19 +287,19 @@ func ResetPageScaleFactor() *ResetPageScaleFactorParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.resetPageScaleFactor.
|
||||
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationResetPageScaleFactor, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationResetPageScaleFactor, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -331,10 +311,10 @@ func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetPageScaleFactorParams sets a specified page scale factor.
|
||||
|
@ -353,7 +333,7 @@ func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.setPageScaleFactor.
|
||||
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -365,13 +345,13 @@ func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetPageScaleFactor, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetPageScaleFactor, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -383,10 +363,10 @@ func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetVisibleSizeParams resizes the frame/viewport of the page. Note that
|
||||
|
@ -412,7 +392,7 @@ func SetVisibleSize(width int64, height int64) *SetVisibleSizeParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.setVisibleSize.
|
||||
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -424,13 +404,13 @@ func (p *SetVisibleSizeParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetVisibleSize, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetVisibleSize, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -442,10 +422,10 @@ func (p *SetVisibleSizeParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetScriptExecutionDisabledParams switches script execution in the page.
|
||||
|
@ -464,7 +444,7 @@ func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.setScriptExecutionDisabled.
|
||||
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -476,13 +456,13 @@ func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetScriptExecutionDisabled, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetScriptExecutionDisabled, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -494,10 +474,10 @@ func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetGeolocationOverrideParams overrides the Geolocation Position or Error.
|
||||
|
@ -535,7 +515,7 @@ func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeoloca
|
|||
}
|
||||
|
||||
// Do executes Emulation.setGeolocationOverride.
|
||||
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -547,13 +527,13 @@ func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetGeolocationOverride, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -565,10 +545,10 @@ func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearGeolocationOverrideParams clears the overriden Geolocation Position
|
||||
|
@ -582,19 +562,19 @@ func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.clearGeolocationOverride.
|
||||
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationClearGeolocationOverride, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -606,10 +586,10 @@ func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetTouchEmulationEnabledParams toggles mouse event-based touch event
|
||||
|
@ -637,7 +617,7 @@ func (p SetTouchEmulationEnabledParams) WithConfiguration(configuration EnabledC
|
|||
}
|
||||
|
||||
// Do executes Emulation.setTouchEmulationEnabled.
|
||||
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -649,13 +629,13 @@ func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetTouchEmulationEnabled, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -667,10 +647,10 @@ func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetEmulatedMediaParams emulates the given media for CSS media queries.
|
||||
|
@ -689,7 +669,7 @@ func SetEmulatedMedia(media string) *SetEmulatedMediaParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.setEmulatedMedia.
|
||||
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -701,13 +681,13 @@ func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetEmulatedMedia, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -719,10 +699,10 @@ func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
|
||||
|
@ -741,7 +721,7 @@ func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams {
|
|||
}
|
||||
|
||||
// Do executes Emulation.setCPUThrottlingRate.
|
||||
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -753,13 +733,13 @@ func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetCPUThrottlingRate, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -771,10 +751,10 @@ func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CanEmulateParams tells whether emulation is supported.
|
||||
|
@ -794,19 +774,19 @@ type CanEmulateReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// result - True if emulation is supported.
|
||||
func (p *CanEmulateParams) Do(ctxt context.Context, h FrameHandler) (result bool, err error) {
|
||||
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationCanEmulate, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationCanEmulate, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -815,7 +795,7 @@ func (p *CanEmulateParams) Do(ctxt context.Context, h FrameHandler) (result bool
|
|||
var r CanEmulateReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
@ -825,10 +805,10 @@ func (p *CanEmulateParams) Do(ctxt context.Context, h FrameHandler) (result bool
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetVirtualTimePolicyParams turns on virtual time for all frames (replacing
|
||||
|
@ -859,7 +839,7 @@ func (p SetVirtualTimePolicyParams) WithBudget(budget int64) *SetVirtualTimePoli
|
|||
}
|
||||
|
||||
// Do executes Emulation.setVirtualTimePolicy.
|
||||
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -871,13 +851,13 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandEmulationSetVirtualTimePolicy, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetVirtualTimePolicy, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -889,8 +869,8 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -3,34 +3,14 @@ package emulation
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventVirtualTimeBudgetExpired notification sent after the virual time
|
||||
// budget for the current VirtualTimePolicy has run out.
|
||||
type EventVirtualTimeBudgetExpired struct{}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventEmulationVirtualTimeBudgetExpired,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventEmulationVirtualTimeBudgetExpired,
|
||||
}
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
package emulation
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// ScreenOrientation screen orientation.
|
||||
type ScreenOrientation struct {
|
||||
|
|
|
@ -3,35 +3,18 @@ package heapprofiler
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventAddHeapSnapshotChunk [no description].
|
||||
type EventAddHeapSnapshotChunk struct {
|
||||
Chunk string `json:"chunk,omitempty"`
|
||||
}
|
||||
|
||||
// EventResetProfiles [no description].
|
||||
type EventResetProfiles struct{}
|
||||
|
||||
// EventReportHeapSnapshotProgress [no description].
|
||||
type EventReportHeapSnapshotProgress struct {
|
||||
Done int64 `json:"done,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
|
@ -45,7 +28,7 @@ type EventReportHeapSnapshotProgress struct {
|
|||
// lastSeenObjectId event.
|
||||
type EventLastSeenObjectID struct {
|
||||
LastSeenObjectID int64 `json:"lastSeenObjectId,omitempty"`
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"`
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"`
|
||||
}
|
||||
|
||||
// EventHeapStatsUpdate if heap objects tracking has been started then
|
||||
|
@ -54,11 +37,11 @@ type EventHeapStatsUpdate struct {
|
|||
StatsUpdate []int64 `json:"statsUpdate,omitempty"` // An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventHeapProfilerAddHeapSnapshotChunk,
|
||||
EventHeapProfilerResetProfiles,
|
||||
EventHeapProfilerReportHeapSnapshotProgress,
|
||||
EventHeapProfilerLastSeenObjectID,
|
||||
EventHeapProfilerHeapStatsUpdate,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventHeapProfilerAddHeapSnapshotChunk,
|
||||
cdp.EventHeapProfilerResetProfiles,
|
||||
cdp.EventHeapProfilerReportHeapSnapshotProgress,
|
||||
cdp.EventHeapProfilerLastSeenObjectID,
|
||||
cdp.EventHeapProfilerHeapStatsUpdate,
|
||||
}
|
||||
|
|
|
@ -9,51 +9,33 @@ package heapprofiler
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -65,32 +47,34 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable [no description].
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -102,28 +86,32 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StartTrackingHeapObjectsParams [no description].
|
||||
type StartTrackingHeapObjectsParams struct {
|
||||
TrackAllocations bool `json:"trackAllocations,omitempty"`
|
||||
}
|
||||
|
||||
// StartTrackingHeapObjects [no description].
|
||||
//
|
||||
// parameters:
|
||||
func StartTrackingHeapObjects() *StartTrackingHeapObjectsParams {
|
||||
return &StartTrackingHeapObjectsParams{}
|
||||
}
|
||||
|
||||
// WithTrackAllocations [no description].
|
||||
func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bool) *StartTrackingHeapObjectsParams {
|
||||
p.TrackAllocations = trackAllocations
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.startTrackingHeapObjects.
|
||||
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -135,13 +123,13 @@ func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerStartTrackingHeapObjects, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStartTrackingHeapObjects, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -153,16 +141,19 @@ func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StopTrackingHeapObjectsParams [no description].
|
||||
type StopTrackingHeapObjectsParams struct {
|
||||
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
|
||||
}
|
||||
|
||||
// StopTrackingHeapObjects [no description].
|
||||
//
|
||||
// parameters:
|
||||
func StopTrackingHeapObjects() *StopTrackingHeapObjectsParams {
|
||||
return &StopTrackingHeapObjectsParams{}
|
||||
|
@ -176,7 +167,7 @@ func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *
|
|||
}
|
||||
|
||||
// Do executes HeapProfiler.stopTrackingHeapObjects.
|
||||
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -188,13 +179,13 @@ func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerStopTrackingHeapObjects, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStopTrackingHeapObjects, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -206,16 +197,19 @@ func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// TakeHeapSnapshotParams [no description].
|
||||
type TakeHeapSnapshotParams struct {
|
||||
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
|
||||
}
|
||||
|
||||
// TakeHeapSnapshot [no description].
|
||||
//
|
||||
// parameters:
|
||||
func TakeHeapSnapshot() *TakeHeapSnapshotParams {
|
||||
return &TakeHeapSnapshotParams{}
|
||||
|
@ -229,7 +223,7 @@ func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHea
|
|||
}
|
||||
|
||||
// Do executes HeapProfiler.takeHeapSnapshot.
|
||||
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -241,13 +235,13 @@ func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerTakeHeapSnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -259,32 +253,34 @@ func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CollectGarbageParams [no description].
|
||||
type CollectGarbageParams struct{}
|
||||
|
||||
// CollectGarbage [no description].
|
||||
func CollectGarbage() *CollectGarbageParams {
|
||||
return &CollectGarbageParams{}
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.collectGarbage.
|
||||
func (p *CollectGarbageParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerCollectGarbage, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerCollectGarbage, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -296,22 +292,25 @@ func (p *CollectGarbageParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetObjectByHeapObjectIDParams [no description].
|
||||
type GetObjectByHeapObjectIDParams struct {
|
||||
ObjectID HeapSnapshotObjectID `json:"objectId"`
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
|
||||
}
|
||||
|
||||
// GetObjectByHeapObjectID [no description].
|
||||
//
|
||||
// parameters:
|
||||
// objectId
|
||||
func GetObjectByHeapObjectID(objectId HeapSnapshotObjectID) *GetObjectByHeapObjectIDParams {
|
||||
// objectID
|
||||
func GetObjectByHeapObjectID(objectID HeapSnapshotObjectID) *GetObjectByHeapObjectIDParams {
|
||||
return &GetObjectByHeapObjectIDParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,7 +330,7 @@ type GetObjectByHeapObjectIDReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// result - Evaluation result.
|
||||
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler) (result *runtime.RemoteObject, err error) {
|
||||
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *runtime.RemoteObject, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -343,13 +342,13 @@ func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerGetObjectByHeapObjectID, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerGetObjectByHeapObjectID, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -358,7 +357,7 @@ func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler)
|
|||
var r GetObjectByHeapObjectIDReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
@ -368,10 +367,10 @@ func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// AddInspectedHeapObjectParams enables console to refer to the node with
|
||||
|
@ -384,15 +383,15 @@ type AddInspectedHeapObjectParams struct {
|
|||
// via $x (see Command Line API for more details $x functions).
|
||||
//
|
||||
// parameters:
|
||||
// heapObjectId - Heap snapshot object id to be accessible by means of $x command line API.
|
||||
func AddInspectedHeapObject(heapObjectId HeapSnapshotObjectID) *AddInspectedHeapObjectParams {
|
||||
// heapObjectID - Heap snapshot object id to be accessible by means of $x command line API.
|
||||
func AddInspectedHeapObject(heapObjectID HeapSnapshotObjectID) *AddInspectedHeapObjectParams {
|
||||
return &AddInspectedHeapObjectParams{
|
||||
HeapObjectID: heapObjectId,
|
||||
HeapObjectID: heapObjectID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.addInspectedHeapObject.
|
||||
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -404,13 +403,13 @@ func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerAddInspectedHeapObject, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerAddInspectedHeapObject, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -422,21 +421,24 @@ func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetHeapObjectIDParams [no description].
|
||||
type GetHeapObjectIDParams struct {
|
||||
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to get heap object id for.
|
||||
}
|
||||
|
||||
// GetHeapObjectID [no description].
|
||||
//
|
||||
// parameters:
|
||||
// objectId - Identifier of the object to get heap object id for.
|
||||
func GetHeapObjectID(objectId runtime.RemoteObjectID) *GetHeapObjectIDParams {
|
||||
// objectID - Identifier of the object to get heap object id for.
|
||||
func GetHeapObjectID(objectID runtime.RemoteObjectID) *GetHeapObjectIDParams {
|
||||
return &GetHeapObjectIDParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,8 +450,8 @@ type GetHeapObjectIDReturns struct {
|
|||
// Do executes HeapProfiler.getHeapObjectId.
|
||||
//
|
||||
// returns:
|
||||
// heapSnapshotObjectId - Id of the heap snapshot object corresponding to the passed remote object id.
|
||||
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler) (heapSnapshotObjectId HeapSnapshotObjectID, err error) {
|
||||
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
|
||||
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.FrameHandler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -461,13 +463,13 @@ func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler) (heapSn
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerGetHeapObjectID, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerGetHeapObjectID, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -476,7 +478,7 @@ func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler) (heapSn
|
|||
var r GetHeapObjectIDReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.HeapSnapshotObjectID, nil
|
||||
|
@ -486,16 +488,19 @@ func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h FrameHandler) (heapSn
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StartSamplingParams [no description].
|
||||
type StartSamplingParams struct {
|
||||
SamplingInterval float64 `json:"samplingInterval,omitempty"` // Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
|
||||
}
|
||||
|
||||
// StartSampling [no description].
|
||||
//
|
||||
// parameters:
|
||||
func StartSampling() *StartSamplingParams {
|
||||
return &StartSamplingParams{}
|
||||
|
@ -509,7 +514,7 @@ func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *Sta
|
|||
}
|
||||
|
||||
// Do executes HeapProfiler.startSampling.
|
||||
func (p *StartSamplingParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -521,13 +526,13 @@ func (p *StartSamplingParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerStartSampling, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStartSampling, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -539,14 +544,16 @@ func (p *StartSamplingParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StopSamplingParams [no description].
|
||||
type StopSamplingParams struct{}
|
||||
|
||||
// StopSampling [no description].
|
||||
func StopSampling() *StopSamplingParams {
|
||||
return &StopSamplingParams{}
|
||||
}
|
||||
|
@ -560,19 +567,19 @@ type StopSamplingReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// profile - Recorded sampling heap profile.
|
||||
func (p *StopSamplingParams) Do(ctxt context.Context, h FrameHandler) (profile *SamplingHeapProfile, err error) {
|
||||
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.FrameHandler) (profile *SamplingHeapProfile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandHeapProfilerStopSampling, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -581,7 +588,7 @@ func (p *StopSamplingParams) Do(ctxt context.Context, h FrameHandler) (profile *
|
|||
var r StopSamplingReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Profile, nil
|
||||
|
@ -591,8 +598,8 @@ func (p *StopSamplingParams) Do(ctxt context.Context, h FrameHandler) (profile *
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
package heapprofiler
|
||||
|
||||
import "github.com/knq/chromedp/cdp/runtime"
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// HeapSnapshotObjectID heap snapshot object id.
|
||||
type HeapSnapshotObjectID string
|
||||
|
||||
|
|
|
@ -9,30 +9,10 @@ package indexeddb
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables events from backend.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -42,19 +22,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes IndexedDB.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -66,10 +46,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables events from backend.
|
||||
|
@ -81,19 +61,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes IndexedDB.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -105,10 +85,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RequestDatabaseNamesParams requests database names for given security
|
||||
|
@ -136,7 +116,7 @@ type RequestDatabaseNamesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// databaseNames - Database names for origin.
|
||||
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h FrameHandler) (databaseNames []string, err error) {
|
||||
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (databaseNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -148,13 +128,13 @@ func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h FrameHandler) (d
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBRequestDatabaseNames, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -163,7 +143,7 @@ func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h FrameHandler) (d
|
|||
var r RequestDatabaseNamesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.DatabaseNames, nil
|
||||
|
@ -173,10 +153,10 @@ func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h FrameHandler) (d
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RequestDatabaseParams requests database with given name in given frame.
|
||||
|
@ -206,7 +186,7 @@ type RequestDatabaseReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// databaseWithObjectStores - Database with an array of object stores.
|
||||
func (p *RequestDatabaseParams) Do(ctxt context.Context, h FrameHandler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
||||
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.FrameHandler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -218,13 +198,13 @@ func (p *RequestDatabaseParams) Do(ctxt context.Context, h FrameHandler) (databa
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBRequestDatabase, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -233,7 +213,7 @@ func (p *RequestDatabaseParams) Do(ctxt context.Context, h FrameHandler) (databa
|
|||
var r RequestDatabaseReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.DatabaseWithObjectStores, nil
|
||||
|
@ -243,10 +223,10 @@ func (p *RequestDatabaseParams) Do(ctxt context.Context, h FrameHandler) (databa
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RequestDataParams requests data from object store or index.
|
||||
|
@ -297,7 +277,7 @@ type RequestDataReturns struct {
|
|||
// returns:
|
||||
// objectStoreDataEntries - Array of object store data entries.
|
||||
// hasMore - If true, there are more entries to fetch in the given range.
|
||||
func (p *RequestDataParams) Do(ctxt context.Context, h FrameHandler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.FrameHandler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -309,13 +289,13 @@ func (p *RequestDataParams) Do(ctxt context.Context, h FrameHandler) (objectStor
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBRequestData, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestData, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, false, ErrChannelClosed
|
||||
return nil, false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -324,7 +304,7 @@ func (p *RequestDataParams) Do(ctxt context.Context, h FrameHandler) (objectStor
|
|||
var r RequestDataReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, false, ErrInvalidResult
|
||||
return nil, false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.ObjectStoreDataEntries, r.HasMore, nil
|
||||
|
@ -334,10 +314,10 @@ func (p *RequestDataParams) Do(ctxt context.Context, h FrameHandler) (objectStor
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, false, ErrContextDone
|
||||
return nil, false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, false, ErrUnknownResult
|
||||
return nil, false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearObjectStoreParams clears all entries from an object store.
|
||||
|
@ -362,7 +342,7 @@ func ClearObjectStore(securityOrigin string, databaseName string, objectStoreNam
|
|||
}
|
||||
|
||||
// Do executes IndexedDB.clearObjectStore.
|
||||
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -374,13 +354,13 @@ func (p *ClearObjectStoreParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIndexedDBClearObjectStore, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -392,8 +372,8 @@ func (p *ClearObjectStoreParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,36 +1,15 @@
|
|||
package indexeddb
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// DatabaseWithObjectStores database with an array of object stores.
|
||||
type DatabaseWithObjectStores struct {
|
||||
|
|
|
@ -9,30 +9,10 @@ package input
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// DispatchKeyEventParams dispatches a key event to the page.
|
||||
type DispatchKeyEventParams struct {
|
||||
Type KeyType `json:"type"` // Type of the key event.
|
||||
|
@ -54,9 +34,9 @@ type DispatchKeyEventParams struct {
|
|||
//
|
||||
// parameters:
|
||||
// type - Type of the key event.
|
||||
func DispatchKeyEvent(type_ KeyType) *DispatchKeyEventParams {
|
||||
func DispatchKeyEvent(typeVal KeyType) *DispatchKeyEventParams {
|
||||
return &DispatchKeyEventParams{
|
||||
Type: type_,
|
||||
Type: typeVal,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +124,7 @@ func (p DispatchKeyEventParams) WithIsSystemKey(isSystemKey bool) *DispatchKeyEv
|
|||
}
|
||||
|
||||
// Do executes Input.dispatchKeyEvent.
|
||||
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -156,13 +136,13 @@ func (p *DispatchKeyEventParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputDispatchKeyEvent, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchKeyEvent, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -174,10 +154,10 @@ func (p *DispatchKeyEventParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DispatchMouseEventParams dispatches a mouse event to the page.
|
||||
|
@ -197,9 +177,9 @@ type DispatchMouseEventParams struct {
|
|||
// type - Type of the mouse event.
|
||||
// x - X coordinate of the event relative to the main frame's viewport.
|
||||
// y - Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
|
||||
func DispatchMouseEvent(type_ MouseType, x int64, y int64) *DispatchMouseEventParams {
|
||||
func DispatchMouseEvent(typeVal MouseType, x int64, y int64) *DispatchMouseEventParams {
|
||||
return &DispatchMouseEventParams{
|
||||
Type: type_,
|
||||
Type: typeVal,
|
||||
X: x,
|
||||
Y: y,
|
||||
}
|
||||
|
@ -232,7 +212,7 @@ func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMous
|
|||
}
|
||||
|
||||
// Do executes Input.dispatchMouseEvent.
|
||||
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -244,13 +224,13 @@ func (p *DispatchMouseEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputDispatchMouseEvent, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchMouseEvent, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -262,10 +242,10 @@ func (p *DispatchMouseEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DispatchTouchEventParams dispatches a touch event to the page.
|
||||
|
@ -281,9 +261,9 @@ type DispatchTouchEventParams struct {
|
|||
// parameters:
|
||||
// type - Type of the touch event.
|
||||
// touchPoints - Touch points.
|
||||
func DispatchTouchEvent(type_ TouchType, touchPoints []*TouchPoint) *DispatchTouchEventParams {
|
||||
func DispatchTouchEvent(typeVal TouchType, touchPoints []*TouchPoint) *DispatchTouchEventParams {
|
||||
return &DispatchTouchEventParams{
|
||||
Type: type_,
|
||||
Type: typeVal,
|
||||
TouchPoints: touchPoints,
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +283,7 @@ func (p DispatchTouchEventParams) WithTimestamp(timestamp float64) *DispatchTouc
|
|||
}
|
||||
|
||||
// Do executes Input.dispatchTouchEvent.
|
||||
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -315,13 +295,13 @@ func (p *DispatchTouchEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputDispatchTouchEvent, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchTouchEvent, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -333,10 +313,10 @@ func (p *DispatchTouchEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// EmulateTouchFromMouseEventParams emulates touch event from the mouse event
|
||||
|
@ -362,9 +342,9 @@ type EmulateTouchFromMouseEventParams struct {
|
|||
// y - Y coordinate of the mouse pointer in DIP.
|
||||
// timestamp - Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970.
|
||||
// button - Mouse button.
|
||||
func EmulateTouchFromMouseEvent(type_ MouseType, x int64, y int64, timestamp float64, button ButtonType) *EmulateTouchFromMouseEventParams {
|
||||
func EmulateTouchFromMouseEvent(typeVal MouseType, x int64, y int64, timestamp float64, button ButtonType) *EmulateTouchFromMouseEventParams {
|
||||
return &EmulateTouchFromMouseEventParams{
|
||||
Type: type_,
|
||||
Type: typeVal,
|
||||
X: x,
|
||||
Y: y,
|
||||
Timestamp: timestamp,
|
||||
|
@ -398,7 +378,7 @@ func (p EmulateTouchFromMouseEventParams) WithClickCount(clickCount int64) *Emul
|
|||
}
|
||||
|
||||
// Do executes Input.emulateTouchFromMouseEvent.
|
||||
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -410,13 +390,13 @@ func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputEmulateTouchFromMouseEvent, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputEmulateTouchFromMouseEvent, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -428,10 +408,10 @@ func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h FrameHandl
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SynthesizePinchGestureParams synthesizes a pinch gesture over a time
|
||||
|
@ -474,7 +454,7 @@ func (p SynthesizePinchGestureParams) WithGestureSourceType(gestureSourceType Ge
|
|||
}
|
||||
|
||||
// Do executes Input.synthesizePinchGesture.
|
||||
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -486,13 +466,13 @@ func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputSynthesizePinchGesture, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizePinchGesture, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -504,10 +484,10 @@ func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SynthesizeScrollGestureParams synthesizes a scroll gesture over a time
|
||||
|
@ -608,7 +588,7 @@ func (p SynthesizeScrollGestureParams) WithInteractionMarkerName(interactionMark
|
|||
}
|
||||
|
||||
// Do executes Input.synthesizeScrollGesture.
|
||||
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -620,13 +600,13 @@ func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputSynthesizeScrollGesture, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizeScrollGesture, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -638,10 +618,10 @@ func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SynthesizeTapGestureParams synthesizes a tap gesture over a time period by
|
||||
|
@ -689,7 +669,7 @@ func (p SynthesizeTapGestureParams) WithGestureSourceType(gestureSourceType Gest
|
|||
}
|
||||
|
||||
// Do executes Input.synthesizeTapGesture.
|
||||
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -701,13 +681,13 @@ func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInputSynthesizeTapGesture, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizeTapGesture, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -719,8 +699,8 @@ func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,37 +1,17 @@
|
|||
package input
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// TouchPoint [no description].
|
||||
type TouchPoint struct {
|
||||
State TouchState `json:"state,omitempty"` // State of the touch point.
|
||||
X int64 `json:"x,omitempty"` // X coordinate of the event relative to the main frame's viewport.
|
||||
|
@ -43,6 +23,7 @@ type TouchPoint struct {
|
|||
ID float64 `json:"id,omitempty"` // Identifier used to track touch sources between events, must be unique within an event.
|
||||
}
|
||||
|
||||
// GestureType [no description].
|
||||
type GestureType string
|
||||
|
||||
// String returns the GestureType as string value.
|
||||
|
|
|
@ -3,27 +3,7 @@ package inspector
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDetached fired when remote debugging connection is about to be
|
||||
|
@ -35,8 +15,8 @@ type EventDetached struct {
|
|||
// EventTargetCrashed fired when debugging target has crashed.
|
||||
type EventTargetCrashed struct{}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventInspectorDetached,
|
||||
EventInspectorTargetCrashed,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventInspectorDetached,
|
||||
cdp.EventInspectorTargetCrashed,
|
||||
}
|
||||
|
|
|
@ -9,30 +9,10 @@ package inspector
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables inspector domain notifications.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -42,19 +22,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Inspector.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInspectorEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandInspectorEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -66,10 +46,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables inspector domain notifications.
|
||||
|
@ -81,19 +61,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Inspector.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandInspectorDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandInspectorDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -105,8 +85,8 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
package inspector
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// DetachReason detach reason.
|
||||
type DetachReason string
|
||||
|
|
44
cdp/io/io.go
44
cdp/io/io.go
|
@ -11,30 +11,10 @@ package io
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// ReadParams read a chunk of the stream.
|
||||
type ReadParams struct {
|
||||
Handle StreamHandle `json:"handle"` // Handle of the stream to read.
|
||||
|
@ -77,7 +57,7 @@ type ReadReturns struct {
|
|||
// returns:
|
||||
// data - Data that were read.
|
||||
// eof - Set if the end-of-file condition occured while reading.
|
||||
func (p *ReadParams) Do(ctxt context.Context, h FrameHandler) (data string, eof bool, err error) {
|
||||
func (p *ReadParams) Do(ctxt context.Context, h cdp.FrameHandler) (data string, eof bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -89,13 +69,13 @@ func (p *ReadParams) Do(ctxt context.Context, h FrameHandler) (data string, eof
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIORead, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIORead, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", false, ErrChannelClosed
|
||||
return "", false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -104,7 +84,7 @@ func (p *ReadParams) Do(ctxt context.Context, h FrameHandler) (data string, eof
|
|||
var r ReadReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", false, ErrInvalidResult
|
||||
return "", false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Data, r.EOF, nil
|
||||
|
@ -114,10 +94,10 @@ func (p *ReadParams) Do(ctxt context.Context, h FrameHandler) (data string, eof
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", false, ErrContextDone
|
||||
return "", false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", false, ErrUnknownResult
|
||||
return "", false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CloseParams close the stream, discard any temporary backing storage.
|
||||
|
@ -136,7 +116,7 @@ func Close(handle StreamHandle) *CloseParams {
|
|||
}
|
||||
|
||||
// Do executes IO.close.
|
||||
func (p *CloseParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *CloseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -148,13 +128,13 @@ func (p *CloseParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandIOClose, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandIOClose, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -166,8 +146,8 @@ func (p *CloseParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -2,30 +2,7 @@ package io
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// StreamHandle [no description].
|
||||
type StreamHandle string
|
||||
|
||||
// String returns the StreamHandle as string value.
|
||||
|
|
|
@ -3,41 +3,23 @@ package layertree
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/dom"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventLayerTreeDidChange [no description].
|
||||
type EventLayerTreeDidChange struct {
|
||||
Layers []*Layer `json:"layers,omitempty"` // Layer tree, absent if not in the comspositing mode.
|
||||
}
|
||||
|
||||
// EventLayerPainted [no description].
|
||||
type EventLayerPainted struct {
|
||||
LayerID LayerID `json:"layerId,omitempty"` // The id of the painted layer.
|
||||
Clip *dom.Rect `json:"clip,omitempty"` // Clip rectangle.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventLayerTreeLayerTreeDidChange,
|
||||
EventLayerTreeLayerPainted,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventLayerTreeLayerTreeDidChange,
|
||||
cdp.EventLayerTreeLayerPainted,
|
||||
}
|
||||
|
|
|
@ -9,31 +9,11 @@ package layertree
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/dom"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables compositing tree inspection.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -43,19 +23,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes LayerTree.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -67,10 +47,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables compositing tree inspection.
|
||||
|
@ -82,19 +62,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes LayerTree.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -106,10 +86,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CompositingReasonsParams provides the reasons why the given layer was
|
||||
|
@ -122,10 +102,10 @@ type CompositingReasonsParams struct {
|
|||
// composited.
|
||||
//
|
||||
// parameters:
|
||||
// layerId - The id of the layer for which we want to get the reasons it was composited.
|
||||
func CompositingReasons(layerId LayerID) *CompositingReasonsParams {
|
||||
// layerID - The id of the layer for which we want to get the reasons it was composited.
|
||||
func CompositingReasons(layerID LayerID) *CompositingReasonsParams {
|
||||
return &CompositingReasonsParams{
|
||||
LayerID: layerId,
|
||||
LayerID: layerID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +118,7 @@ type CompositingReasonsReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
|
||||
func (p *CompositingReasonsParams) Do(ctxt context.Context, h FrameHandler) (compositingReasons []string, err error) {
|
||||
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.FrameHandler) (compositingReasons []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -150,13 +130,13 @@ func (p *CompositingReasonsParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeCompositingReasons, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeCompositingReasons, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -165,7 +145,7 @@ func (p *CompositingReasonsParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
var r CompositingReasonsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.CompositingReasons, nil
|
||||
|
@ -175,10 +155,10 @@ func (p *CompositingReasonsParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// MakeSnapshotParams returns the layer snapshot identifier.
|
||||
|
@ -189,10 +169,10 @@ type MakeSnapshotParams struct {
|
|||
// MakeSnapshot returns the layer snapshot identifier.
|
||||
//
|
||||
// parameters:
|
||||
// layerId - The id of the layer.
|
||||
func MakeSnapshot(layerId LayerID) *MakeSnapshotParams {
|
||||
// layerID - The id of the layer.
|
||||
func MakeSnapshot(layerID LayerID) *MakeSnapshotParams {
|
||||
return &MakeSnapshotParams{
|
||||
LayerID: layerId,
|
||||
LayerID: layerID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,8 +184,8 @@ type MakeSnapshotReturns struct {
|
|||
// Do executes LayerTree.makeSnapshot.
|
||||
//
|
||||
// returns:
|
||||
// snapshotId - The id of the layer snapshot.
|
||||
func (p *MakeSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotId SnapshotID, err error) {
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snapshotID SnapshotID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -217,13 +197,13 @@ func (p *MakeSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeMakeSnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeMakeSnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -232,7 +212,7 @@ func (p *MakeSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
var r MakeSnapshotReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.SnapshotID, nil
|
||||
|
@ -242,10 +222,10 @@ func (p *MakeSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// LoadSnapshotParams returns the snapshot identifier.
|
||||
|
@ -271,8 +251,8 @@ type LoadSnapshotReturns struct {
|
|||
// Do executes LayerTree.loadSnapshot.
|
||||
//
|
||||
// returns:
|
||||
// snapshotId - The id of the snapshot.
|
||||
func (p *LoadSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotId SnapshotID, err error) {
|
||||
// snapshotID - The id of the snapshot.
|
||||
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snapshotID SnapshotID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -284,13 +264,13 @@ func (p *LoadSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeLoadSnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeLoadSnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -299,7 +279,7 @@ func (p *LoadSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
var r LoadSnapshotReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.SnapshotID, nil
|
||||
|
@ -309,10 +289,10 @@ func (p *LoadSnapshotParams) Do(ctxt context.Context, h FrameHandler) (snapshotI
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReleaseSnapshotParams releases layer snapshot captured by the back-end.
|
||||
|
@ -323,15 +303,15 @@ type ReleaseSnapshotParams struct {
|
|||
// ReleaseSnapshot releases layer snapshot captured by the back-end.
|
||||
//
|
||||
// parameters:
|
||||
// snapshotId - The id of the layer snapshot.
|
||||
func ReleaseSnapshot(snapshotId SnapshotID) *ReleaseSnapshotParams {
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func ReleaseSnapshot(snapshotID SnapshotID) *ReleaseSnapshotParams {
|
||||
return &ReleaseSnapshotParams{
|
||||
SnapshotID: snapshotId,
|
||||
SnapshotID: snapshotID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes LayerTree.releaseSnapshot.
|
||||
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -343,13 +323,13 @@ func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeReleaseSnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -361,12 +341,13 @@ func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h FrameHandler) (err er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ProfileSnapshotParams [no description].
|
||||
type ProfileSnapshotParams struct {
|
||||
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
|
||||
MinRepeatCount int64 `json:"minRepeatCount,omitempty"` // The maximum number of times to replay the snapshot (1, if not specified).
|
||||
|
@ -374,11 +355,13 @@ type ProfileSnapshotParams struct {
|
|||
ClipRect *dom.Rect `json:"clipRect,omitempty"` // The clip rectangle to apply when replaying the snapshot.
|
||||
}
|
||||
|
||||
// ProfileSnapshot [no description].
|
||||
//
|
||||
// parameters:
|
||||
// snapshotId - The id of the layer snapshot.
|
||||
func ProfileSnapshot(snapshotId SnapshotID) *ProfileSnapshotParams {
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func ProfileSnapshot(snapshotID SnapshotID) *ProfileSnapshotParams {
|
||||
return &ProfileSnapshotParams{
|
||||
SnapshotID: snapshotId,
|
||||
SnapshotID: snapshotID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +393,7 @@ type ProfileSnapshotReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// timings - The array of paint profiles, one per run.
|
||||
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h FrameHandler) (timings []PaintProfile, err error) {
|
||||
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (timings []PaintProfile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -422,13 +405,13 @@ func (p *ProfileSnapshotParams) Do(ctxt context.Context, h FrameHandler) (timing
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeProfileSnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeProfileSnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -437,7 +420,7 @@ func (p *ProfileSnapshotParams) Do(ctxt context.Context, h FrameHandler) (timing
|
|||
var r ProfileSnapshotReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Timings, nil
|
||||
|
@ -447,10 +430,10 @@ func (p *ProfileSnapshotParams) Do(ctxt context.Context, h FrameHandler) (timing
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReplaySnapshotParams replays the layer snapshot and returns the resulting
|
||||
|
@ -466,10 +449,10 @@ type ReplaySnapshotParams struct {
|
|||
// bitmap.
|
||||
//
|
||||
// parameters:
|
||||
// snapshotId - The id of the layer snapshot.
|
||||
func ReplaySnapshot(snapshotId SnapshotID) *ReplaySnapshotParams {
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func ReplaySnapshot(snapshotID SnapshotID) *ReplaySnapshotParams {
|
||||
return &ReplaySnapshotParams{
|
||||
SnapshotID: snapshotId,
|
||||
SnapshotID: snapshotID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,7 +485,7 @@ type ReplaySnapshotReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// dataURL - A data: URL for resulting image.
|
||||
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h FrameHandler) (dataURL string, err error) {
|
||||
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (dataURL string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -514,13 +497,13 @@ func (p *ReplaySnapshotParams) Do(ctxt context.Context, h FrameHandler) (dataURL
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeReplaySnapshot, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeReplaySnapshot, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -529,7 +512,7 @@ func (p *ReplaySnapshotParams) Do(ctxt context.Context, h FrameHandler) (dataURL
|
|||
var r ReplaySnapshotReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.DataURL, nil
|
||||
|
@ -539,10 +522,10 @@ func (p *ReplaySnapshotParams) Do(ctxt context.Context, h FrameHandler) (dataURL
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SnapshotCommandLogParams replays the layer snapshot and returns canvas
|
||||
|
@ -554,10 +537,10 @@ type SnapshotCommandLogParams struct {
|
|||
// SnapshotCommandLog replays the layer snapshot and returns canvas log.
|
||||
//
|
||||
// parameters:
|
||||
// snapshotId - The id of the layer snapshot.
|
||||
func SnapshotCommandLog(snapshotId SnapshotID) *SnapshotCommandLogParams {
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func SnapshotCommandLog(snapshotID SnapshotID) *SnapshotCommandLogParams {
|
||||
return &SnapshotCommandLogParams{
|
||||
SnapshotID: snapshotId,
|
||||
SnapshotID: snapshotID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,7 +553,7 @@ type SnapshotCommandLogReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// commandLog - The array of canvas function calls.
|
||||
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h FrameHandler) (commandLog []easyjson.RawMessage, err error) {
|
||||
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.FrameHandler) (commandLog []easyjson.RawMessage, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -582,13 +565,13 @@ func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLayerTreeSnapshotCommandLog, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeSnapshotCommandLog, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -597,7 +580,7 @@ func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
var r SnapshotCommandLogReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.CommandLog, nil
|
||||
|
@ -607,8 +590,8 @@ func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h FrameHandler) (com
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -5,33 +5,13 @@ package layertree
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/dom"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// LayerID unique Layer identifier.
|
||||
type LayerID string
|
||||
|
||||
|
@ -66,7 +46,7 @@ type PictureTile struct {
|
|||
type Layer struct {
|
||||
LayerID LayerID `json:"layerId,omitempty"` // The unique id for this layer.
|
||||
ParentLayerID LayerID `json:"parentLayerId,omitempty"` // The id of parent (not present for root).
|
||||
BackendNodeID BackendNodeID `json:"backendNodeId,omitempty"` // The backend id for the node associated with this layer.
|
||||
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // The backend id for the node associated with this layer.
|
||||
OffsetX float64 `json:"offsetX,omitempty"` // Offset from parent layer, X coordinate.
|
||||
OffsetY float64 `json:"offsetY,omitempty"` // Offset from parent layer, Y coordinate.
|
||||
Width float64 `json:"width,omitempty"` // Layer width.
|
||||
|
|
|
@ -264,7 +264,88 @@ func (v *StartViolationsReportParams) UnmarshalJSON(data []byte) error {
|
|||
func (v *StartViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *LogEntry) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *EventEntryAdded) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "entry":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.Entry = nil
|
||||
} else {
|
||||
if out.Entry == nil {
|
||||
out.Entry = new(Entry)
|
||||
}
|
||||
(*out.Entry).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in EventEntryAdded) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Entry != nil {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"entry\":")
|
||||
if in.Entry == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.Entry).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *Entry) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -319,7 +400,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *Lo
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in LogEntry) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in Entry) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -403,107 +484,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in L
|
|||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v LogEntry) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v LogEntry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *LogEntry) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *LogEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *EventEntryAdded) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "entry":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.Entry = nil
|
||||
} else {
|
||||
if out.Entry == nil {
|
||||
out.Entry = new(LogEntry)
|
||||
}
|
||||
(*out.Entry).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in EventEntryAdded) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Entry != nil {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"entry\":")
|
||||
if in.Entry == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.Entry).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
||||
func (v Entry) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v Entry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
||||
func (v *Entry) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(in *jlexer.Lexer, out *EnableParams) {
|
||||
|
|
|
@ -3,35 +3,15 @@ package log
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventEntryAdded issued when new message was logged.
|
||||
type EventEntryAdded struct {
|
||||
Entry *LogEntry `json:"entry,omitempty"` // The entry.
|
||||
Entry *Entry `json:"entry,omitempty"` // The entry.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventLogEntryAdded,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventLogEntryAdded,
|
||||
}
|
||||
|
|
|
@ -11,30 +11,10 @@ package log
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables log domain, sends the entries collected so far to the
|
||||
// client by means of the entryAdded notification.
|
||||
type EnableParams struct{}
|
||||
|
@ -46,19 +26,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Log.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLogEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLogEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -70,10 +50,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables log domain, prevents further log entries from being
|
||||
|
@ -87,19 +67,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Log.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLogDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLogDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -111,10 +91,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearParams clears the log.
|
||||
|
@ -126,19 +106,19 @@ func Clear() *ClearParams {
|
|||
}
|
||||
|
||||
// Do executes Log.clear.
|
||||
func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLogClear, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLogClear, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -150,10 +130,10 @@ func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StartViolationsReportParams start violation reporting.
|
||||
|
@ -172,7 +152,7 @@ func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportPar
|
|||
}
|
||||
|
||||
// Do executes Log.startViolationsReport.
|
||||
func (p *StartViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -184,13 +164,13 @@ func (p *StartViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLogStartViolationsReport, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandLogStartViolationsReport, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -202,10 +182,10 @@ func (p *StartViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StopViolationsReportParams stop violation reporting.
|
||||
|
@ -217,19 +197,19 @@ func StopViolationsReport() *StopViolationsReportParams {
|
|||
}
|
||||
|
||||
// Do executes Log.stopViolationsReport.
|
||||
func (p *StopViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandLogStopViolationsReport, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandLogStopViolationsReport, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -241,8 +221,8 @@ func (p *StopViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package log
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/network"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
|
@ -13,32 +13,12 @@ import (
|
|||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// LogEntry log entry.
|
||||
type LogEntry struct {
|
||||
// Entry log entry.
|
||||
type Entry struct {
|
||||
Source Source `json:"source,omitempty"` // Log entry source.
|
||||
Level Level `json:"level,omitempty"` // Log entry severity.
|
||||
Text string `json:"text,omitempty"` // Logged text.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added.
|
||||
URL string `json:"url,omitempty"` // URL of the resource if known.
|
||||
LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the resource.
|
||||
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace.
|
||||
|
|
|
@ -9,32 +9,14 @@ package memory
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GetDOMCountersParams [no description].
|
||||
type GetDOMCountersParams struct{}
|
||||
|
||||
// GetDOMCounters [no description].
|
||||
func GetDOMCounters() *GetDOMCountersParams {
|
||||
return &GetDOMCountersParams{}
|
||||
}
|
||||
|
@ -52,19 +34,19 @@ type GetDOMCountersReturns struct {
|
|||
// documents
|
||||
// nodes
|
||||
// jsEventListeners
|
||||
func (p *GetDOMCountersParams) Do(ctxt context.Context, h FrameHandler) (documents int64, nodes int64, jsEventListeners int64, err error) {
|
||||
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.FrameHandler) (documents int64, nodes int64, jsEventListeners int64, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandMemoryGetDOMCounters, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return 0, 0, 0, ErrChannelClosed
|
||||
return 0, 0, 0, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -73,7 +55,7 @@ func (p *GetDOMCountersParams) Do(ctxt context.Context, h FrameHandler) (documen
|
|||
var r GetDOMCountersReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return 0, 0, 0, ErrInvalidResult
|
||||
return 0, 0, 0, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Documents, r.Nodes, r.JsEventListeners, nil
|
||||
|
@ -83,10 +65,10 @@ func (p *GetDOMCountersParams) Do(ctxt context.Context, h FrameHandler) (documen
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return 0, 0, 0, ErrContextDone
|
||||
return 0, 0, 0, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return 0, 0, 0, ErrUnknownResult
|
||||
return 0, 0, 0, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetPressureNotificationsSuppressedParams enable/disable suppressing memory
|
||||
|
@ -107,7 +89,7 @@ func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificatio
|
|||
}
|
||||
|
||||
// Do executes Memory.setPressureNotificationsSuppressed.
|
||||
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -119,13 +101,13 @@ func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h Fr
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandMemorySetPressureNotificationsSuppressed, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -137,10 +119,10 @@ func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h Fr
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SimulatePressureNotificationParams simulate a memory pressure notification
|
||||
|
@ -161,7 +143,7 @@ func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotifica
|
|||
}
|
||||
|
||||
// Do executes Memory.simulatePressureNotification.
|
||||
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -173,13 +155,13 @@ func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandMemorySimulatePressureNotification, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -191,8 +173,8 @@ func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
package memory
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// PressureLevel memory pressure level.
|
||||
type PressureLevel string
|
||||
|
|
|
@ -3,47 +3,27 @@ package network
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/page"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventResourceChangedPriority fired when resource loading priority is
|
||||
// changed.
|
||||
type EventResourceChangedPriority struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
NewPriority ResourcePriority `json:"newPriority,omitempty"` // New priority
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
}
|
||||
|
||||
// EventRequestWillBeSent fired when page is about to send HTTP request.
|
||||
type EventRequestWillBeSent struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
LoaderID LoaderID `json:"loaderId,omitempty"` // Loader identifier.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier.
|
||||
DocumentURL string `json:"documentURL,omitempty"` // URL of the document this request is loaded for.
|
||||
Request *Request `json:"request,omitempty"` // Request data.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
WallTime Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
WallTime cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
|
||||
Initiator *Initiator `json:"initiator,omitempty"` // Request initiator.
|
||||
RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data.
|
||||
Type page.ResourceType `json:"type,omitempty"` // Type of this resource.
|
||||
|
@ -57,9 +37,9 @@ type EventRequestServedFromCache struct {
|
|||
// EventResponseReceived fired when HTTP response is available.
|
||||
type EventResponseReceived struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
LoaderID LoaderID `json:"loaderId,omitempty"` // Loader identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
|
||||
LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Type page.ResourceType `json:"type,omitempty"` // Resource type.
|
||||
Response *Response `json:"response,omitempty"` // Response data.
|
||||
}
|
||||
|
@ -67,7 +47,7 @@ type EventResponseReceived struct {
|
|||
// EventDataReceived fired when data chunk was received over the network.
|
||||
type EventDataReceived struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
DataLength int64 `json:"dataLength,omitempty"` // Data chunk length.
|
||||
EncodedDataLength int64 `json:"encodedDataLength,omitempty"` // Actual bytes received (might be less than dataLength for compressed encodings).
|
||||
}
|
||||
|
@ -75,14 +55,14 @@ type EventDataReceived struct {
|
|||
// EventLoadingFinished fired when HTTP request has finished loading.
|
||||
type EventLoadingFinished struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request.
|
||||
}
|
||||
|
||||
// EventLoadingFailed fired when HTTP request has failed to load.
|
||||
type EventLoadingFailed struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Type page.ResourceType `json:"type,omitempty"` // Resource type.
|
||||
ErrorText string `json:"errorText,omitempty"` // User friendly error message.
|
||||
Canceled bool `json:"canceled,omitempty"` // True if loading was canceled.
|
||||
|
@ -93,8 +73,8 @@ type EventLoadingFailed struct {
|
|||
// initiate handshake.
|
||||
type EventWebSocketWillSendHandshakeRequest struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
WallTime Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
WallTime cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
|
||||
Request *WebSocketRequest `json:"request,omitempty"` // WebSocket request data.
|
||||
}
|
||||
|
||||
|
@ -102,7 +82,7 @@ type EventWebSocketWillSendHandshakeRequest struct {
|
|||
// response becomes available.
|
||||
type EventWebSocketHandshakeResponseReceived struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Response *WebSocketResponse `json:"response,omitempty"` // WebSocket response data.
|
||||
}
|
||||
|
||||
|
@ -116,27 +96,27 @@ type EventWebSocketCreated struct {
|
|||
// EventWebSocketClosed fired when WebSocket is closed.
|
||||
type EventWebSocketClosed struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
}
|
||||
|
||||
// EventWebSocketFrameReceived fired when WebSocket frame is received.
|
||||
type EventWebSocketFrameReceived struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data.
|
||||
}
|
||||
|
||||
// EventWebSocketFrameError fired when WebSocket frame error occurs.
|
||||
type EventWebSocketFrameError struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
ErrorMessage string `json:"errorMessage,omitempty"` // WebSocket frame error message.
|
||||
}
|
||||
|
||||
// EventWebSocketFrameSent fired when WebSocket frame is sent.
|
||||
type EventWebSocketFrameSent struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data.
|
||||
}
|
||||
|
||||
|
@ -144,27 +124,27 @@ type EventWebSocketFrameSent struct {
|
|||
// received.
|
||||
type EventEventSourceMessageReceived struct {
|
||||
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
|
||||
EventName string `json:"eventName,omitempty"` // Message type.
|
||||
EventID string `json:"eventId,omitempty"` // Message identifier.
|
||||
Data string `json:"data,omitempty"` // Message content.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventNetworkResourceChangedPriority,
|
||||
EventNetworkRequestWillBeSent,
|
||||
EventNetworkRequestServedFromCache,
|
||||
EventNetworkResponseReceived,
|
||||
EventNetworkDataReceived,
|
||||
EventNetworkLoadingFinished,
|
||||
EventNetworkLoadingFailed,
|
||||
EventNetworkWebSocketWillSendHandshakeRequest,
|
||||
EventNetworkWebSocketHandshakeResponseReceived,
|
||||
EventNetworkWebSocketCreated,
|
||||
EventNetworkWebSocketClosed,
|
||||
EventNetworkWebSocketFrameReceived,
|
||||
EventNetworkWebSocketFrameError,
|
||||
EventNetworkWebSocketFrameSent,
|
||||
EventNetworkEventSourceMessageReceived,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventNetworkResourceChangedPriority,
|
||||
cdp.EventNetworkRequestWillBeSent,
|
||||
cdp.EventNetworkRequestServedFromCache,
|
||||
cdp.EventNetworkResponseReceived,
|
||||
cdp.EventNetworkDataReceived,
|
||||
cdp.EventNetworkLoadingFinished,
|
||||
cdp.EventNetworkLoadingFailed,
|
||||
cdp.EventNetworkWebSocketWillSendHandshakeRequest,
|
||||
cdp.EventNetworkWebSocketHandshakeResponseReceived,
|
||||
cdp.EventNetworkWebSocketCreated,
|
||||
cdp.EventNetworkWebSocketClosed,
|
||||
cdp.EventNetworkWebSocketFrameReceived,
|
||||
cdp.EventNetworkWebSocketFrameError,
|
||||
cdp.EventNetworkWebSocketFrameSent,
|
||||
cdp.EventNetworkEventSourceMessageReceived,
|
||||
}
|
||||
|
|
|
@ -14,30 +14,10 @@ import (
|
|||
"context"
|
||||
"encoding/base64"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables network tracking, network events will now be
|
||||
// delivered to the client.
|
||||
type EnableParams struct {
|
||||
|
@ -68,7 +48,7 @@ func (p EnableParams) WithMaxResourceBufferSize(maxResourceBufferSize int64) *En
|
|||
}
|
||||
|
||||
// Do executes Network.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -80,13 +60,13 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkEnable, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkEnable, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -98,10 +78,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables network tracking, prevents network events from
|
||||
|
@ -115,19 +95,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Network.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -139,10 +119,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetUserAgentOverrideParams allows overriding user agent with the given
|
||||
|
@ -162,7 +142,7 @@ func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams {
|
|||
}
|
||||
|
||||
// Do executes Network.setUserAgentOverride.
|
||||
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -174,13 +154,13 @@ func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetUserAgentOverride, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetUserAgentOverride, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -192,10 +172,10 @@ func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h FrameHandler) (e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
|
||||
|
@ -216,7 +196,7 @@ func SetExtraHTTPHeaders(headers *Headers) *SetExtraHTTPHeadersParams {
|
|||
}
|
||||
|
||||
// Do executes Network.setExtraHTTPHeaders.
|
||||
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -228,13 +208,13 @@ func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetExtraHTTPHeaders, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetExtraHTTPHeaders, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -246,10 +226,10 @@ func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetResponseBodyParams returns content served for the given request.
|
||||
|
@ -260,10 +240,10 @@ type GetResponseBodyParams struct {
|
|||
// GetResponseBody returns content served for the given request.
|
||||
//
|
||||
// parameters:
|
||||
// requestId - Identifier of the network request to get content for.
|
||||
func GetResponseBody(requestId RequestID) *GetResponseBodyParams {
|
||||
// requestID - Identifier of the network request to get content for.
|
||||
func GetResponseBody(requestID RequestID) *GetResponseBodyParams {
|
||||
return &GetResponseBodyParams{
|
||||
RequestID: requestId,
|
||||
RequestID: requestID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +257,7 @@ type GetResponseBodyReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// body - Response body.
|
||||
func (p *GetResponseBodyParams) Do(ctxt context.Context, h FrameHandler) (body []byte, err error) {
|
||||
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.FrameHandler) (body []byte, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -289,13 +269,13 @@ func (p *GetResponseBodyParams) Do(ctxt context.Context, h FrameHandler) (body [
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkGetResponseBody, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -304,7 +284,7 @@ func (p *GetResponseBodyParams) Do(ctxt context.Context, h FrameHandler) (body [
|
|||
var r GetResponseBodyReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
// decode
|
||||
|
@ -325,10 +305,10 @@ func (p *GetResponseBodyParams) Do(ctxt context.Context, h FrameHandler) (body [
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// AddBlockedURLParams blocks specific URL from loading.
|
||||
|
@ -347,7 +327,7 @@ func AddBlockedURL(url string) *AddBlockedURLParams {
|
|||
}
|
||||
|
||||
// Do executes Network.addBlockedURL.
|
||||
func (p *AddBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -359,13 +339,13 @@ func (p *AddBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkAddBlockedURL, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkAddBlockedURL, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -377,10 +357,10 @@ func (p *AddBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RemoveBlockedURLParams cancels blocking of a specific URL from loading.
|
||||
|
@ -399,7 +379,7 @@ func RemoveBlockedURL(url string) *RemoveBlockedURLParams {
|
|||
}
|
||||
|
||||
// Do executes Network.removeBlockedURL.
|
||||
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -411,13 +391,13 @@ func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkRemoveBlockedURL, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkRemoveBlockedURL, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -429,10 +409,10 @@ func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReplayXHRParams this method sends a new XMLHttpRequest which is identical
|
||||
|
@ -449,15 +429,15 @@ type ReplayXHRParams struct {
|
|||
// password.
|
||||
//
|
||||
// parameters:
|
||||
// requestId - Identifier of XHR to replay.
|
||||
func ReplayXHR(requestId RequestID) *ReplayXHRParams {
|
||||
// requestID - Identifier of XHR to replay.
|
||||
func ReplayXHR(requestID RequestID) *ReplayXHRParams {
|
||||
return &ReplayXHRParams{
|
||||
RequestID: requestId,
|
||||
RequestID: requestID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Network.replayXHR.
|
||||
func (p *ReplayXHRParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -469,13 +449,13 @@ func (p *ReplayXHRParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkReplayXHR, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkReplayXHR, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -487,10 +467,10 @@ func (p *ReplayXHRParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetMonitoringXHREnabledParams toggles monitoring of XMLHttpRequest. If
|
||||
|
@ -511,7 +491,7 @@ func SetMonitoringXHREnabled(enabled bool) *SetMonitoringXHREnabledParams {
|
|||
}
|
||||
|
||||
// Do executes Network.setMonitoringXHREnabled.
|
||||
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -523,13 +503,13 @@ func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetMonitoringXHREnabled, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetMonitoringXHREnabled, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -541,10 +521,10 @@ func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CanClearBrowserCacheParams tells whether clearing browser cache is
|
||||
|
@ -565,19 +545,19 @@ type CanClearBrowserCacheReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// result - True if browser cache can be cleared.
|
||||
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h FrameHandler) (result bool, err error) {
|
||||
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkCanClearBrowserCache, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCache, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -586,7 +566,7 @@ func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h FrameHandler) (r
|
|||
var r CanClearBrowserCacheReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
@ -596,10 +576,10 @@ func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h FrameHandler) (r
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearBrowserCacheParams clears browser cache.
|
||||
|
@ -611,19 +591,19 @@ func ClearBrowserCache() *ClearBrowserCacheParams {
|
|||
}
|
||||
|
||||
// Do executes Network.clearBrowserCache.
|
||||
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkClearBrowserCache, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkClearBrowserCache, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -635,10 +615,10 @@ func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CanClearBrowserCookiesParams tells whether clearing browser cookies is
|
||||
|
@ -660,19 +640,19 @@ type CanClearBrowserCookiesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// result - True if browser cookies can be cleared.
|
||||
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler) (result bool, err error) {
|
||||
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkCanClearBrowserCookies, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCookies, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -681,7 +661,7 @@ func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler)
|
|||
var r CanClearBrowserCookiesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
@ -691,10 +671,10 @@ func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ClearBrowserCookiesParams clears browser cookies.
|
||||
|
@ -706,19 +686,19 @@ func ClearBrowserCookies() *ClearBrowserCookiesParams {
|
|||
}
|
||||
|
||||
// Do executes Network.clearBrowserCookies.
|
||||
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkClearBrowserCookies, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkClearBrowserCookies, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -730,10 +710,10 @@ func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetCookiesParams returns all browser cookies for the current URL.
|
||||
|
@ -767,7 +747,7 @@ type GetCookiesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// cookies - Array of cookie objects.
|
||||
func (p *GetCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*Cookie, err error) {
|
||||
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cookies []*Cookie, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -779,13 +759,13 @@ func (p *GetCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkGetCookies, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetCookies, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -794,7 +774,7 @@ func (p *GetCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*
|
|||
var r GetCookiesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Cookies, nil
|
||||
|
@ -804,10 +784,10 @@ func (p *GetCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetAllCookiesParams returns all browser cookies. Depending on the backend
|
||||
|
@ -829,19 +809,19 @@ type GetAllCookiesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// cookies - Array of cookie objects.
|
||||
func (p *GetAllCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*Cookie, err error) {
|
||||
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cookies []*Cookie, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkGetAllCookies, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -850,7 +830,7 @@ func (p *GetAllCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies
|
|||
var r GetAllCookiesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Cookies, nil
|
||||
|
@ -860,10 +840,10 @@ func (p *GetAllCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DeleteCookieParams deletes browser cookie with given name, domain and
|
||||
|
@ -886,7 +866,7 @@ func DeleteCookie(cookieName string, url string) *DeleteCookieParams {
|
|||
}
|
||||
|
||||
// Do executes Network.deleteCookie.
|
||||
func (p *DeleteCookieParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -898,13 +878,13 @@ func (p *DeleteCookieParams) Do(ctxt context.Context, h FrameHandler) (err error
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkDeleteCookie, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkDeleteCookie, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -916,10 +896,10 @@ func (p *DeleteCookieParams) Do(ctxt context.Context, h FrameHandler) (err error
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetCookieParams sets a cookie with the given cookie data; may overwrite
|
||||
|
@ -933,7 +913,7 @@ type SetCookieParams struct {
|
|||
Secure bool `json:"secure,omitempty"` // Defaults ot false.
|
||||
HTTPOnly bool `json:"httpOnly,omitempty"` // Defaults to false.
|
||||
SameSite CookieSameSite `json:"sameSite,omitempty"` // Defaults to browser default behavior.
|
||||
ExpirationDate Timestamp `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
|
||||
ExpirationDate cdp.Timestamp `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
|
||||
}
|
||||
|
||||
// SetCookie sets a cookie with the given cookie data; may overwrite
|
||||
|
@ -982,7 +962,7 @@ func (p SetCookieParams) WithSameSite(sameSite CookieSameSite) *SetCookieParams
|
|||
}
|
||||
|
||||
// WithExpirationDate if omitted, the cookie becomes a session cookie.
|
||||
func (p SetCookieParams) WithExpirationDate(expirationDate Timestamp) *SetCookieParams {
|
||||
func (p SetCookieParams) WithExpirationDate(expirationDate cdp.Timestamp) *SetCookieParams {
|
||||
p.ExpirationDate = expirationDate
|
||||
return &p
|
||||
}
|
||||
|
@ -996,7 +976,7 @@ type SetCookieReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// success - True if successfully set cookie.
|
||||
func (p *SetCookieParams) Do(ctxt context.Context, h FrameHandler) (success bool, err error) {
|
||||
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1008,13 +988,13 @@ func (p *SetCookieParams) Do(ctxt context.Context, h FrameHandler) (success bool
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetCookie, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetCookie, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1023,7 +1003,7 @@ func (p *SetCookieParams) Do(ctxt context.Context, h FrameHandler) (success bool
|
|||
var r SetCookieReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Success, nil
|
||||
|
@ -1033,10 +1013,10 @@ func (p *SetCookieParams) Do(ctxt context.Context, h FrameHandler) (success bool
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CanEmulateNetworkConditionsParams tells whether emulation of network
|
||||
|
@ -1058,19 +1038,19 @@ type CanEmulateNetworkConditionsReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// result - True if emulation of network conditions is supported.
|
||||
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHandler) (result bool, err error) {
|
||||
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkCanEmulateNetworkConditions, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanEmulateNetworkConditions, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1079,7 +1059,7 @@ func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHand
|
|||
var r CanEmulateNetworkConditionsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
@ -1089,10 +1069,10 @@ func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHand
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// EmulateNetworkConditionsParams activates emulation of network conditions.
|
||||
|
@ -1127,7 +1107,7 @@ func (p EmulateNetworkConditionsParams) WithConnectionType(connectionType Connec
|
|||
}
|
||||
|
||||
// Do executes Network.emulateNetworkConditions.
|
||||
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1139,13 +1119,13 @@ func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkEmulateNetworkConditions, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkEmulateNetworkConditions, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1157,10 +1137,10 @@ func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetCacheDisabledParams toggles ignoring cache for each request. If true,
|
||||
|
@ -1181,7 +1161,7 @@ func SetCacheDisabled(cacheDisabled bool) *SetCacheDisabledParams {
|
|||
}
|
||||
|
||||
// Do executes Network.setCacheDisabled.
|
||||
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1193,13 +1173,13 @@ func (p *SetCacheDisabledParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetCacheDisabled, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetCacheDisabled, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1211,10 +1191,10 @@ func (p *SetCacheDisabledParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetBypassServiceWorkerParams toggles ignoring of service worker for each
|
||||
|
@ -1235,7 +1215,7 @@ func SetBypassServiceWorker(bypass bool) *SetBypassServiceWorkerParams {
|
|||
}
|
||||
|
||||
// Do executes Network.setBypassServiceWorker.
|
||||
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1247,13 +1227,13 @@ func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetBypassServiceWorker, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetBypassServiceWorker, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1265,10 +1245,10 @@ func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetDataSizeLimitsForTestParams for testing.
|
||||
|
@ -1290,7 +1270,7 @@ func SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) *SetDat
|
|||
}
|
||||
|
||||
// Do executes Network.setDataSizeLimitsForTest.
|
||||
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1302,13 +1282,13 @@ func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkSetDataSizeLimitsForTest, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetDataSizeLimitsForTest, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1320,10 +1300,10 @@ func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetCertificateParams returns the DER-encoded certificate.
|
||||
|
@ -1350,7 +1330,7 @@ type GetCertificateReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// tableNames
|
||||
func (p *GetCertificateParams) Do(ctxt context.Context, h FrameHandler) (tableNames []string, err error) {
|
||||
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.FrameHandler) (tableNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -1362,13 +1342,13 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h FrameHandler) (tableNa
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandNetworkGetCertificate, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetCertificate, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -1377,7 +1357,7 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h FrameHandler) (tableNa
|
|||
var r GetCertificateReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.TableNames, nil
|
||||
|
@ -1387,8 +1367,8 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h FrameHandler) (tableNa
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package network
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/page"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/knq/chromedp/cdp/security"
|
||||
|
@ -14,26 +14,6 @@ import (
|
|||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// RequestID unique request identifier.
|
||||
type RequestID string
|
||||
|
||||
|
@ -240,7 +220,7 @@ type SignedCertificateTimestamp struct {
|
|||
Origin string `json:"origin,omitempty"` // Origin.
|
||||
LogDescription string `json:"logDescription,omitempty"` // Log name / description.
|
||||
LogID string `json:"logId,omitempty"` // Log ID.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Issuance date.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Issuance date.
|
||||
HashAlgorithm string `json:"hashAlgorithm,omitempty"` // Hash algorithm.
|
||||
SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"` // Signature algorithm.
|
||||
SignatureData string `json:"signatureData,omitempty"` // Signature data.
|
||||
|
@ -257,8 +237,8 @@ type SecurityDetails struct {
|
|||
SubjectName string `json:"subjectName,omitempty"` // Certificate subject name.
|
||||
SanList []string `json:"sanList,omitempty"` // Subject Alternative Name (SAN) DNS names and IP addresses.
|
||||
Issuer string `json:"issuer,omitempty"` // Name of the issuing CA.
|
||||
ValidFrom Timestamp `json:"validFrom,omitempty"` // Certificate valid from date.
|
||||
ValidTo Timestamp `json:"validTo,omitempty"` // Certificate valid to (expiration) date
|
||||
ValidFrom cdp.Timestamp `json:"validFrom,omitempty"` // Certificate valid from date.
|
||||
ValidTo cdp.Timestamp `json:"validTo,omitempty"` // Certificate valid to (expiration) date
|
||||
SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList,omitempty"` // List of signed certificate timestamps (SCTs).
|
||||
}
|
||||
|
||||
|
@ -335,7 +315,7 @@ type Response struct {
|
|||
EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request so far.
|
||||
Timing *ResourceTiming `json:"timing,omitempty"` // Timing information for the given request.
|
||||
Protocol string `json:"protocol,omitempty"` // Protocol used to fetch this request.
|
||||
SecurityState security.SecurityState `json:"securityState,omitempty"` // Security state of the request resource.
|
||||
SecurityState security.State `json:"securityState,omitempty"` // Security state of the request resource.
|
||||
SecurityDetails *SecurityDetails `json:"securityDetails,omitempty"` // Security details for the request.
|
||||
}
|
||||
|
||||
|
|
|
@ -3,77 +3,60 @@ package page
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDomContentEventFired [no description].
|
||||
type EventDomContentEventFired struct {
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"`
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"`
|
||||
}
|
||||
|
||||
// EventLoadEventFired [no description].
|
||||
type EventLoadEventFired struct {
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"`
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"`
|
||||
}
|
||||
|
||||
// EventFrameAttached fired when frame has been attached to its parent.
|
||||
type EventFrameAttached struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has been attached.
|
||||
ParentFrameID FrameID `json:"parentFrameId,omitempty"` // Parent frame identifier.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been attached.
|
||||
ParentFrameID cdp.FrameID `json:"parentFrameId,omitempty"` // Parent frame identifier.
|
||||
}
|
||||
|
||||
// EventFrameNavigated fired once navigation of the frame has completed.
|
||||
// Frame is now associated with the new loader.
|
||||
type EventFrameNavigated struct {
|
||||
Frame *Frame `json:"frame,omitempty"` // Frame object.
|
||||
Frame *cdp.Frame `json:"frame,omitempty"` // Frame object.
|
||||
}
|
||||
|
||||
// EventFrameDetached fired when frame has been detached from its parent.
|
||||
type EventFrameDetached struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has been detached.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been detached.
|
||||
}
|
||||
|
||||
// EventFrameStartedLoading fired when frame has started loading.
|
||||
type EventFrameStartedLoading struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has started loading.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has started loading.
|
||||
}
|
||||
|
||||
// EventFrameStoppedLoading fired when frame has stopped loading.
|
||||
type EventFrameStoppedLoading struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has stopped loading.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has stopped loading.
|
||||
}
|
||||
|
||||
// EventFrameScheduledNavigation fired when frame schedules a potential
|
||||
// navigation.
|
||||
type EventFrameScheduledNavigation struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has scheduled a navigation.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has scheduled a navigation.
|
||||
Delay float64 `json:"delay,omitempty"` // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
|
||||
}
|
||||
|
||||
// EventFrameClearedScheduledNavigation fired when frame no longer has a
|
||||
// scheduled navigation.
|
||||
type EventFrameClearedScheduledNavigation struct {
|
||||
FrameID FrameID `json:"frameId,omitempty"` // Id of the frame that has cleared its scheduled navigation.
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has cleared its scheduled navigation.
|
||||
}
|
||||
|
||||
// EventFrameResized [no description].
|
||||
type EventFrameResized struct{}
|
||||
|
||||
// EventJavascriptDialogOpening fired when a JavaScript initiated dialog
|
||||
|
@ -105,7 +88,7 @@ type EventScreencastVisibilityChanged struct {
|
|||
|
||||
// EventColorPicked fired when a color has been picked.
|
||||
type EventColorPicked struct {
|
||||
Color *RGBA `json:"color,omitempty"` // RGBA of the picked color.
|
||||
Color *cdp.RGBA `json:"color,omitempty"` // RGBA of the picked color.
|
||||
}
|
||||
|
||||
// EventInterstitialShown fired when interstitial page was shown.
|
||||
|
@ -124,24 +107,24 @@ type EventNavigationRequested struct {
|
|||
URL string `json:"url,omitempty"` // URL of requested navigation.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventPageDomContentEventFired,
|
||||
EventPageLoadEventFired,
|
||||
EventPageFrameAttached,
|
||||
EventPageFrameNavigated,
|
||||
EventPageFrameDetached,
|
||||
EventPageFrameStartedLoading,
|
||||
EventPageFrameStoppedLoading,
|
||||
EventPageFrameScheduledNavigation,
|
||||
EventPageFrameClearedScheduledNavigation,
|
||||
EventPageFrameResized,
|
||||
EventPageJavascriptDialogOpening,
|
||||
EventPageJavascriptDialogClosed,
|
||||
EventPageScreencastFrame,
|
||||
EventPageScreencastVisibilityChanged,
|
||||
EventPageColorPicked,
|
||||
EventPageInterstitialShown,
|
||||
EventPageInterstitialHidden,
|
||||
EventPageNavigationRequested,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventPageDomContentEventFired,
|
||||
cdp.EventPageLoadEventFired,
|
||||
cdp.EventPageFrameAttached,
|
||||
cdp.EventPageFrameNavigated,
|
||||
cdp.EventPageFrameDetached,
|
||||
cdp.EventPageFrameStartedLoading,
|
||||
cdp.EventPageFrameStoppedLoading,
|
||||
cdp.EventPageFrameScheduledNavigation,
|
||||
cdp.EventPageFrameClearedScheduledNavigation,
|
||||
cdp.EventPageFrameResized,
|
||||
cdp.EventPageJavascriptDialogOpening,
|
||||
cdp.EventPageJavascriptDialogClosed,
|
||||
cdp.EventPageScreencastFrame,
|
||||
cdp.EventPageScreencastVisibilityChanged,
|
||||
cdp.EventPageColorPicked,
|
||||
cdp.EventPageInterstitialShown,
|
||||
cdp.EventPageInterstitialHidden,
|
||||
cdp.EventPageNavigationRequested,
|
||||
}
|
||||
|
|
356
cdp/page/page.go
356
cdp/page/page.go
File diff suppressed because it is too large
Load Diff
|
@ -5,32 +5,12 @@ package page
|
|||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// ResourceType resource type as it was perceived by the rendering engine.
|
||||
type ResourceType string
|
||||
|
||||
|
@ -111,7 +91,7 @@ type FrameResource struct {
|
|||
URL string `json:"url,omitempty"` // Resource URL.
|
||||
Type ResourceType `json:"type,omitempty"` // Type of this resource.
|
||||
MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser.
|
||||
LastModified Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
|
||||
LastModified cdp.Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
|
||||
ContentSize float64 `json:"contentSize,omitempty"` // Resource content size.
|
||||
Failed bool `json:"failed,omitempty"` // True if the resource failed to load.
|
||||
Canceled bool `json:"canceled,omitempty"` // True if the resource was canceled during loading.
|
||||
|
@ -120,7 +100,7 @@ type FrameResource struct {
|
|||
// FrameResourceTree information about the Frame hierarchy along with their
|
||||
// cached resources.
|
||||
type FrameResourceTree struct {
|
||||
Frame *Frame `json:"frame,omitempty"` // Frame information for this tree item.
|
||||
Frame *cdp.Frame `json:"frame,omitempty"` // Frame information for this tree item.
|
||||
ChildFrames []*FrameResourceTree `json:"childFrames,omitempty"` // Child frames.
|
||||
Resources []*FrameResource `json:"resources,omitempty"` // Information about frame resources.
|
||||
}
|
||||
|
@ -148,7 +128,7 @@ type ScreencastFrameMetadata struct {
|
|||
DeviceHeight float64 `json:"deviceHeight,omitempty"` // Device screen height in DIP.
|
||||
ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Position of horizontal scroll in CSS pixels.
|
||||
ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"` // Position of vertical scroll in CSS pixels.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Frame swap timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Frame swap timestamp.
|
||||
}
|
||||
|
||||
// DialogType javascript dialog type.
|
||||
|
|
|
@ -3,30 +3,10 @@ package profiler
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/debugger"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventConsoleProfileStarted sent when new profile recodring is started
|
||||
// using console.profile() call.
|
||||
type EventConsoleProfileStarted struct {
|
||||
|
@ -35,6 +15,7 @@ type EventConsoleProfileStarted struct {
|
|||
Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile().
|
||||
}
|
||||
|
||||
// EventConsoleProfileFinished [no description].
|
||||
type EventConsoleProfileFinished struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Location *debugger.Location `json:"location,omitempty"` // Location of console.profileEnd().
|
||||
|
@ -42,8 +23,8 @@ type EventConsoleProfileFinished struct {
|
|||
Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile().
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventProfilerConsoleProfileStarted,
|
||||
EventProfilerConsoleProfileFinished,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventProfilerConsoleProfileStarted,
|
||||
cdp.EventProfilerConsoleProfileFinished,
|
||||
}
|
||||
|
|
|
@ -9,50 +9,32 @@ package profiler
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandProfilerEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -64,32 +46,34 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable [no description].
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandProfilerDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -101,10 +85,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetSamplingIntervalParams changes CPU profiler sampling interval. Must be
|
||||
|
@ -125,7 +109,7 @@ func SetSamplingInterval(interval int64) *SetSamplingIntervalParams {
|
|||
}
|
||||
|
||||
// Do executes Profiler.setSamplingInterval.
|
||||
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -137,13 +121,13 @@ func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandProfilerSetSamplingInterval, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerSetSamplingInterval, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -155,32 +139,34 @@ func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StartParams [no description].
|
||||
type StartParams struct{}
|
||||
|
||||
// Start [no description].
|
||||
func Start() *StartParams {
|
||||
return &StartParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.start.
|
||||
func (p *StartParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandProfilerStart, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerStart, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -192,14 +178,16 @@ func (p *StartParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StopParams [no description].
|
||||
type StopParams struct{}
|
||||
|
||||
// Stop [no description].
|
||||
func Stop() *StopParams {
|
||||
return &StopParams{}
|
||||
}
|
||||
|
@ -213,19 +201,19 @@ type StopReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// profile - Recorded profile.
|
||||
func (p *StopParams) Do(ctxt context.Context, h FrameHandler) (profile *Profile, err error) {
|
||||
func (p *StopParams) Do(ctxt context.Context, h cdp.FrameHandler) (profile *Profile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandProfilerStop, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerStop, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -234,7 +222,7 @@ func (p *StopParams) Do(ctxt context.Context, h FrameHandler) (profile *Profile,
|
|||
var r StopReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Profile, nil
|
||||
|
@ -244,8 +232,8 @@ func (p *StopParams) Do(ctxt context.Context, h FrameHandler) (profile *Profile,
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
package profiler
|
||||
|
||||
import "github.com/knq/chromedp/cdp/runtime"
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// ProfileNode profile node. Holds callsite information, execution statistics
|
||||
// and child nodes.
|
||||
type ProfileNode struct {
|
||||
|
|
|
@ -11,30 +11,10 @@ package rendering
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// SetShowPaintRectsParams requests that backend shows paint rectangles.
|
||||
type SetShowPaintRectsParams struct {
|
||||
Result bool `json:"result"` // True for showing paint rectangles
|
||||
|
@ -51,7 +31,7 @@ func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
|
|||
}
|
||||
|
||||
// Do executes Rendering.setShowPaintRects.
|
||||
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -63,13 +43,13 @@ func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRenderingSetShowPaintRects, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowPaintRects, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -81,10 +61,10 @@ func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetShowDebugBordersParams requests that backend shows debug borders on
|
||||
|
@ -104,7 +84,7 @@ func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
|
|||
}
|
||||
|
||||
// Do executes Rendering.setShowDebugBorders.
|
||||
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -116,13 +96,13 @@ func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRenderingSetShowDebugBorders, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowDebugBorders, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -134,10 +114,10 @@ func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetShowFPSCounterParams requests that backend shows the FPS counter.
|
||||
|
@ -156,7 +136,7 @@ func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
|
|||
}
|
||||
|
||||
// Do executes Rendering.setShowFPSCounter.
|
||||
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -168,13 +148,13 @@ func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRenderingSetShowFPSCounter, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowFPSCounter, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -186,10 +166,10 @@ func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
|
||||
|
@ -210,7 +190,7 @@ func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams
|
|||
}
|
||||
|
||||
// Do executes Rendering.setShowScrollBottleneckRects.
|
||||
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -222,13 +202,13 @@ func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRenderingSetShowScrollBottleneckRects, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowScrollBottleneckRects, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -240,10 +220,10 @@ func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h FrameHan
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetShowViewportSizeOnResizeParams paints viewport size upon main frame
|
||||
|
@ -263,7 +243,7 @@ func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
|
|||
}
|
||||
|
||||
// Do executes Rendering.setShowViewportSizeOnResize.
|
||||
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -275,13 +255,13 @@ func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h FrameHand
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRenderingSetShowViewportSizeOnResize, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowViewportSizeOnResize, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -293,8 +273,8 @@ func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h FrameHand
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -3,30 +3,10 @@ package runtime
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventExecutionContextCreated issued when new execution context is created.
|
||||
type EventExecutionContextCreated struct {
|
||||
Context *ExecutionContextDescription `json:"context,omitempty"` // A newly created execution contex.
|
||||
|
@ -43,7 +23,7 @@ type EventExecutionContextsCleared struct{}
|
|||
|
||||
// EventExceptionThrown issued when exception was thrown and unhandled.
|
||||
type EventExceptionThrown struct {
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp of the exception.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp of the exception.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -58,7 +38,7 @@ type EventConsoleAPICalled struct {
|
|||
Type APIType `json:"type,omitempty"` // Type of the call.
|
||||
Args []*RemoteObject `json:"args,omitempty"` // Call arguments.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where the call was made.
|
||||
Timestamp Timestamp `json:"timestamp,omitempty"` // Call timestamp.
|
||||
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Call timestamp.
|
||||
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made.
|
||||
}
|
||||
|
||||
|
@ -69,13 +49,13 @@ type EventInspectRequested struct {
|
|||
Hints easyjson.RawMessage `json:"hints,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventRuntimeExecutionContextCreated,
|
||||
EventRuntimeExecutionContextDestroyed,
|
||||
EventRuntimeExecutionContextsCleared,
|
||||
EventRuntimeExceptionThrown,
|
||||
EventRuntimeExceptionRevoked,
|
||||
EventRuntimeConsoleAPICalled,
|
||||
EventRuntimeInspectRequested,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventRuntimeExecutionContextCreated,
|
||||
cdp.EventRuntimeExecutionContextDestroyed,
|
||||
cdp.EventRuntimeExecutionContextsCleared,
|
||||
cdp.EventRuntimeExceptionThrown,
|
||||
cdp.EventRuntimeExceptionRevoked,
|
||||
cdp.EventRuntimeConsoleAPICalled,
|
||||
cdp.EventRuntimeInspectRequested,
|
||||
}
|
||||
|
|
|
@ -16,30 +16,10 @@ package runtime
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EvaluateParams evaluates expression on global object.
|
||||
type EvaluateParams struct {
|
||||
Expression string `json:"expression"` // Expression to evaluate.
|
||||
|
@ -87,8 +67,8 @@ func (p EvaluateParams) WithSilent(silent bool) *EvaluateParams {
|
|||
// 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
|
||||
func (p EvaluateParams) WithContextID(contextID ExecutionContextID) *EvaluateParams {
|
||||
p.ContextID = contextID
|
||||
return &p
|
||||
}
|
||||
|
||||
|
@ -130,7 +110,7 @@ type EvaluateReturns struct {
|
|||
// returns:
|
||||
// result - Evaluation result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *EvaluateParams) Do(ctxt context.Context, h FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -142,13 +122,13 @@ func (p *EvaluateParams) Do(ctxt context.Context, h FrameHandler) (result *Remot
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeEvaluate, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeEvaluate, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, ErrChannelClosed
|
||||
return nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -157,7 +137,7 @@ func (p *EvaluateParams) Do(ctxt context.Context, h FrameHandler) (result *Remot
|
|||
var r EvaluateReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, ErrInvalidResult
|
||||
return nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, r.ExceptionDetails, nil
|
||||
|
@ -167,10 +147,10 @@ func (p *EvaluateParams) Do(ctxt context.Context, h FrameHandler) (result *Remot
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, ErrContextDone
|
||||
return nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, ErrUnknownResult
|
||||
return nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// AwaitPromiseParams add handler to promise with given promise object id.
|
||||
|
@ -183,10 +163,10 @@ type AwaitPromiseParams struct {
|
|||
// AwaitPromise add handler to promise with given promise object id.
|
||||
//
|
||||
// parameters:
|
||||
// promiseObjectId - Identifier of the promise.
|
||||
func AwaitPromise(promiseObjectId RemoteObjectID) *AwaitPromiseParams {
|
||||
// promiseObjectID - Identifier of the promise.
|
||||
func AwaitPromise(promiseObjectID RemoteObjectID) *AwaitPromiseParams {
|
||||
return &AwaitPromiseParams{
|
||||
PromiseObjectID: promiseObjectId,
|
||||
PromiseObjectID: promiseObjectID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +194,7 @@ type AwaitPromiseReturns struct {
|
|||
// returns:
|
||||
// result - Promise result. Will contain rejected value if promise was rejected.
|
||||
// exceptionDetails - Exception details if stack strace is available.
|
||||
func (p *AwaitPromiseParams) Do(ctxt context.Context, h FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -226,13 +206,13 @@ func (p *AwaitPromiseParams) Do(ctxt context.Context, h FrameHandler) (result *R
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeAwaitPromise, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeAwaitPromise, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, ErrChannelClosed
|
||||
return nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -241,7 +221,7 @@ func (p *AwaitPromiseParams) Do(ctxt context.Context, h FrameHandler) (result *R
|
|||
var r AwaitPromiseReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, ErrInvalidResult
|
||||
return nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, r.ExceptionDetails, nil
|
||||
|
@ -251,10 +231,10 @@ func (p *AwaitPromiseParams) Do(ctxt context.Context, h FrameHandler) (result *R
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, ErrContextDone
|
||||
return nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, ErrUnknownResult
|
||||
return nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CallFunctionOnParams calls function with given declaration on the given
|
||||
|
@ -274,11 +254,11 @@ type CallFunctionOnParams struct {
|
|||
// Object group of the result is inherited from the target object.
|
||||
//
|
||||
// parameters:
|
||||
// objectId - Identifier of the object to call function on.
|
||||
// objectID - Identifier of the object to call function on.
|
||||
// functionDeclaration - Declaration of the function to call.
|
||||
func CallFunctionOn(objectId RemoteObjectID, functionDeclaration string) *CallFunctionOnParams {
|
||||
func CallFunctionOn(objectID RemoteObjectID, functionDeclaration string) *CallFunctionOnParams {
|
||||
return &CallFunctionOnParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
FunctionDeclaration: functionDeclaration,
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +315,7 @@ type CallFunctionOnReturns struct {
|
|||
// returns:
|
||||
// result - Call result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CallFunctionOnParams) Do(ctxt context.Context, h FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -347,13 +327,13 @@ func (p *CallFunctionOnParams) Do(ctxt context.Context, h FrameHandler) (result
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeCallFunctionOn, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeCallFunctionOn, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, ErrChannelClosed
|
||||
return nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -362,7 +342,7 @@ func (p *CallFunctionOnParams) Do(ctxt context.Context, h FrameHandler) (result
|
|||
var r CallFunctionOnReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, ErrInvalidResult
|
||||
return nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, r.ExceptionDetails, nil
|
||||
|
@ -372,10 +352,10 @@ func (p *CallFunctionOnParams) Do(ctxt context.Context, h FrameHandler) (result
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, ErrContextDone
|
||||
return nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, ErrUnknownResult
|
||||
return nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetPropertiesParams returns properties of a given object. Object group of
|
||||
|
@ -391,10 +371,10 @@ type GetPropertiesParams struct {
|
|||
// result is inherited from the target object.
|
||||
//
|
||||
// parameters:
|
||||
// objectId - Identifier of the object to return properties for.
|
||||
func GetProperties(objectId RemoteObjectID) *GetPropertiesParams {
|
||||
// objectID - Identifier of the object to return properties for.
|
||||
func GetProperties(objectID RemoteObjectID) *GetPropertiesParams {
|
||||
return &GetPropertiesParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,7 +411,7 @@ type GetPropertiesReturns struct {
|
|||
// result - Object properties.
|
||||
// internalProperties - Internal object properties (only of the element itself).
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *GetPropertiesParams) Do(ctxt context.Context, h FrameHandler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -443,13 +423,13 @@ func (p *GetPropertiesParams) Do(ctxt context.Context, h FrameHandler) (result [
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeGetProperties, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeGetProperties, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, nil, ErrChannelClosed
|
||||
return nil, nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -458,7 +438,7 @@ func (p *GetPropertiesParams) Do(ctxt context.Context, h FrameHandler) (result [
|
|||
var r GetPropertiesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, nil, ErrInvalidResult
|
||||
return nil, nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, r.InternalProperties, r.ExceptionDetails, nil
|
||||
|
@ -468,10 +448,10 @@ func (p *GetPropertiesParams) Do(ctxt context.Context, h FrameHandler) (result [
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, nil, ErrContextDone
|
||||
return nil, nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, nil, ErrUnknownResult
|
||||
return nil, nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReleaseObjectParams releases remote object with given id.
|
||||
|
@ -482,15 +462,15 @@ type ReleaseObjectParams struct {
|
|||
// ReleaseObject releases remote object with given id.
|
||||
//
|
||||
// parameters:
|
||||
// objectId - Identifier of the object to release.
|
||||
func ReleaseObject(objectId RemoteObjectID) *ReleaseObjectParams {
|
||||
// objectID - Identifier of the object to release.
|
||||
func ReleaseObject(objectID RemoteObjectID) *ReleaseObjectParams {
|
||||
return &ReleaseObjectParams{
|
||||
ObjectID: objectId,
|
||||
ObjectID: objectID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.releaseObject.
|
||||
func (p *ReleaseObjectParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -502,13 +482,13 @@ func (p *ReleaseObjectParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeReleaseObject, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeReleaseObject, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -520,10 +500,10 @@ func (p *ReleaseObjectParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ReleaseObjectGroupParams releases all remote objects that belong to a
|
||||
|
@ -544,7 +524,7 @@ func ReleaseObjectGroup(objectGroup string) *ReleaseObjectGroupParams {
|
|||
}
|
||||
|
||||
// Do executes Runtime.releaseObjectGroup.
|
||||
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -556,13 +536,13 @@ func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeReleaseObjectGroup, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeReleaseObjectGroup, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -574,10 +554,10 @@ func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RunIfWaitingForDebuggerParams tells inspected instance to run if it was
|
||||
|
@ -591,19 +571,19 @@ func RunIfWaitingForDebugger() *RunIfWaitingForDebuggerParams {
|
|||
}
|
||||
|
||||
// Do executes Runtime.runIfWaitingForDebugger.
|
||||
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeRunIfWaitingForDebugger, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeRunIfWaitingForDebugger, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -615,10 +595,10 @@ func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h FrameHandler)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// EnableParams enables reporting of execution contexts creation by means of
|
||||
|
@ -634,19 +614,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Runtime.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -658,10 +638,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables reporting of execution contexts creation.
|
||||
|
@ -673,19 +653,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Runtime.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -697,10 +677,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||
|
@ -713,19 +693,19 @@ func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
|||
}
|
||||
|
||||
// Do executes Runtime.discardConsoleEntries.
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeDiscardConsoleEntries, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -737,16 +717,19 @@ func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabledParams [no description].
|
||||
type SetCustomObjectFormatterEnabledParams struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabled [no description].
|
||||
//
|
||||
// parameters:
|
||||
// enabled
|
||||
func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnabledParams {
|
||||
|
@ -756,7 +739,7 @@ func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnab
|
|||
}
|
||||
|
||||
// Do executes Runtime.setCustomObjectFormatterEnabled.
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -768,13 +751,13 @@ func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h Frame
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeSetCustomObjectFormatterEnabled, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -786,10 +769,10 @@ func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h Frame
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CompileScriptParams compiles expression.
|
||||
|
@ -817,8 +800,8 @@ func CompileScript(expression string, sourceURL string, persistScript bool) *Com
|
|||
// 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
|
||||
func (p CompileScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *CompileScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
|
@ -831,9 +814,9 @@ type CompileScriptReturns struct {
|
|||
// Do executes Runtime.compileScript.
|
||||
//
|
||||
// returns:
|
||||
// scriptId - Id of the script.
|
||||
// scriptID - Id of the script.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CompileScriptParams) Do(ctxt context.Context, h FrameHandler) (scriptId ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.FrameHandler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -845,13 +828,13 @@ func (p *CompileScriptParams) Do(ctxt context.Context, h FrameHandler) (scriptId
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeCompileScript, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeCompileScript, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", nil, ErrChannelClosed
|
||||
return "", nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -860,7 +843,7 @@ func (p *CompileScriptParams) Do(ctxt context.Context, h FrameHandler) (scriptId
|
|||
var r CompileScriptReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", nil, ErrInvalidResult
|
||||
return "", nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.ScriptID, r.ExceptionDetails, nil
|
||||
|
@ -870,10 +853,10 @@ func (p *CompileScriptParams) Do(ctxt context.Context, h FrameHandler) (scriptId
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", nil, ErrContextDone
|
||||
return "", nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", nil, ErrUnknownResult
|
||||
return "", nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RunScriptParams runs script with given id in a given context.
|
||||
|
@ -891,18 +874,18 @@ type RunScriptParams struct {
|
|||
// RunScript runs script with given id in a given context.
|
||||
//
|
||||
// parameters:
|
||||
// scriptId - Id of the script to run.
|
||||
func RunScript(scriptId ScriptID) *RunScriptParams {
|
||||
// scriptID - Id of the script to run.
|
||||
func RunScript(scriptID ScriptID) *RunScriptParams {
|
||||
return &RunScriptParams{
|
||||
ScriptID: scriptId,
|
||||
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
|
||||
func (p RunScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *RunScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
|
@ -958,7 +941,7 @@ type RunScriptReturns struct {
|
|||
// returns:
|
||||
// result - Run result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *RunScriptParams) Do(ctxt context.Context, h FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -970,13 +953,13 @@ func (p *RunScriptParams) Do(ctxt context.Context, h FrameHandler) (result *Remo
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandRuntimeRunScript, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandRuntimeRunScript, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, nil, ErrChannelClosed
|
||||
return nil, nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -985,7 +968,7 @@ func (p *RunScriptParams) Do(ctxt context.Context, h FrameHandler) (result *Remo
|
|||
var r RunScriptReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, nil, ErrInvalidResult
|
||||
return nil, nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Result, r.ExceptionDetails, nil
|
||||
|
@ -995,8 +978,8 @@ func (p *RunScriptParams) Do(ctxt context.Context, h FrameHandler) (result *Remo
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, nil, ErrContextDone
|
||||
return nil, nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, nil, ErrUnknownResult
|
||||
return nil, nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
package runtime
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// ScriptID unique script identifier.
|
||||
type ScriptID string
|
||||
|
@ -108,6 +87,7 @@ type RemoteObject struct {
|
|||
CustomPreview *CustomPreview `json:"customPreview,omitempty"`
|
||||
}
|
||||
|
||||
// CustomPreview [no description].
|
||||
type CustomPreview struct {
|
||||
Header string `json:"header,omitempty"`
|
||||
HasBody bool `json:"hasBody,omitempty"`
|
||||
|
@ -126,6 +106,7 @@ type ObjectPreview struct {
|
|||
Entries []*EntryPreview `json:"entries,omitempty"` // List of the entries. Specified for map and set subtype values only.
|
||||
}
|
||||
|
||||
// PropertyPreview [no description].
|
||||
type PropertyPreview struct {
|
||||
Name string `json:"name,omitempty"` // Property name.
|
||||
Type Type `json:"type,omitempty"` // Object type. Accessor means that the property itself is an accessor property.
|
||||
|
@ -134,6 +115,7 @@ type PropertyPreview struct {
|
|||
Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only.
|
||||
}
|
||||
|
||||
// EntryPreview [no description].
|
||||
type EntryPreview struct {
|
||||
Key *ObjectPreview `json:"key,omitempty"` // Preview of the key. Specified for map-like collection entries.
|
||||
Value *ObjectPreview `json:"value,omitempty"` // Preview of the value.
|
||||
|
|
|
@ -11,30 +11,10 @@ package schema
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GetDomainsParams returns supported domains.
|
||||
type GetDomainsParams struct{}
|
||||
|
||||
|
@ -52,19 +32,19 @@ type GetDomainsReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// domains - List of supported domains.
|
||||
func (p *GetDomainsParams) Do(ctxt context.Context, h FrameHandler) (domains []*Domain, err error) {
|
||||
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.FrameHandler) (domains []*Domain, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandSchemaGetDomains, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandSchemaGetDomains, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -73,7 +53,7 @@ func (p *GetDomainsParams) Do(ctxt context.Context, h FrameHandler) (domains []*
|
|||
var r GetDomainsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Domains, nil
|
||||
|
@ -83,8 +63,8 @@ func (p *GetDomainsParams) Do(ctxt context.Context, h FrameHandler) (domains []*
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -2,30 +2,6 @@ package schema
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// Domain description of the protocol domain.
|
||||
type Domain struct {
|
||||
Name string `json:"name,omitempty"` // Domain name.
|
||||
|
|
|
@ -17,66 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out *ShowCertificateViewerParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ShowCertificateViewerParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ShowCertificateViewerParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ShowCertificateViewerParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, out *SecurityStateExplanation) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out *StateExplanation) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -113,7 +54,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer, in SecurityStateExplanation) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, in StateExplanation) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -153,26 +94,85 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer,
|
|||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SecurityStateExplanation) MarshalJSON() ([]byte, error) {
|
||||
func (v StateExplanation) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v StateExplanation) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *StateExplanation) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *StateExplanation) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, out *ShowCertificateViewerParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ShowCertificateViewerParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SecurityStateExplanation) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v ShowCertificateViewerParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SecurityStateExplanation) UnmarshalJSON(data []byte) error {
|
||||
func (v *ShowCertificateViewerParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SecurityStateExplanation) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, out *InsecureContentStatus) {
|
||||
|
@ -324,18 +324,18 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, ou
|
|||
} else {
|
||||
in.Delim('[')
|
||||
if !in.IsDelim(']') {
|
||||
out.Explanations = make([]*SecurityStateExplanation, 0, 8)
|
||||
out.Explanations = make([]*StateExplanation, 0, 8)
|
||||
} else {
|
||||
out.Explanations = []*SecurityStateExplanation{}
|
||||
out.Explanations = []*StateExplanation{}
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v1 *SecurityStateExplanation
|
||||
var v1 *StateExplanation
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
v1 = nil
|
||||
} else {
|
||||
if v1 == nil {
|
||||
v1 = new(SecurityStateExplanation)
|
||||
v1 = new(StateExplanation)
|
||||
}
|
||||
(*v1).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
|
|
@ -3,39 +3,19 @@ package security
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventSecurityStateChanged the security state of the page changed.
|
||||
type EventSecurityStateChanged struct {
|
||||
SecurityState SecurityState `json:"securityState,omitempty"` // Security state.
|
||||
SecurityState State `json:"securityState,omitempty"` // Security state.
|
||||
SchemeIsCryptographic bool `json:"schemeIsCryptographic,omitempty"` // True if the page was loaded over cryptographic transport such as HTTPS.
|
||||
Explanations []*SecurityStateExplanation `json:"explanations,omitempty"` // List of explanations for the security state. If the overall security state is `insecure` or `warning`, at least one corresponding explanation should be included.
|
||||
Explanations []*StateExplanation `json:"explanations,omitempty"` // List of explanations for the security state. If the overall security state is `insecure` or `warning`, at least one corresponding explanation should be included.
|
||||
InsecureContentStatus *InsecureContentStatus `json:"insecureContentStatus,omitempty"` // Information about insecure content on the page.
|
||||
Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventSecuritySecurityStateChanged,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventSecuritySecurityStateChanged,
|
||||
}
|
||||
|
|
|
@ -11,30 +11,10 @@ package security
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams enables tracking security state changes.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -44,19 +24,19 @@ func Enable() *EnableParams {
|
|||
}
|
||||
|
||||
// Do executes Security.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandSecurityEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandSecurityEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -68,10 +48,10 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams disables tracking security state changes.
|
||||
|
@ -83,19 +63,19 @@ func Disable() *DisableParams {
|
|||
}
|
||||
|
||||
// Do executes Security.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandSecurityDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandSecurityDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -107,10 +87,10 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ShowCertificateViewerParams displays native dialog with the certificate
|
||||
|
@ -123,19 +103,19 @@ func ShowCertificateViewer() *ShowCertificateViewerParams {
|
|||
}
|
||||
|
||||
// Do executes Security.showCertificateViewer.
|
||||
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandSecurityShowCertificateViewer, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandSecurityShowCertificateViewer, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -147,8 +127,8 @@ func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
package security
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// CertificateID an internal certificate ID value.
|
||||
type CertificateID int64
|
||||
|
@ -39,64 +18,64 @@ func (t CertificateID) Int64() int64 {
|
|||
return int64(t)
|
||||
}
|
||||
|
||||
// SecurityState the security level of a page or resource.
|
||||
type SecurityState string
|
||||
// State the security level of a page or resource.
|
||||
type State string
|
||||
|
||||
// String returns the SecurityState as string value.
|
||||
func (t SecurityState) String() string {
|
||||
// String returns the State as string value.
|
||||
func (t State) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// SecurityState values.
|
||||
// State values.
|
||||
const (
|
||||
SecurityStateUnknown SecurityState = "unknown"
|
||||
SecurityStateNeutral SecurityState = "neutral"
|
||||
SecurityStateInsecure SecurityState = "insecure"
|
||||
SecurityStateWarning SecurityState = "warning"
|
||||
SecurityStateSecure SecurityState = "secure"
|
||||
SecurityStateInfo SecurityState = "info"
|
||||
StateUnknown State = "unknown"
|
||||
StateNeutral State = "neutral"
|
||||
StateInsecure State = "insecure"
|
||||
StateWarning State = "warning"
|
||||
StateSecure State = "secure"
|
||||
StateInfo State = "info"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t SecurityState) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
func (t State) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t SecurityState) MarshalJSON() ([]byte, error) {
|
||||
func (t State) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *SecurityState) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch SecurityState(in.String()) {
|
||||
case SecurityStateUnknown:
|
||||
*t = SecurityStateUnknown
|
||||
case SecurityStateNeutral:
|
||||
*t = SecurityStateNeutral
|
||||
case SecurityStateInsecure:
|
||||
*t = SecurityStateInsecure
|
||||
case SecurityStateWarning:
|
||||
*t = SecurityStateWarning
|
||||
case SecurityStateSecure:
|
||||
*t = SecurityStateSecure
|
||||
case SecurityStateInfo:
|
||||
*t = SecurityStateInfo
|
||||
func (t *State) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch State(in.String()) {
|
||||
case StateUnknown:
|
||||
*t = StateUnknown
|
||||
case StateNeutral:
|
||||
*t = StateNeutral
|
||||
case StateInsecure:
|
||||
*t = StateInsecure
|
||||
case StateWarning:
|
||||
*t = StateWarning
|
||||
case StateSecure:
|
||||
*t = StateSecure
|
||||
case StateInfo:
|
||||
*t = StateInfo
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown SecurityState value"))
|
||||
in.AddError(errors.New("unknown State value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *SecurityState) UnmarshalJSON(buf []byte) error {
|
||||
func (t *State) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// SecurityStateExplanation an explanation of an factor contributing to the
|
||||
// security state.
|
||||
type SecurityStateExplanation struct {
|
||||
SecurityState SecurityState `json:"securityState,omitempty"` // Security state representing the severity of the factor being explained.
|
||||
// StateExplanation an explanation of an factor contributing to the security
|
||||
// state.
|
||||
type StateExplanation struct {
|
||||
SecurityState State `json:"securityState,omitempty"` // Security state representing the severity of the factor being explained.
|
||||
Summary string `json:"summary,omitempty"` // Short phrase describing the type of factor.
|
||||
Description string `json:"description,omitempty"` // Full text explanation of the factor.
|
||||
HasCertificate bool `json:"hasCertificate,omitempty"` // True if the page has a certificate.
|
||||
|
@ -108,6 +87,6 @@ type InsecureContentStatus struct {
|
|||
DisplayedMixedContent bool `json:"displayedMixedContent,omitempty"` // True if the page was loaded over HTTPS and displayed mixed (HTTP) content such as images.
|
||||
RanContentWithCertErrors bool `json:"ranContentWithCertErrors,omitempty"` // True if the page was loaded over HTTPS without certificate errors, and ran content such as scripts that were loaded with certificate errors.
|
||||
DisplayedContentWithCertErrors bool `json:"displayedContentWithCertErrors,omitempty"` // True if the page was loaded over HTTPS without certificate errors, and displayed content such as images that were loaded with certificate errors.
|
||||
RanInsecureContentStyle SecurityState `json:"ranInsecureContentStyle,omitempty"` // Security state representing a page that ran insecure content.
|
||||
DisplayedInsecureContentStyle SecurityState `json:"displayedInsecureContentStyle,omitempty"` // Security state representing a page that displayed insecure content.
|
||||
RanInsecureContentStyle State `json:"ranInsecureContentStyle,omitempty"` // Security state representing a page that ran insecure content.
|
||||
DisplayedInsecureContentStyle State `json:"displayedInsecureContentStyle,omitempty"` // Security state representing a page that displayed insecure content.
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,44 +3,27 @@ package serviceworker
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventWorkerRegistrationUpdated [no description].
|
||||
type EventWorkerRegistrationUpdated struct {
|
||||
Registrations []*ServiceWorkerRegistration `json:"registrations,omitempty"`
|
||||
Registrations []*Registration `json:"registrations,omitempty"`
|
||||
}
|
||||
|
||||
// EventWorkerVersionUpdated [no description].
|
||||
type EventWorkerVersionUpdated struct {
|
||||
Versions []*ServiceWorkerVersion `json:"versions,omitempty"`
|
||||
Versions []*Version `json:"versions,omitempty"`
|
||||
}
|
||||
|
||||
// EventWorkerErrorReported [no description].
|
||||
type EventWorkerErrorReported struct {
|
||||
ErrorMessage *ServiceWorkerErrorMessage `json:"errorMessage,omitempty"`
|
||||
ErrorMessage *ErrorMessage `json:"errorMessage,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventServiceWorkerWorkerRegistrationUpdated,
|
||||
EventServiceWorkerWorkerVersionUpdated,
|
||||
EventServiceWorkerWorkerErrorReported,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventServiceWorkerWorkerRegistrationUpdated,
|
||||
cdp.EventServiceWorkerWorkerVersionUpdated,
|
||||
cdp.EventServiceWorkerWorkerErrorReported,
|
||||
}
|
||||
|
|
|
@ -9,50 +9,32 @@ package serviceworker
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.enable.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerEnable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerEnable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -64,32 +46,34 @@ func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable [no description].
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.disable.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerDisable, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDisable, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -101,16 +85,19 @@ func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// UnregisterParams [no description].
|
||||
type UnregisterParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// Unregister [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func Unregister(scopeURL string) *UnregisterParams {
|
||||
|
@ -120,7 +107,7 @@ func Unregister(scopeURL string) *UnregisterParams {
|
|||
}
|
||||
|
||||
// Do executes ServiceWorker.unregister.
|
||||
func (p *UnregisterParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -132,13 +119,13 @@ func (p *UnregisterParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerUnregister, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -150,16 +137,19 @@ func (p *UnregisterParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// UpdateRegistrationParams [no description].
|
||||
type UpdateRegistrationParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// UpdateRegistration [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
||||
|
@ -169,7 +159,7 @@ func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
|||
}
|
||||
|
||||
// Do executes ServiceWorker.updateRegistration.
|
||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -181,13 +171,13 @@ func (p *UpdateRegistrationParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerUpdateRegistration, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -199,16 +189,19 @@ func (p *UpdateRegistrationParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StartWorkerParams [no description].
|
||||
type StartWorkerParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// StartWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func StartWorker(scopeURL string) *StartWorkerParams {
|
||||
|
@ -218,7 +211,7 @@ func StartWorker(scopeURL string) *StartWorkerParams {
|
|||
}
|
||||
|
||||
// Do executes ServiceWorker.startWorker.
|
||||
func (p *StartWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -230,13 +223,13 @@ func (p *StartWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerStartWorker, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -248,16 +241,19 @@ func (p *StartWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SkipWaitingParams [no description].
|
||||
type SkipWaitingParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// SkipWaiting [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
||||
|
@ -267,7 +263,7 @@ func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
|||
}
|
||||
|
||||
// Do executes ServiceWorker.skipWaiting.
|
||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -279,13 +275,13 @@ func (p *SkipWaitingParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerSkipWaiting, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -297,26 +293,29 @@ func (p *SkipWaitingParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// StopWorkerParams [no description].
|
||||
type StopWorkerParams struct {
|
||||
VersionID string `json:"versionId"`
|
||||
}
|
||||
|
||||
// StopWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// versionId
|
||||
func StopWorker(versionId string) *StopWorkerParams {
|
||||
// versionID
|
||||
func StopWorker(versionID string) *StopWorkerParams {
|
||||
return &StopWorkerParams{
|
||||
VersionID: versionId,
|
||||
VersionID: versionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.stopWorker.
|
||||
func (p *StopWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -328,13 +327,13 @@ func (p *StopWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerStopWorker, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -346,26 +345,29 @@ func (p *StopWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error)
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// InspectWorkerParams [no description].
|
||||
type InspectWorkerParams struct {
|
||||
VersionID string `json:"versionId"`
|
||||
}
|
||||
|
||||
// InspectWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// versionId
|
||||
func InspectWorker(versionId string) *InspectWorkerParams {
|
||||
// versionID
|
||||
func InspectWorker(versionID string) *InspectWorkerParams {
|
||||
return &InspectWorkerParams{
|
||||
VersionID: versionId,
|
||||
VersionID: versionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.inspectWorker.
|
||||
func (p *InspectWorkerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -377,13 +379,13 @@ func (p *InspectWorkerParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerInspectWorker, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerInspectWorker, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -395,16 +397,19 @@ func (p *InspectWorkerParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetForceUpdateOnPageLoadParams [no description].
|
||||
type SetForceUpdateOnPageLoadParams struct {
|
||||
ForceUpdateOnPageLoad bool `json:"forceUpdateOnPageLoad"`
|
||||
}
|
||||
|
||||
// SetForceUpdateOnPageLoad [no description].
|
||||
//
|
||||
// parameters:
|
||||
// forceUpdateOnPageLoad
|
||||
func SetForceUpdateOnPageLoad(forceUpdateOnPageLoad bool) *SetForceUpdateOnPageLoadParams {
|
||||
|
@ -414,7 +419,7 @@ func SetForceUpdateOnPageLoad(forceUpdateOnPageLoad bool) *SetForceUpdateOnPageL
|
|||
}
|
||||
|
||||
// Do executes ServiceWorker.setForceUpdateOnPageLoad.
|
||||
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -426,13 +431,13 @@ func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerSetForceUpdateOnPageLoad, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerSetForceUpdateOnPageLoad, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -444,32 +449,35 @@ func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h FrameHandler
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DeliverPushMessageParams [no description].
|
||||
type DeliverPushMessageParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
// DeliverPushMessage [no description].
|
||||
//
|
||||
// parameters:
|
||||
// origin
|
||||
// registrationId
|
||||
// registrationID
|
||||
// data
|
||||
func DeliverPushMessage(origin string, registrationId string, data string) *DeliverPushMessageParams {
|
||||
func DeliverPushMessage(origin string, registrationID string, data string) *DeliverPushMessageParams {
|
||||
return &DeliverPushMessageParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationId,
|
||||
RegistrationID: registrationID,
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.deliverPushMessage.
|
||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -481,13 +489,13 @@ func (p *DeliverPushMessageParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerDeliverPushMessage, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -499,12 +507,13 @@ func (p *DeliverPushMessageParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DispatchSyncEventParams [no description].
|
||||
type DispatchSyncEventParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
|
@ -512,22 +521,24 @@ type DispatchSyncEventParams struct {
|
|||
LastChance bool `json:"lastChance"`
|
||||
}
|
||||
|
||||
// DispatchSyncEvent [no description].
|
||||
//
|
||||
// parameters:
|
||||
// origin
|
||||
// registrationId
|
||||
// registrationID
|
||||
// tag
|
||||
// lastChance
|
||||
func DispatchSyncEvent(origin string, registrationId string, tag string, lastChance bool) *DispatchSyncEventParams {
|
||||
func DispatchSyncEvent(origin string, registrationID string, tag string, lastChance bool) *DispatchSyncEventParams {
|
||||
return &DispatchSyncEventParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationId,
|
||||
RegistrationID: registrationID,
|
||||
Tag: tag,
|
||||
LastChance: lastChance,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.dispatchSyncEvent.
|
||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -539,13 +550,13 @@ func (p *DispatchSyncEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandServiceWorkerDispatchSyncEvent, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -557,8 +568,8 @@ func (p *DispatchSyncEventParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,159 +1,140 @@
|
|||
package serviceworker
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/target"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// ServiceWorkerRegistration serviceWorker registration.
|
||||
type ServiceWorkerRegistration struct {
|
||||
// Registration serviceWorker registration.
|
||||
type Registration struct {
|
||||
RegistrationID string `json:"registrationId,omitempty"`
|
||||
ScopeURL string `json:"scopeURL,omitempty"`
|
||||
IsDeleted bool `json:"isDeleted,omitempty"`
|
||||
}
|
||||
|
||||
type ServiceWorkerVersionRunningStatus string
|
||||
// VersionRunningStatus [no description].
|
||||
type VersionRunningStatus string
|
||||
|
||||
// String returns the ServiceWorkerVersionRunningStatus as string value.
|
||||
func (t ServiceWorkerVersionRunningStatus) String() string {
|
||||
// String returns the VersionRunningStatus as string value.
|
||||
func (t VersionRunningStatus) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ServiceWorkerVersionRunningStatus values.
|
||||
// VersionRunningStatus values.
|
||||
const (
|
||||
ServiceWorkerVersionRunningStatusStopped ServiceWorkerVersionRunningStatus = "stopped"
|
||||
ServiceWorkerVersionRunningStatusStarting ServiceWorkerVersionRunningStatus = "starting"
|
||||
ServiceWorkerVersionRunningStatusRunning ServiceWorkerVersionRunningStatus = "running"
|
||||
ServiceWorkerVersionRunningStatusStopping ServiceWorkerVersionRunningStatus = "stopping"
|
||||
VersionRunningStatusStopped VersionRunningStatus = "stopped"
|
||||
VersionRunningStatusStarting VersionRunningStatus = "starting"
|
||||
VersionRunningStatusRunning VersionRunningStatus = "running"
|
||||
VersionRunningStatusStopping VersionRunningStatus = "stopping"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t ServiceWorkerVersionRunningStatus) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
func (t VersionRunningStatus) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t ServiceWorkerVersionRunningStatus) MarshalJSON() ([]byte, error) {
|
||||
func (t VersionRunningStatus) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *ServiceWorkerVersionRunningStatus) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch ServiceWorkerVersionRunningStatus(in.String()) {
|
||||
case ServiceWorkerVersionRunningStatusStopped:
|
||||
*t = ServiceWorkerVersionRunningStatusStopped
|
||||
case ServiceWorkerVersionRunningStatusStarting:
|
||||
*t = ServiceWorkerVersionRunningStatusStarting
|
||||
case ServiceWorkerVersionRunningStatusRunning:
|
||||
*t = ServiceWorkerVersionRunningStatusRunning
|
||||
case ServiceWorkerVersionRunningStatusStopping:
|
||||
*t = ServiceWorkerVersionRunningStatusStopping
|
||||
func (t *VersionRunningStatus) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch VersionRunningStatus(in.String()) {
|
||||
case VersionRunningStatusStopped:
|
||||
*t = VersionRunningStatusStopped
|
||||
case VersionRunningStatusStarting:
|
||||
*t = VersionRunningStatusStarting
|
||||
case VersionRunningStatusRunning:
|
||||
*t = VersionRunningStatusRunning
|
||||
case VersionRunningStatusStopping:
|
||||
*t = VersionRunningStatusStopping
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown ServiceWorkerVersionRunningStatus value"))
|
||||
in.AddError(errors.New("unknown VersionRunningStatus value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *ServiceWorkerVersionRunningStatus) UnmarshalJSON(buf []byte) error {
|
||||
func (t *VersionRunningStatus) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
type ServiceWorkerVersionStatus string
|
||||
// VersionStatus [no description].
|
||||
type VersionStatus string
|
||||
|
||||
// String returns the ServiceWorkerVersionStatus as string value.
|
||||
func (t ServiceWorkerVersionStatus) String() string {
|
||||
// String returns the VersionStatus as string value.
|
||||
func (t VersionStatus) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ServiceWorkerVersionStatus values.
|
||||
// VersionStatus values.
|
||||
const (
|
||||
ServiceWorkerVersionStatusNew ServiceWorkerVersionStatus = "new"
|
||||
ServiceWorkerVersionStatusInstalling ServiceWorkerVersionStatus = "installing"
|
||||
ServiceWorkerVersionStatusInstalled ServiceWorkerVersionStatus = "installed"
|
||||
ServiceWorkerVersionStatusActivating ServiceWorkerVersionStatus = "activating"
|
||||
ServiceWorkerVersionStatusActivated ServiceWorkerVersionStatus = "activated"
|
||||
ServiceWorkerVersionStatusRedundant ServiceWorkerVersionStatus = "redundant"
|
||||
VersionStatusNew VersionStatus = "new"
|
||||
VersionStatusInstalling VersionStatus = "installing"
|
||||
VersionStatusInstalled VersionStatus = "installed"
|
||||
VersionStatusActivating VersionStatus = "activating"
|
||||
VersionStatusActivated VersionStatus = "activated"
|
||||
VersionStatusRedundant VersionStatus = "redundant"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t ServiceWorkerVersionStatus) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
func (t VersionStatus) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t ServiceWorkerVersionStatus) MarshalJSON() ([]byte, error) {
|
||||
func (t VersionStatus) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *ServiceWorkerVersionStatus) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch ServiceWorkerVersionStatus(in.String()) {
|
||||
case ServiceWorkerVersionStatusNew:
|
||||
*t = ServiceWorkerVersionStatusNew
|
||||
case ServiceWorkerVersionStatusInstalling:
|
||||
*t = ServiceWorkerVersionStatusInstalling
|
||||
case ServiceWorkerVersionStatusInstalled:
|
||||
*t = ServiceWorkerVersionStatusInstalled
|
||||
case ServiceWorkerVersionStatusActivating:
|
||||
*t = ServiceWorkerVersionStatusActivating
|
||||
case ServiceWorkerVersionStatusActivated:
|
||||
*t = ServiceWorkerVersionStatusActivated
|
||||
case ServiceWorkerVersionStatusRedundant:
|
||||
*t = ServiceWorkerVersionStatusRedundant
|
||||
func (t *VersionStatus) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch VersionStatus(in.String()) {
|
||||
case VersionStatusNew:
|
||||
*t = VersionStatusNew
|
||||
case VersionStatusInstalling:
|
||||
*t = VersionStatusInstalling
|
||||
case VersionStatusInstalled:
|
||||
*t = VersionStatusInstalled
|
||||
case VersionStatusActivating:
|
||||
*t = VersionStatusActivating
|
||||
case VersionStatusActivated:
|
||||
*t = VersionStatusActivated
|
||||
case VersionStatusRedundant:
|
||||
*t = VersionStatusRedundant
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown ServiceWorkerVersionStatus value"))
|
||||
in.AddError(errors.New("unknown VersionStatus value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *ServiceWorkerVersionStatus) UnmarshalJSON(buf []byte) error {
|
||||
func (t *VersionStatus) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// ServiceWorkerVersion serviceWorker version.
|
||||
type ServiceWorkerVersion struct {
|
||||
// Version serviceWorker version.
|
||||
type Version struct {
|
||||
VersionID string `json:"versionId,omitempty"`
|
||||
RegistrationID string `json:"registrationId,omitempty"`
|
||||
ScriptURL string `json:"scriptURL,omitempty"`
|
||||
RunningStatus ServiceWorkerVersionRunningStatus `json:"runningStatus,omitempty"`
|
||||
Status ServiceWorkerVersionStatus `json:"status,omitempty"`
|
||||
RunningStatus VersionRunningStatus `json:"runningStatus,omitempty"`
|
||||
Status VersionStatus `json:"status,omitempty"`
|
||||
ScriptLastModified float64 `json:"scriptLastModified,omitempty"` // The Last-Modified header value of the main script.
|
||||
ScriptResponseTime float64 `json:"scriptResponseTime,omitempty"` // The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.
|
||||
ControlledClients []target.TargetID `json:"controlledClients,omitempty"`
|
||||
TargetID target.TargetID `json:"targetId,omitempty"`
|
||||
ControlledClients []target.ID `json:"controlledClients,omitempty"`
|
||||
TargetID target.ID `json:"targetId,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceWorkerErrorMessage serviceWorker error message.
|
||||
type ServiceWorkerErrorMessage struct {
|
||||
// ErrorMessage serviceWorker error message.
|
||||
type ErrorMessage struct {
|
||||
ErrorMessage string `json:"errorMessage,omitempty"`
|
||||
RegistrationID string `json:"registrationId,omitempty"`
|
||||
VersionID string `json:"versionId,omitempty"`
|
||||
|
|
|
@ -9,30 +9,10 @@ package storage
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// ClearDataForOriginParams clears storage for origin.
|
||||
type ClearDataForOriginParams struct {
|
||||
Origin string `json:"origin"` // Security origin.
|
||||
|
@ -52,7 +32,7 @@ func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginP
|
|||
}
|
||||
|
||||
// Do executes Storage.clearDataForOrigin.
|
||||
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -64,13 +44,13 @@ func (p *ClearDataForOriginParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandStorageClearDataForOrigin, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -82,8 +62,8 @@ func (p *ClearDataForOriginParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,98 +1,77 @@
|
|||
package storage
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// StorageType enum of possible storage types.
|
||||
type StorageType string
|
||||
// Type enum of possible storage types.
|
||||
type Type string
|
||||
|
||||
// String returns the StorageType as string value.
|
||||
func (t StorageType) String() string {
|
||||
// String returns the Type as string value.
|
||||
func (t Type) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// StorageType values.
|
||||
// Type values.
|
||||
const (
|
||||
StorageTypeAppcache StorageType = "appcache"
|
||||
StorageTypeCookies StorageType = "cookies"
|
||||
StorageTypeFileSystems StorageType = "file_systems"
|
||||
StorageTypeIndexeddb StorageType = "indexeddb"
|
||||
StorageTypeLocalStorage StorageType = "local_storage"
|
||||
StorageTypeShaderCache StorageType = "shader_cache"
|
||||
StorageTypeWebsql StorageType = "websql"
|
||||
StorageTypeServiceWorkers StorageType = "service_workers"
|
||||
StorageTypeCacheStorage StorageType = "cache_storage"
|
||||
StorageTypeAll StorageType = "all"
|
||||
TypeAppcache Type = "appcache"
|
||||
TypeCookies Type = "cookies"
|
||||
TypeFileSystems Type = "file_systems"
|
||||
TypeIndexeddb Type = "indexeddb"
|
||||
TypeLocalStorage Type = "local_storage"
|
||||
TypeShaderCache Type = "shader_cache"
|
||||
TypeWebsql Type = "websql"
|
||||
TypeServiceWorkers Type = "service_workers"
|
||||
TypeCacheStorage Type = "cache_storage"
|
||||
TypeAll Type = "all"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t StorageType) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t StorageType) MarshalJSON() ([]byte, error) {
|
||||
func (t Type) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *StorageType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch StorageType(in.String()) {
|
||||
case StorageTypeAppcache:
|
||||
*t = StorageTypeAppcache
|
||||
case StorageTypeCookies:
|
||||
*t = StorageTypeCookies
|
||||
case StorageTypeFileSystems:
|
||||
*t = StorageTypeFileSystems
|
||||
case StorageTypeIndexeddb:
|
||||
*t = StorageTypeIndexeddb
|
||||
case StorageTypeLocalStorage:
|
||||
*t = StorageTypeLocalStorage
|
||||
case StorageTypeShaderCache:
|
||||
*t = StorageTypeShaderCache
|
||||
case StorageTypeWebsql:
|
||||
*t = StorageTypeWebsql
|
||||
case StorageTypeServiceWorkers:
|
||||
*t = StorageTypeServiceWorkers
|
||||
case StorageTypeCacheStorage:
|
||||
*t = StorageTypeCacheStorage
|
||||
case StorageTypeAll:
|
||||
*t = StorageTypeAll
|
||||
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch Type(in.String()) {
|
||||
case TypeAppcache:
|
||||
*t = TypeAppcache
|
||||
case TypeCookies:
|
||||
*t = TypeCookies
|
||||
case TypeFileSystems:
|
||||
*t = TypeFileSystems
|
||||
case TypeIndexeddb:
|
||||
*t = TypeIndexeddb
|
||||
case TypeLocalStorage:
|
||||
*t = TypeLocalStorage
|
||||
case TypeShaderCache:
|
||||
*t = TypeShaderCache
|
||||
case TypeWebsql:
|
||||
*t = TypeWebsql
|
||||
case TypeServiceWorkers:
|
||||
*t = TypeServiceWorkers
|
||||
case TypeCacheStorage:
|
||||
*t = TypeCacheStorage
|
||||
case TypeAll:
|
||||
*t = TypeAll
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown StorageType value"))
|
||||
in.AddError(errors.New("unknown Type value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *StorageType) UnmarshalJSON(buf []byte) error {
|
||||
func (t *Type) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
|
|
@ -12,30 +12,10 @@ package systeminfo
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GetInfoParams returns information about the system.
|
||||
type GetInfoParams struct{}
|
||||
|
||||
|
@ -57,19 +37,19 @@ type GetInfoReturns struct {
|
|||
// gpu - Information about the GPUs on the system.
|
||||
// modelName - A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
|
||||
// modelVersion - A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
|
||||
func (p *GetInfoParams) Do(ctxt context.Context, h FrameHandler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
|
||||
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandSystemInfoGetInfo, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, "", "", ErrChannelClosed
|
||||
return nil, "", "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -78,7 +58,7 @@ func (p *GetInfoParams) Do(ctxt context.Context, h FrameHandler) (gpu *GPUInfo,
|
|||
var r GetInfoReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, "", "", ErrInvalidResult
|
||||
return nil, "", "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Gpu, r.ModelName, r.ModelVersion, nil
|
||||
|
@ -88,8 +68,8 @@ func (p *GetInfoParams) Do(ctxt context.Context, h FrameHandler) (gpu *GPUInfo,
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, "", "", ErrContextDone
|
||||
return nil, "", "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, "", "", ErrUnknownResult
|
||||
return nil, "", "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
package systeminfo
|
||||
|
||||
import "github.com/mailru/easyjson"
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// GPUDevice describes a single graphics processor (GPU).
|
||||
type GPUDevice struct {
|
||||
VendorID float64 `json:"vendorId,omitempty"` // PCI ID of the GPU vendor, if available; 0 otherwise.
|
||||
|
|
|
@ -17,106 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(in *jlexer.Lexer, out *TargetInfo) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
case "type":
|
||||
out.Type = string(in.String())
|
||||
case "title":
|
||||
out.Title = string(in.String())
|
||||
case "url":
|
||||
out.URL = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(out *jwriter.Writer, in TargetInfo) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.TargetID != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"targetId\":")
|
||||
out.String(string(in.TargetID))
|
||||
}
|
||||
if in.Type != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"type\":")
|
||||
out.String(string(in.Type))
|
||||
}
|
||||
if in.Title != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"title\":")
|
||||
out.String(string(in.Title))
|
||||
}
|
||||
if in.URL != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"url\":")
|
||||
out.String(string(in.URL))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v TargetInfo) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v TargetInfo) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *TargetInfo) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *TargetInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(in *jlexer.Lexer, out *SetRemoteLocationsParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(in *jlexer.Lexer, out *SetRemoteLocationsParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -172,7 +73,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(out *jwriter.Writer, in SetRemoteLocationsParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(out *jwriter.Writer, in SetRemoteLocationsParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -203,27 +104,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SetRemoteLocationsParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SetRemoteLocationsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SetRemoteLocationsParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SetRemoteLocationsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(in *jlexer.Lexer, out *SetDiscoverTargetsParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(in *jlexer.Lexer, out *SetDiscoverTargetsParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -254,7 +155,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(out *jwriter.Writer, in SetDiscoverTargetsParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(out *jwriter.Writer, in SetDiscoverTargetsParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -270,27 +171,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SetDiscoverTargetsParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SetDiscoverTargetsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SetDiscoverTargetsParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SetDiscoverTargetsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(in *jlexer.Lexer, out *SetAutoAttachParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(in *jlexer.Lexer, out *SetAutoAttachParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -323,7 +224,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(out *jwriter.Writer, in SetAutoAttachParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(out *jwriter.Writer, in SetAutoAttachParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -345,27 +246,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SetAutoAttachParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SetAutoAttachParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SetAutoAttachParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SetAutoAttachParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget2(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(in *jlexer.Lexer, out *SetAttachToFramesParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(in *jlexer.Lexer, out *SetAttachToFramesParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -396,7 +297,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(out *jwriter.Writer, in SetAttachToFramesParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(out *jwriter.Writer, in SetAttachToFramesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -412,27 +313,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SetAttachToFramesParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SetAttachToFramesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SetAttachToFramesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SetAttachToFramesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget3(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(in *jlexer.Lexer, out *SendMessageToTargetParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(in *jlexer.Lexer, out *SendMessageToTargetParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -465,7 +366,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(out *jwriter.Writer, in SendMessageToTargetParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(out *jwriter.Writer, in SendMessageToTargetParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -487,27 +388,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v SendMessageToTargetParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SendMessageToTargetParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SendMessageToTargetParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SendMessageToTargetParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget6(in *jlexer.Lexer, out *RemoteLocation) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(in *jlexer.Lexer, out *RemoteLocation) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -540,7 +441,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget6(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(out *jwriter.Writer, in RemoteLocation) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(out *jwriter.Writer, in RemoteLocation) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -566,24 +467,123 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(out *jwriter.Writer, i
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v RemoteLocation) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v RemoteLocation) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *RemoteLocation) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *RemoteLocation) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget5(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget6(in *jlexer.Lexer, out *Info) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = ID(in.String())
|
||||
case "type":
|
||||
out.Type = string(in.String())
|
||||
case "title":
|
||||
out.Title = string(in.String())
|
||||
case "url":
|
||||
out.URL = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(out *jwriter.Writer, in Info) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.TargetID != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"targetId\":")
|
||||
out.String(string(in.TargetID))
|
||||
}
|
||||
if in.Type != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"type\":")
|
||||
out.String(string(in.Type))
|
||||
}
|
||||
if in.Title != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"title\":")
|
||||
out.String(string(in.Title))
|
||||
}
|
||||
if in.URL != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"url\":")
|
||||
out.String(string(in.URL))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v Info) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Info) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Info) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget6(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *RemoteLocation) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Info) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget6(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget7(in *jlexer.Lexer, out *GetTargetsReturns) {
|
||||
|
@ -612,18 +612,18 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget7(in *jlexer.Lexer, out
|
|||
} else {
|
||||
in.Delim('[')
|
||||
if !in.IsDelim(']') {
|
||||
out.TargetInfos = make([]*TargetInfo, 0, 8)
|
||||
out.TargetInfos = make([]*Info, 0, 8)
|
||||
} else {
|
||||
out.TargetInfos = []*TargetInfo{}
|
||||
out.TargetInfos = []*Info{}
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v4 *TargetInfo
|
||||
var v4 *Info
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
v4 = nil
|
||||
} else {
|
||||
if v4 == nil {
|
||||
v4 = new(TargetInfo)
|
||||
v4 = new(Info)
|
||||
}
|
||||
(*v4).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget9(in *jlexer.Lexer, out
|
|||
out.TargetInfo = nil
|
||||
} else {
|
||||
if out.TargetInfo == nil {
|
||||
out.TargetInfo = new(TargetInfo)
|
||||
out.TargetInfo = new(Info)
|
||||
}
|
||||
(*out.TargetInfo).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget10(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget11(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget12(in *jlexer.Lexer, out
|
|||
out.TargetInfo = nil
|
||||
} else {
|
||||
if out.TargetInfo == nil {
|
||||
out.TargetInfo = new(TargetInfo)
|
||||
out.TargetInfo = new(Info)
|
||||
}
|
||||
(*out.TargetInfo).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -1072,7 +1072,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget13(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
case "message":
|
||||
out.Message = string(in.String())
|
||||
default:
|
||||
|
@ -1151,7 +1151,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget14(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1225,7 +1225,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget15(in *jlexer.Lexer, out
|
|||
out.TargetInfo = nil
|
||||
} else {
|
||||
if out.TargetInfo == nil {
|
||||
out.TargetInfo = new(TargetInfo)
|
||||
out.TargetInfo = new(Info)
|
||||
}
|
||||
(*out.TargetInfo).UnmarshalEasyJSON(in)
|
||||
}
|
||||
|
@ -1447,7 +1447,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget18(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1514,7 +1514,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget19(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1877,7 +1877,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget24(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -2013,7 +2013,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget26(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -2080,7 +2080,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget27(in *jlexer.Lexer, out
|
|||
}
|
||||
switch key {
|
||||
case "targetId":
|
||||
out.TargetID = TargetID(in.String())
|
||||
out.TargetID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
|
|
@ -3,64 +3,44 @@ package target
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventTargetCreated issued when a possible inspection target is created.
|
||||
type EventTargetCreated struct {
|
||||
TargetInfo *TargetInfo `json:"targetInfo,omitempty"`
|
||||
TargetInfo *Info `json:"targetInfo,omitempty"`
|
||||
}
|
||||
|
||||
// EventTargetDestroyed issued when a target is destroyed.
|
||||
type EventTargetDestroyed struct {
|
||||
TargetID TargetID `json:"targetId,omitempty"`
|
||||
TargetID ID `json:"targetId,omitempty"`
|
||||
}
|
||||
|
||||
// EventAttachedToTarget issued when attached to target because of
|
||||
// auto-attach or attachToTarget command.
|
||||
type EventAttachedToTarget struct {
|
||||
TargetInfo *TargetInfo `json:"targetInfo,omitempty"`
|
||||
TargetInfo *Info `json:"targetInfo,omitempty"`
|
||||
WaitingForDebugger bool `json:"waitingForDebugger,omitempty"`
|
||||
}
|
||||
|
||||
// EventDetachedFromTarget issued when detached from target for any reason
|
||||
// (including detachFromTarget command).
|
||||
type EventDetachedFromTarget struct {
|
||||
TargetID TargetID `json:"targetId,omitempty"`
|
||||
TargetID ID `json:"targetId,omitempty"`
|
||||
}
|
||||
|
||||
// EventReceivedMessageFromTarget notifies about new protocol message from
|
||||
// attached target.
|
||||
type EventReceivedMessageFromTarget struct {
|
||||
TargetID TargetID `json:"targetId,omitempty"`
|
||||
TargetID ID `json:"targetId,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventTargetTargetCreated,
|
||||
EventTargetTargetDestroyed,
|
||||
EventTargetAttachedToTarget,
|
||||
EventTargetDetachedFromTarget,
|
||||
EventTargetReceivedMessageFromTarget,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventTargetTargetCreated,
|
||||
cdp.EventTargetTargetDestroyed,
|
||||
cdp.EventTargetAttachedToTarget,
|
||||
cdp.EventTargetDetachedFromTarget,
|
||||
cdp.EventTargetReceivedMessageFromTarget,
|
||||
}
|
||||
|
|
|
@ -11,30 +11,10 @@ package target
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// SetDiscoverTargetsParams controls whether to discover available targets
|
||||
// and notify via targetCreated/targetDestroyed events.
|
||||
type SetDiscoverTargetsParams struct {
|
||||
|
@ -53,7 +33,7 @@ func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams {
|
|||
}
|
||||
|
||||
// Do executes Target.setDiscoverTargets.
|
||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -65,13 +45,13 @@ func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetSetDiscoverTargets, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -83,10 +63,10 @@ func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetAutoAttachParams controls whether to automatically attach to new
|
||||
|
@ -114,7 +94,7 @@ func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachP
|
|||
}
|
||||
|
||||
// Do executes Target.setAutoAttach.
|
||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -126,13 +106,13 @@ func (p *SetAutoAttachParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetSetAutoAttach, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -144,16 +124,19 @@ func (p *SetAutoAttachParams) Do(ctxt context.Context, h FrameHandler) (err erro
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetAttachToFramesParams [no description].
|
||||
type SetAttachToFramesParams struct {
|
||||
Value bool `json:"value"` // Whether to attach to frames.
|
||||
}
|
||||
|
||||
// SetAttachToFrames [no description].
|
||||
//
|
||||
// parameters:
|
||||
// value - Whether to attach to frames.
|
||||
func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
||||
|
@ -163,7 +146,7 @@ func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
|||
}
|
||||
|
||||
// Do executes Target.setAttachToFrames.
|
||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -175,13 +158,13 @@ func (p *SetAttachToFramesParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetSetAttachToFrames, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -193,10 +176,10 @@ func (p *SetAttachToFramesParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SetRemoteLocationsParams enables target discovery for the specified
|
||||
|
@ -217,7 +200,7 @@ func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams {
|
|||
}
|
||||
|
||||
// Do executes Target.setRemoteLocations.
|
||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -229,13 +212,13 @@ func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetSetRemoteLocations, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -247,10 +230,10 @@ func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h FrameHandler) (err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// SendMessageToTargetParams sends protocol message to the target with given
|
||||
|
@ -263,17 +246,17 @@ type SendMessageToTargetParams struct {
|
|||
// SendMessageToTarget sends protocol message to the target with given id.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
// targetID
|
||||
// message
|
||||
func SendMessageToTarget(targetId string, message string) *SendMessageToTargetParams {
|
||||
func SendMessageToTarget(targetID string, message string) *SendMessageToTargetParams {
|
||||
return &SendMessageToTargetParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.sendMessageToTarget.
|
||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -285,13 +268,13 @@ func (p *SendMessageToTargetParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetSendMessageToTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -303,37 +286,37 @@ func (p *SendMessageToTargetParams) Do(ctxt context.Context, h FrameHandler) (er
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetTargetInfoParams returns information about a target.
|
||||
type GetTargetInfoParams struct {
|
||||
TargetID TargetID `json:"targetId"`
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// GetTargetInfo returns information about a target.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
func GetTargetInfo(targetId TargetID) *GetTargetInfoParams {
|
||||
// targetID
|
||||
func GetTargetInfo(targetID ID) *GetTargetInfoParams {
|
||||
return &GetTargetInfoParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// GetTargetInfoReturns return values.
|
||||
type GetTargetInfoReturns struct {
|
||||
TargetInfo *TargetInfo `json:"targetInfo,omitempty"`
|
||||
TargetInfo *Info `json:"targetInfo,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Target.getTargetInfo.
|
||||
//
|
||||
// returns:
|
||||
// targetInfo
|
||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h FrameHandler) (targetInfo *TargetInfo, err error) {
|
||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetInfo *Info, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -345,13 +328,13 @@ func (p *GetTargetInfoParams) Do(ctxt context.Context, h FrameHandler) (targetIn
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetGetTargetInfo, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -360,7 +343,7 @@ func (p *GetTargetInfoParams) Do(ctxt context.Context, h FrameHandler) (targetIn
|
|||
var r GetTargetInfoReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.TargetInfo, nil
|
||||
|
@ -370,29 +353,29 @@ func (p *GetTargetInfoParams) Do(ctxt context.Context, h FrameHandler) (targetIn
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// ActivateTargetParams activates (focuses) the target.
|
||||
type ActivateTargetParams struct {
|
||||
TargetID TargetID `json:"targetId"`
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// ActivateTarget activates (focuses) the target.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
func ActivateTarget(targetId TargetID) *ActivateTargetParams {
|
||||
// targetID
|
||||
func ActivateTarget(targetID ID) *ActivateTargetParams {
|
||||
return &ActivateTargetParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.activateTarget.
|
||||
func (p *ActivateTargetParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -404,13 +387,13 @@ func (p *ActivateTargetParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetActivateTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetActivateTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -422,26 +405,26 @@ func (p *ActivateTargetParams) Do(ctxt context.Context, h FrameHandler) (err err
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CloseTargetParams closes the target. If the target is a page that gets
|
||||
// closed too.
|
||||
type CloseTargetParams struct {
|
||||
TargetID TargetID `json:"targetId"`
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// CloseTarget closes the target. If the target is a page that gets closed
|
||||
// too.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
func CloseTarget(targetId TargetID) *CloseTargetParams {
|
||||
// targetID
|
||||
func CloseTarget(targetID ID) *CloseTargetParams {
|
||||
return &CloseTargetParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,7 +437,7 @@ type CloseTargetReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// success
|
||||
func (p *CloseTargetParams) Do(ctxt context.Context, h FrameHandler) (success bool, err error) {
|
||||
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -466,13 +449,13 @@ func (p *CloseTargetParams) Do(ctxt context.Context, h FrameHandler) (success bo
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetCloseTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetCloseTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -481,7 +464,7 @@ func (p *CloseTargetParams) Do(ctxt context.Context, h FrameHandler) (success bo
|
|||
var r CloseTargetReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Success, nil
|
||||
|
@ -491,24 +474,24 @@ func (p *CloseTargetParams) Do(ctxt context.Context, h FrameHandler) (success bo
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// AttachToTargetParams attaches to the target with given id.
|
||||
type AttachToTargetParams struct {
|
||||
TargetID TargetID `json:"targetId"`
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// AttachToTarget attaches to the target with given id.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
func AttachToTarget(targetId TargetID) *AttachToTargetParams {
|
||||
// targetID
|
||||
func AttachToTarget(targetID ID) *AttachToTargetParams {
|
||||
return &AttachToTargetParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,7 +504,7 @@ type AttachToTargetReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// success - Whether attach succeeded.
|
||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h FrameHandler) (success bool, err error) {
|
||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -533,13 +516,13 @@ func (p *AttachToTargetParams) Do(ctxt context.Context, h FrameHandler) (success
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetAttachToTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetAttachToTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -548,7 +531,7 @@ func (p *AttachToTargetParams) Do(ctxt context.Context, h FrameHandler) (success
|
|||
var r AttachToTargetReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Success, nil
|
||||
|
@ -558,29 +541,29 @@ func (p *AttachToTargetParams) Do(ctxt context.Context, h FrameHandler) (success
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DetachFromTargetParams detaches from the target with given id.
|
||||
type DetachFromTargetParams struct {
|
||||
TargetID TargetID `json:"targetId"`
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// DetachFromTarget detaches from the target with given id.
|
||||
//
|
||||
// parameters:
|
||||
// targetId
|
||||
func DetachFromTarget(targetId TargetID) *DetachFromTargetParams {
|
||||
// targetID
|
||||
func DetachFromTarget(targetID ID) *DetachFromTargetParams {
|
||||
return &DetachFromTargetParams{
|
||||
TargetID: targetId,
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.detachFromTarget.
|
||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -592,13 +575,13 @@ func (p *DetachFromTargetParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetDetachFromTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -610,10 +593,10 @@ func (p *DetachFromTargetParams) Do(ctxt context.Context, h FrameHandler) (err e
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CreateBrowserContextParams creates a new empty BrowserContext. Similar to
|
||||
|
@ -634,20 +617,20 @@ type CreateBrowserContextReturns struct {
|
|||
// Do executes Target.createBrowserContext.
|
||||
//
|
||||
// returns:
|
||||
// browserContextId - The id of the context created.
|
||||
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (browserContextId BrowserContextID, err error) {
|
||||
// browserContextID - The id of the context created.
|
||||
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandler) (browserContextID BrowserContextID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetCreateBrowserContext, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetCreateBrowserContext, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -656,7 +639,7 @@ func (p *CreateBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (b
|
|||
var r CreateBrowserContextReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.BrowserContextID, nil
|
||||
|
@ -666,10 +649,10 @@ func (p *CreateBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (b
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
||||
|
@ -682,10 +665,10 @@ type DisposeBrowserContextParams struct {
|
|||
// uses it.
|
||||
//
|
||||
// parameters:
|
||||
// browserContextId
|
||||
func DisposeBrowserContext(browserContextId BrowserContextID) *DisposeBrowserContextParams {
|
||||
// browserContextID
|
||||
func DisposeBrowserContext(browserContextID BrowserContextID) *DisposeBrowserContextParams {
|
||||
return &DisposeBrowserContextParams{
|
||||
BrowserContextID: browserContextId,
|
||||
BrowserContextID: browserContextID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +681,7 @@ type DisposeBrowserContextReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// success
|
||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (success bool, err error) {
|
||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -710,13 +693,13 @@ func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetDisposeBrowserContext, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return false, ErrChannelClosed
|
||||
return false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -725,7 +708,7 @@ func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
var r DisposeBrowserContextReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return false, ErrInvalidResult
|
||||
return false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Success, nil
|
||||
|
@ -735,10 +718,10 @@ func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return false, ErrContextDone
|
||||
return false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return false, ErrUnknownResult
|
||||
return false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// CreateTargetParams creates a new page.
|
||||
|
@ -773,21 +756,21 @@ func (p CreateTargetParams) WithHeight(height int64) *CreateTargetParams {
|
|||
|
||||
// WithBrowserContextID the browser context to create the page in (headless
|
||||
// chrome only).
|
||||
func (p CreateTargetParams) WithBrowserContextID(browserContextId BrowserContextID) *CreateTargetParams {
|
||||
p.BrowserContextID = browserContextId
|
||||
func (p CreateTargetParams) WithBrowserContextID(browserContextID BrowserContextID) *CreateTargetParams {
|
||||
p.BrowserContextID = browserContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// CreateTargetReturns return values.
|
||||
type CreateTargetReturns struct {
|
||||
TargetID TargetID `json:"targetId,omitempty"` // The id of the page opened.
|
||||
TargetID ID `json:"targetId,omitempty"` // The id of the page opened.
|
||||
}
|
||||
|
||||
// Do executes Target.createTarget.
|
||||
//
|
||||
// returns:
|
||||
// targetId - The id of the page opened.
|
||||
func (p *CreateTargetParams) Do(ctxt context.Context, h FrameHandler) (targetId TargetID, err error) {
|
||||
// targetID - The id of the page opened.
|
||||
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetID ID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -799,13 +782,13 @@ func (p *CreateTargetParams) Do(ctxt context.Context, h FrameHandler) (targetId
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetCreateTarget, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetCreateTarget, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", ErrChannelClosed
|
||||
return "", cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -814,7 +797,7 @@ func (p *CreateTargetParams) Do(ctxt context.Context, h FrameHandler) (targetId
|
|||
var r CreateTargetReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", ErrInvalidResult
|
||||
return "", cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.TargetID, nil
|
||||
|
@ -824,10 +807,10 @@ func (p *CreateTargetParams) Do(ctxt context.Context, h FrameHandler) (targetId
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", ErrUnknownResult
|
||||
return "", cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetTargetsParams retrieves a list of available targets.
|
||||
|
@ -840,26 +823,26 @@ func GetTargets() *GetTargetsParams {
|
|||
|
||||
// GetTargetsReturns return values.
|
||||
type GetTargetsReturns struct {
|
||||
TargetInfos []*TargetInfo `json:"targetInfos,omitempty"` // The list of targets.
|
||||
TargetInfos []*Info `json:"targetInfos,omitempty"` // The list of targets.
|
||||
}
|
||||
|
||||
// Do executes Target.getTargets.
|
||||
//
|
||||
// returns:
|
||||
// targetInfos - The list of targets.
|
||||
func (p *GetTargetsParams) Do(ctxt context.Context, h FrameHandler) (targetInfos []*TargetInfo, err error) {
|
||||
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetInfos []*Info, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTargetGetTargets, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetGetTargets, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -868,7 +851,7 @@ func (p *GetTargetsParams) Do(ctxt context.Context, h FrameHandler) (targetInfos
|
|||
var r GetTargetsReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.TargetInfos, nil
|
||||
|
@ -878,8 +861,8 @@ func (p *GetTargetsParams) Do(ctxt context.Context, h FrameHandler) (targetInfos
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -2,37 +2,15 @@ package target
|
|||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
// ID [no description].
|
||||
type ID string
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
type TargetID string
|
||||
|
||||
// String returns the TargetID as string value.
|
||||
func (t TargetID) String() string {
|
||||
// String returns the ID as string value.
|
||||
func (t ID) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// BrowserContextID [no description].
|
||||
type BrowserContextID string
|
||||
|
||||
// String returns the BrowserContextID as string value.
|
||||
|
@ -40,13 +18,15 @@ func (t BrowserContextID) String() string {
|
|||
return string(t)
|
||||
}
|
||||
|
||||
type TargetInfo struct {
|
||||
TargetID TargetID `json:"targetId,omitempty"`
|
||||
// Info [no description].
|
||||
type Info struct {
|
||||
TargetID ID `json:"targetId,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// RemoteLocation [no description].
|
||||
type RemoteLocation struct {
|
||||
Host string `json:"host,omitempty"`
|
||||
Port int64 `json:"port,omitempty"`
|
||||
|
|
|
@ -3,27 +3,7 @@ package tethering
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventAccepted informs that port was successfully bound and got a specified
|
||||
|
@ -33,7 +13,7 @@ type EventAccepted struct {
|
|||
ConnectionID string `json:"connectionId,omitempty"` // Connection id to be used.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventTetheringAccepted,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventTetheringAccepted,
|
||||
}
|
||||
|
|
|
@ -11,30 +11,10 @@ package tethering
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// BindParams request browser port binding.
|
||||
type BindParams struct {
|
||||
Port int64 `json:"port"` // Port number to bind.
|
||||
|
@ -51,7 +31,7 @@ func Bind(port int64) *BindParams {
|
|||
}
|
||||
|
||||
// Do executes Tethering.bind.
|
||||
func (p *BindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *BindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -63,13 +43,13 @@ func (p *BindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTetheringBind, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTetheringBind, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -81,10 +61,10 @@ func (p *BindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// UnbindParams request browser port unbinding.
|
||||
|
@ -103,7 +83,7 @@ func Unbind(port int64) *UnbindParams {
|
|||
}
|
||||
|
||||
// Do executes Tethering.unbind.
|
||||
func (p *UnbindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *UnbindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -115,13 +95,13 @@ func (p *UnbindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTetheringUnbind, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTetheringUnbind, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -133,8 +113,8 @@ func (p *UnbindParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -3,31 +3,11 @@ package tracing
|
|||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/io"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// EventDataCollected contains an bucket of collected trace events. When
|
||||
// tracing is stopped collected events will be send as a sequence of
|
||||
// dataCollected events followed by tracingComplete event.
|
||||
|
@ -41,15 +21,16 @@ type EventTracingComplete struct {
|
|||
Stream io.StreamHandle `json:"stream,omitempty"` // A handle of the stream that holds resulting trace data.
|
||||
}
|
||||
|
||||
// EventBufferUsage [no description].
|
||||
type EventBufferUsage struct {
|
||||
PercentFull float64 `json:"percentFull,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
EventCount float64 `json:"eventCount,omitempty"` // An approximate number of events in the trace log.
|
||||
Value float64 `json:"value,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
}
|
||||
|
||||
// EventTypes is all event types in the domain.
|
||||
var EventTypes = []MethodType{
|
||||
EventTracingDataCollected,
|
||||
EventTracingTracingComplete,
|
||||
EventTracingBufferUsage,
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventTracingDataCollected,
|
||||
cdp.EventTracingTracingComplete,
|
||||
cdp.EventTracingBufferUsage,
|
||||
}
|
||||
|
|
|
@ -9,30 +9,10 @@ package tracing
|
|||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
|
||||
// StartParams start trace events collection.
|
||||
type StartParams struct {
|
||||
BufferUsageReportingInterval float64 `json:"bufferUsageReportingInterval,omitempty"` // If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
|
||||
|
@ -61,13 +41,14 @@ func (p StartParams) WithTransferMode(transferMode TransferMode) *StartParams {
|
|||
return &p
|
||||
}
|
||||
|
||||
// WithTraceConfig [no description].
|
||||
func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams {
|
||||
p.TraceConfig = traceConfig
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Tracing.start.
|
||||
func (p *StartParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -79,13 +60,13 @@ func (p *StartParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTracingStart, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingStart, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -97,10 +78,10 @@ func (p *StartParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// EndParams stop trace events collection.
|
||||
|
@ -112,19 +93,19 @@ func End() *EndParams {
|
|||
}
|
||||
|
||||
// Do executes Tracing.end.
|
||||
func (p *EndParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *EndParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTracingEnd, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingEnd, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -136,10 +117,10 @@ func (p *EndParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// GetCategoriesParams gets supported tracing categories.
|
||||
|
@ -159,19 +140,19 @@ type GetCategoriesReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// categories - A list of supported tracing categories.
|
||||
func (p *GetCategoriesParams) Do(ctxt context.Context, h FrameHandler) (categories []string, err error) {
|
||||
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (categories []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTracingGetCategories, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingGetCategories, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, ErrChannelClosed
|
||||
return nil, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -180,7 +161,7 @@ func (p *GetCategoriesParams) Do(ctxt context.Context, h FrameHandler) (categori
|
|||
var r GetCategoriesReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidResult
|
||||
return nil, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.Categories, nil
|
||||
|
@ -190,10 +171,10 @@ func (p *GetCategoriesParams) Do(ctxt context.Context, h FrameHandler) (categori
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return nil, ErrUnknownResult
|
||||
return nil, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RequestMemoryDumpParams request a global memory dump.
|
||||
|
@ -213,21 +194,21 @@ type RequestMemoryDumpReturns struct {
|
|||
// Do executes Tracing.requestMemoryDump.
|
||||
//
|
||||
// returns:
|
||||
// dumpGuid - GUID of the resulting global memory dump.
|
||||
// dumpGUID - GUID of the resulting global memory dump.
|
||||
// success - True iff the global memory dump succeeded.
|
||||
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h FrameHandler) (dumpGuid string, success bool, err error) {
|
||||
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.FrameHandler) (dumpGUID string, success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTracingRequestMemoryDump, Empty)
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingRequestMemoryDump, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return "", false, ErrChannelClosed
|
||||
return "", false, cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -236,7 +217,7 @@ func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h FrameHandler) (dump
|
|||
var r RequestMemoryDumpReturns
|
||||
err = easyjson.Unmarshal(v, &r)
|
||||
if err != nil {
|
||||
return "", false, ErrInvalidResult
|
||||
return "", false, cdp.ErrInvalidResult
|
||||
}
|
||||
|
||||
return r.DumpGUID, r.Success, nil
|
||||
|
@ -246,10 +227,10 @@ func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h FrameHandler) (dump
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", false, ErrContextDone
|
||||
return "", false, cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return "", false, ErrUnknownResult
|
||||
return "", false, cdp.ErrUnknownResult
|
||||
}
|
||||
|
||||
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
|
||||
|
@ -260,15 +241,15 @@ type RecordClockSyncMarkerParams struct {
|
|||
// RecordClockSyncMarker record a clock sync marker in the trace.
|
||||
//
|
||||
// parameters:
|
||||
// syncId - The ID of this clock sync marker
|
||||
func RecordClockSyncMarker(syncId string) *RecordClockSyncMarkerParams {
|
||||
// syncID - The ID of this clock sync marker
|
||||
func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams {
|
||||
return &RecordClockSyncMarkerParams{
|
||||
SyncID: syncId,
|
||||
SyncID: syncID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Tracing.recordClockSyncMarker.
|
||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
@ -280,13 +261,13 @@ func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, CommandTracingRecordClockSyncMarker, easyjson.RawMessage(buf))
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return ErrChannelClosed
|
||||
return cdp.ErrChannelClosed
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
|
@ -298,8 +279,8 @@ func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h FrameHandler) (
|
|||
}
|
||||
|
||||
case <-ctxt.Done():
|
||||
return ErrContextDone
|
||||
return cdp.ErrContextDone
|
||||
}
|
||||
|
||||
return ErrUnknownResult
|
||||
return cdp.ErrUnknownResult
|
||||
}
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
package tracing
|
||||
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
"github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
var (
|
||||
_ BackendNode
|
||||
_ BackendNodeID
|
||||
_ ComputedProperty
|
||||
_ ErrorType
|
||||
_ Frame
|
||||
_ FrameID
|
||||
_ LoaderID
|
||||
_ Message
|
||||
_ MessageError
|
||||
_ MethodType
|
||||
_ Node
|
||||
_ NodeID
|
||||
_ NodeType
|
||||
_ PseudoType
|
||||
_ RGBA
|
||||
_ ShadowRootType
|
||||
_ Timestamp
|
||||
)
|
||||
// AUTOGENERATED. DO NOT EDIT.
|
||||
|
||||
// MemoryDumpConfig configuration for memory dump. Used only when
|
||||
// "memory-infra" category is enabled.
|
||||
type MemoryDumpConfig struct{}
|
||||
|
||||
// TraceConfig [no description].
|
||||
type TraceConfig struct {
|
||||
RecordMode RecordMode `json:"recordMode,omitempty"` // Controls how the trace buffer stores data.
|
||||
EnableSampling bool `json:"enableSampling,omitempty"` // Turns on JavaScript stack sampling.
|
||||
|
|
802
cdp/util/util.go
802
cdp/util/util.go
File diff suppressed because it is too large
Load Diff
36
chromedp.go
36
chromedp.go
|
@ -13,7 +13,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
. "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/client"
|
||||
"github.com/knq/chromedp/runner"
|
||||
)
|
||||
|
@ -40,10 +40,10 @@ type CDP struct {
|
|||
watch <-chan client.Target
|
||||
|
||||
// cur is the current active target's handler.
|
||||
cur FrameHandler
|
||||
cur cdp.FrameHandler
|
||||
|
||||
// handlers is the active handlers.
|
||||
handlers []FrameHandler
|
||||
handlers []cdp.FrameHandler
|
||||
|
||||
// handlerMap is the map of target IDs to its active handler.
|
||||
handlerMap map[string]int
|
||||
|
@ -56,7 +56,7 @@ func New(ctxt context.Context, opts ...Option) (*CDP, error) {
|
|||
var err error
|
||||
|
||||
c := &CDP{
|
||||
handlers: make([]FrameHandler, 0),
|
||||
handlers: make([]cdp.FrameHandler, 0),
|
||||
handlerMap: make(map[string]int),
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ loop:
|
|||
time.Sleep(DefaultCheckDuration)
|
||||
|
||||
case <-ctxt.Done():
|
||||
return nil, ErrContextDone
|
||||
return nil, cdp.ErrContextDone
|
||||
|
||||
case <-timeout:
|
||||
break loop
|
||||
|
@ -163,7 +163,7 @@ func (c *CDP) Wait() error {
|
|||
}
|
||||
|
||||
// Shutdown closes all Chrome page handlers.
|
||||
func (c *CDP) Shutdown(ctxt context.Context, opts ...client.ClientOption) error {
|
||||
func (c *CDP) Shutdown(ctxt context.Context, opts ...client.Option) error {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
|
@ -186,7 +186,7 @@ func (c *CDP) ListTargets() []string {
|
|||
}
|
||||
|
||||
// GetHandlerByIndex retrieves the domains manager for the specified index.
|
||||
func (c *CDP) GetHandlerByIndex(i int) FrameHandler {
|
||||
func (c *CDP) GetHandlerByIndex(i int) cdp.FrameHandler {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
|
@ -198,7 +198,7 @@ func (c *CDP) GetHandlerByIndex(i int) FrameHandler {
|
|||
}
|
||||
|
||||
// GetHandlerByID retrieves the domains manager for the specified target ID.
|
||||
func (c *CDP) GetHandlerByID(id string) FrameHandler {
|
||||
func (c *CDP) GetHandlerByID(id string) cdp.FrameHandler {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
|
@ -238,7 +238,7 @@ func (c *CDP) SetHandlerByID(id string) error {
|
|||
// newTarget creates a new target using supplied context and options, returning
|
||||
// the id of the created target only after the target has been started for
|
||||
// monitoring.
|
||||
func (c *CDP) newTarget(ctxt context.Context, opts ...client.ClientOption) (string, error) {
|
||||
func (c *CDP) newTarget(ctxt context.Context, opts ...client.Option) (string, error) {
|
||||
c.RLock()
|
||||
cl := c.r.Client(opts...)
|
||||
c.RUnlock()
|
||||
|
@ -267,7 +267,7 @@ loop:
|
|||
time.Sleep(DefaultCheckDuration)
|
||||
|
||||
case <-ctxt.Done():
|
||||
return "", ErrContextDone
|
||||
return "", cdp.ErrContextDone
|
||||
|
||||
case <-timeout:
|
||||
break loop
|
||||
|
@ -280,7 +280,7 @@ loop:
|
|||
// SetTarget is an action that sets the active Chrome handler to the specified
|
||||
// index i.
|
||||
func (c *CDP) SetTarget(i int) Action {
|
||||
return ActionFunc(func(context.Context, FrameHandler) error {
|
||||
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
|
||||
return c.SetHandler(i)
|
||||
})
|
||||
}
|
||||
|
@ -288,15 +288,15 @@ func (c *CDP) SetTarget(i int) Action {
|
|||
// SetTargetByID is an action that sets the active Chrome handler to the handler
|
||||
// associated with the specified id.
|
||||
func (c *CDP) SetTargetByID(id string) Action {
|
||||
return ActionFunc(func(context.Context, FrameHandler) error {
|
||||
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
|
||||
return c.SetHandlerByID(id)
|
||||
})
|
||||
}
|
||||
|
||||
// NewTarget is an action that creates a new Chrome target, and sets it as the
|
||||
// active target.
|
||||
func (c *CDP) NewTarget(id *string, opts ...client.ClientOption) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h FrameHandler) error {
|
||||
func (c *CDP) NewTarget(id *string, opts ...client.Option) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
n, err := c.newTarget(ctxt, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -312,8 +312,8 @@ func (c *CDP) NewTarget(id *string, opts ...client.ClientOption) Action {
|
|||
|
||||
// NewTargetWithURL creates a new Chrome target, sets it as the active target,
|
||||
// and then navigates to the specified url.
|
||||
func (c *CDP) NewTargetWithURL(urlstr string, id *string, opts ...client.ClientOption) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h FrameHandler) error {
|
||||
func (c *CDP) NewTargetWithURL(urlstr string, id *string, opts ...client.Option) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
n, err := c.newTarget(ctxt, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -339,14 +339,14 @@ func (c *CDP) NewTargetWithURL(urlstr string, id *string, opts ...client.ClientO
|
|||
|
||||
// CloseByIndex closes the Chrome target with specified index i.
|
||||
func (c *CDP) CloseByIndex(i int) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h FrameHandler) error {
|
||||
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// CloseByID closes the Chrome target with the specified id.
|
||||
func (c *CDP) CloseByID(id string) Action {
|
||||
return ActionFunc(func(ctxt context.Context, h FrameHandler) error {
|
||||
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ type Client struct {
|
|||
}
|
||||
|
||||
// New creates a new Chrome Debugging Protocol client.
|
||||
func New(opts ...ClientOption) *Client {
|
||||
func New(opts ...Option) *Client {
|
||||
c := &Client{
|
||||
url: DefaultURL,
|
||||
check: DefaultWatchInterval,
|
||||
|
@ -294,25 +294,25 @@ func (c *Client) WatchPageTargets(ctxt context.Context) <-chan Target {
|
|||
return ch
|
||||
}
|
||||
|
||||
// ClientOption is a Chrome Debugging Protocol client option.
|
||||
type ClientOption func(*Client)
|
||||
// Option is a Chrome Debugging Protocol client option.
|
||||
type Option func(*Client)
|
||||
|
||||
// URL is a client option to specify the remote Chrome instance to connect to.
|
||||
func URL(url string) ClientOption {
|
||||
func URL(url string) Option {
|
||||
return func(c *Client) {
|
||||
c.url = url
|
||||
}
|
||||
}
|
||||
|
||||
// WatchInterval is a client option that specifies the check interval duration.
|
||||
func WatchInterval(check time.Duration) ClientOption {
|
||||
func WatchInterval(check time.Duration) Option {
|
||||
return func(c *Client) {
|
||||
c.check = check
|
||||
}
|
||||
}
|
||||
|
||||
// WatchTimeout is a client option that specifies the watch timeout duration.
|
||||
func WatchTimeout(timeout time.Duration) ClientOption {
|
||||
func WatchTimeout(timeout time.Duration) Option {
|
||||
return func(c *Client) {
|
||||
c.timeout = timeout
|
||||
}
|
||||
|
|
|
@ -4,14 +4,13 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
. "github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/templates"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// set the internal types
|
||||
SetInternalTypes(map[string]bool{
|
||||
"CSS.ComputedProperty": true,
|
||||
internal.SetCDPTypes(map[string]bool{
|
||||
"DOM.BackendNodeId": true,
|
||||
"DOM.BackendNode": true,
|
||||
"DOM.NodeId": true,
|
||||
|
@ -35,7 +34,6 @@ func init() {
|
|||
const (
|
||||
domNodeIDRef = "NodeID"
|
||||
domNodeRef = "*Node"
|
||||
cssComputedStylePropertyRef = "*ComputedProperty"
|
||||
)
|
||||
|
||||
// FixupDomains changes types in the domains, so that the generated code is
|
||||
|
@ -58,30 +56,30 @@ const (
|
|||
// - add special unmarshaler to NodeId, BackendNodeId, FrameId to handle values from older (v1.1) protocol versions. -- NOTE: this might need to be applied to more types, such as network.LoaderId
|
||||
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
|
||||
// - rename CSS.CSS* types.
|
||||
func FixupDomains(domains []*Domain) {
|
||||
func FixupDomains(domains []*internal.Domain) {
|
||||
// method type
|
||||
methodType := &Type{
|
||||
methodType := &internal.Type{
|
||||
ID: "MethodType",
|
||||
Type: TypeString,
|
||||
Type: internal.TypeString,
|
||||
Description: "Chrome Debugging Protocol method type (ie, event and command names).",
|
||||
EnumValueNameMap: make(map[string]string),
|
||||
Extra: templates.ExtraMethodTypeDomainDecoder(),
|
||||
}
|
||||
|
||||
// message error type
|
||||
messageErrorType := &Type{
|
||||
messageErrorType := &internal.Type{
|
||||
ID: "MessageError",
|
||||
Type: TypeObject,
|
||||
Type: internal.TypeObject,
|
||||
Description: "Message error type.",
|
||||
Properties: []*Type{
|
||||
&Type{
|
||||
Properties: []*internal.Type{
|
||||
&internal.Type{
|
||||
Name: "code",
|
||||
Type: TypeInteger,
|
||||
Type: internal.TypeInteger,
|
||||
Description: "Error code.",
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "message",
|
||||
Type: TypeString,
|
||||
Type: internal.TypeString,
|
||||
Description: "Error message.",
|
||||
},
|
||||
},
|
||||
|
@ -89,32 +87,32 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
|
||||
// message type
|
||||
messageType := &Type{
|
||||
messageType := &internal.Type{
|
||||
ID: "Message",
|
||||
Type: TypeObject,
|
||||
Type: internal.TypeObject,
|
||||
Description: "Chrome Debugging Protocol message sent to/read over websocket connection.",
|
||||
Properties: []*Type{
|
||||
&Type{
|
||||
Properties: []*internal.Type{
|
||||
&internal.Type{
|
||||
Name: "id",
|
||||
Type: TypeInteger,
|
||||
Type: internal.TypeInteger,
|
||||
Description: "Unique message identifier.",
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "method",
|
||||
Ref: "Inspector.MethodType",
|
||||
Description: "Event or command type.",
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "params",
|
||||
Type: TypeAny,
|
||||
Type: internal.TypeAny,
|
||||
Description: "Event or command parameters.",
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "result",
|
||||
Type: TypeAny,
|
||||
Type: internal.TypeAny,
|
||||
Description: "Command return values.",
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "error",
|
||||
Ref: "MessageError",
|
||||
Description: "Error message.",
|
||||
|
@ -123,9 +121,9 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
|
||||
// detach reason type
|
||||
detachReasonType := &Type{
|
||||
detachReasonType := &internal.Type{
|
||||
ID: "DetachReason",
|
||||
Type: TypeString,
|
||||
Type: internal.TypeString,
|
||||
Enum: []string{"target_closed", "canceled_by_user", "replaced_with_devtools", "Render process gone."},
|
||||
Description: "Detach reason.",
|
||||
}
|
||||
|
@ -134,21 +132,21 @@ func FixupDomains(domains []*Domain) {
|
|||
errorValues := []string{"context done", "channel closed", "invalid result", "unknown result"}
|
||||
errorValueNameMap := make(map[string]string)
|
||||
for _, e := range errorValues {
|
||||
errorValueNameMap[e] = "Err" + ForceCamel(e)
|
||||
errorValueNameMap[e] = "Err" + internal.ForceCamel(e)
|
||||
}
|
||||
errorType := &Type{
|
||||
errorType := &internal.Type{
|
||||
ID: "ErrorType",
|
||||
Type: TypeString,
|
||||
Type: internal.TypeString,
|
||||
Enum: errorValues,
|
||||
EnumValueNameMap: errorValueNameMap,
|
||||
Description: "Error type.",
|
||||
Extra: templates.ExtraInternalTypes(),
|
||||
Extra: templates.ExtraCDPTypes(),
|
||||
}
|
||||
|
||||
// modifier type
|
||||
modifierType := &Type{
|
||||
modifierType := &internal.Type{
|
||||
ID: "Modifier",
|
||||
Type: TypeInteger,
|
||||
Type: internal.TypeInteger,
|
||||
EnumBitMask: true,
|
||||
Description: "Input key modifier type.",
|
||||
Enum: []string{"None", "Alt", "Ctrl", "Meta", "Shift"},
|
||||
|
@ -156,9 +154,9 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
|
||||
// node type type -- see: https://developer.mozilla.org/en/docs/Web/API/Node/nodeType
|
||||
nodeTypeType := &Type{
|
||||
nodeTypeType := &internal.Type{
|
||||
ID: "NodeType",
|
||||
Type: TypeInteger,
|
||||
Type: internal.TypeInteger,
|
||||
Description: "Node type.",
|
||||
Enum: []string{
|
||||
"Element", "Attribute", "Text", "CDATA", "EntityReference",
|
||||
|
@ -170,7 +168,7 @@ func FixupDomains(domains []*Domain) {
|
|||
// process domains
|
||||
for _, d := range domains {
|
||||
switch d.Domain {
|
||||
case DomainInspector:
|
||||
case internal.DomainInspector:
|
||||
// add Inspector types
|
||||
d.Types = append(d.Types, messageErrorType, messageType, methodType, detachReasonType, errorType)
|
||||
|
||||
|
@ -180,7 +178,7 @@ func FixupDomains(domains []*Domain) {
|
|||
for _, t := range e.Parameters {
|
||||
if t.Name == "reason" {
|
||||
t.Ref = "DetachReason"
|
||||
t.Type = TypeEnum("")
|
||||
t.Type = internal.TypeEnum("")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -188,16 +186,14 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
}
|
||||
|
||||
case DomainCSS:
|
||||
case internal.DomainCSS:
|
||||
for _, t := range d.Types {
|
||||
if t.ID == "CSSComputedStyleProperty" {
|
||||
t.ID = "ComputedProperty"
|
||||
} else {
|
||||
t.ID = strings.TrimPrefix(t.ID, "CSS")
|
||||
}
|
||||
}
|
||||
|
||||
case DomainInput:
|
||||
case internal.DomainInput:
|
||||
// add Input types
|
||||
d.Types = append(d.Types, modifierType)
|
||||
for _, t := range d.Types {
|
||||
|
@ -206,67 +202,39 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
}
|
||||
|
||||
case DomainDOM:
|
||||
case internal.DomainDOM:
|
||||
// add DOM types
|
||||
d.Types = append(d.Types, nodeTypeType)
|
||||
|
||||
for _, t := range d.Types {
|
||||
switch t.ID {
|
||||
case "NodeId", "BackendNodeId":
|
||||
t.Extra += templates.ExtraFixStringUnmarshaler(ForceCamel(t.ID), "ParseInt", ", 10, 64")
|
||||
t.Extra += templates.ExtraFixStringUnmarshaler(internal.ForceCamel(t.ID), "ParseInt", ", 10, 64")
|
||||
|
||||
case "Node":
|
||||
t.Properties = append(t.Properties,
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "Parent",
|
||||
Ref: domNodeRef,
|
||||
Description: "Parent node.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
/*&Type{
|
||||
Name: "Ready",
|
||||
Ref: "chan struct{}",
|
||||
Description: "Ready channel.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},*/
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "Invalidated",
|
||||
Ref: "chan struct{}",
|
||||
Description: "Invalidated channel.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "State",
|
||||
Ref: "NodeState",
|
||||
Description: "Node state.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
/*&Type{
|
||||
Name: "ComputedStyle",
|
||||
Ref: "[]" + cssComputedStylePropertyRef,
|
||||
Description: "Computed style.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
Name: "Valid",
|
||||
Ref: "bool",
|
||||
Description: "Valid state.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
Name: "Hidden",
|
||||
Ref: "bool",
|
||||
Description: "Hidden state.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},*/
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "",
|
||||
Ref: "sync.RWMutex",
|
||||
Description: "Read write mutex.",
|
||||
|
@ -280,36 +248,36 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
}
|
||||
|
||||
case DomainPage:
|
||||
case internal.DomainPage:
|
||||
for _, t := range d.Types {
|
||||
switch t.ID {
|
||||
case "FrameId":
|
||||
t.Extra += templates.ExtraFixStringUnmarshaler(ForceCamel(t.ID), "", "")
|
||||
t.Extra += templates.ExtraFixStringUnmarshaler(internal.ForceCamel(t.ID), "", "")
|
||||
|
||||
case "Frame":
|
||||
t.Properties = append(t.Properties,
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "State",
|
||||
Ref: "FrameState",
|
||||
Description: "Frame state.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "Root",
|
||||
Ref: domNodeRef,
|
||||
Description: "Frame document root.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "Nodes",
|
||||
Ref: "map[" + domNodeIDRef + "]" + domNodeRef,
|
||||
Description: "Frame nodes.",
|
||||
NoResolve: true,
|
||||
NoExpose: true,
|
||||
},
|
||||
&Type{
|
||||
&internal.Type{
|
||||
Name: "",
|
||||
Ref: "sync.RWMutex",
|
||||
Description: "Read write mutex.",
|
||||
|
@ -323,23 +291,23 @@ func FixupDomains(domains []*Domain) {
|
|||
for _, p := range t.Properties {
|
||||
if p.Name == "id" || p.Name == "parentId" {
|
||||
p.Ref = "FrameId"
|
||||
p.Type = TypeEnum("")
|
||||
p.Type = internal.TypeEnum("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case DomainNetwork:
|
||||
case internal.DomainNetwork:
|
||||
for _, t := range d.Types {
|
||||
// change Timestamp to TypeTimestamp and add extra unmarshaling template
|
||||
if t.ID == "Timestamp" {
|
||||
t.Type = TypeTimestamp
|
||||
t.Type = internal.TypeTimestamp
|
||||
t.Extra += templates.ExtraTimestampTemplate(t, d)
|
||||
}
|
||||
}
|
||||
|
||||
case DomainRuntime:
|
||||
var types []*Type
|
||||
case internal.DomainRuntime:
|
||||
var types []*internal.Type
|
||||
for _, t := range d.Types {
|
||||
if t.ID == "Timestamp" {
|
||||
continue
|
||||
|
@ -357,11 +325,11 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
|
||||
// process events and commands
|
||||
processTypesWithParameters(methodType, d, d.Events, EventMethodPrefix, EventMethodSuffix)
|
||||
processTypesWithParameters(methodType, d, d.Commands, CommandMethodPrefix, CommandMethodSuffix)
|
||||
processTypesWithParameters(methodType, d, d.Events, internal.EventMethodPrefix, internal.EventMethodSuffix)
|
||||
processTypesWithParameters(methodType, d, d.Commands, internal.CommandMethodPrefix, internal.CommandMethodSuffix)
|
||||
|
||||
// fix input enums
|
||||
if d.Domain == DomainInput {
|
||||
if d.Domain == internal.DomainInput {
|
||||
for _, t := range d.Types {
|
||||
if t.Enum != nil && t.ID != "Modifier" {
|
||||
t.EnumValueNameMap = make(map[string]string)
|
||||
|
@ -373,7 +341,7 @@ func FixupDomains(domains []*Domain) {
|
|||
case "ButtonType":
|
||||
prefix = "Button"
|
||||
}
|
||||
n := prefix + ForceCamel(v)
|
||||
n := prefix + internal.ForceCamel(v)
|
||||
if t.ID == "KeyType" {
|
||||
n = "Key" + strings.Replace(n, "Key", "", -1)
|
||||
}
|
||||
|
@ -382,12 +350,24 @@ func FixupDomains(domains []*Domain) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, t := range d.Types {
|
||||
// fix type stuttering
|
||||
if !t.NoExpose && !t.NoResolve {
|
||||
id := strings.TrimPrefix(t.ID, d.Domain.String())
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
t.ID = id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// processTypesWithParameters adds the types to t's enum values, setting the
|
||||
// enum value map for m. Also, converts the Parameters and Returns properties.
|
||||
func processTypesWithParameters(m *Type, d *Domain, types []*Type, prefix, suffix string) {
|
||||
func processTypesWithParameters(m *internal.Type, d *internal.Domain, types []*internal.Type, prefix, suffix string) {
|
||||
for _, t := range types {
|
||||
n := t.ProtoName(d)
|
||||
m.Enum = append(m.Enum, n)
|
||||
|
@ -401,24 +381,24 @@ func processTypesWithParameters(m *Type, d *Domain, types []*Type, prefix, suffi
|
|||
}
|
||||
|
||||
// convertObjectProperties converts object properties.
|
||||
func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
||||
r := make([]*Type, 0)
|
||||
func convertObjectProperties(params []*internal.Type, d *internal.Domain, name string) []*internal.Type {
|
||||
r := make([]*internal.Type, 0)
|
||||
for _, p := range params {
|
||||
switch {
|
||||
case p.Items != nil:
|
||||
r = append(r, &Type{
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Type: TypeArray,
|
||||
Type: internal.TypeArray,
|
||||
Description: p.Description,
|
||||
Optional: p.Optional,
|
||||
Items: convertObjectProperties([]*Type{p.Items}, d, name+"."+p.Name)[0],
|
||||
Items: convertObjectProperties([]*internal.Type{p.Items}, d, name+"."+p.Name)[0],
|
||||
})
|
||||
|
||||
case p.Enum != nil:
|
||||
r = append(r, fixupEnumParameter(name, p, d))
|
||||
|
||||
case (p.Name == "timestamp" || p.Ref == "Network.Timestamp" || p.Ref == "Timestamp") && d.Domain != DomainInput:
|
||||
r = append(r, &Type{
|
||||
case (p.Name == "timestamp" || p.Ref == "Network.Timestamp" || p.Ref == "Timestamp") && d.Domain != internal.DomainInput:
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: "Network.Timestamp",
|
||||
Description: p.Description,
|
||||
|
@ -426,7 +406,7 @@ func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
|||
})
|
||||
|
||||
case p.Name == "modifiers":
|
||||
r = append(r, &Type{
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: "Modifier",
|
||||
Description: p.Description,
|
||||
|
@ -434,7 +414,7 @@ func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
|||
})
|
||||
|
||||
case p.Name == "nodeType":
|
||||
r = append(r, &Type{
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: "NodeType",
|
||||
Description: p.Description,
|
||||
|
@ -442,7 +422,7 @@ func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
|||
})
|
||||
|
||||
case p.Ref == "GestureSourceType":
|
||||
r = append(r, &Type{
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: "GestureType",
|
||||
Description: p.Description,
|
||||
|
@ -450,17 +430,29 @@ func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
|||
})
|
||||
|
||||
case p.Ref == "CSSComputedStyleProperty":
|
||||
r = append(r, &Type{
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: "ComputedProperty",
|
||||
Description: p.Description,
|
||||
Optional: p.Optional,
|
||||
})
|
||||
|
||||
case strings.HasPrefix(p.Ref, "CSS"):
|
||||
r = append(r, &Type{
|
||||
case p.Ref != "" && !p.NoExpose && !p.NoResolve:
|
||||
ref := strings.SplitN(p.Ref, ".", 2)
|
||||
if len(ref) == 1 {
|
||||
ref[0] = strings.TrimPrefix(ref[0], d.Domain.String())
|
||||
} else {
|
||||
ref[1] = strings.TrimPrefix(ref[1], ref[0])
|
||||
}
|
||||
|
||||
z := strings.Join(ref, ".")
|
||||
if z == "" {
|
||||
z = p.Ref
|
||||
}
|
||||
|
||||
r = append(r, &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: strings.TrimPrefix(p.Ref, "CSS"),
|
||||
Ref: z,
|
||||
Description: p.Description,
|
||||
Optional: p.Optional,
|
||||
})
|
||||
|
@ -474,9 +466,9 @@ func convertObjectProperties(params []*Type, d *Domain, name string) []*Type {
|
|||
}
|
||||
|
||||
// addEnumValues adds orig.Enum values to type named n's Enum values in domain.
|
||||
func addEnumValues(d *Domain, n string, p *Type) {
|
||||
func addEnumValues(d *internal.Domain, n string, p *internal.Type) {
|
||||
// find type
|
||||
var typ *Type
|
||||
var typ *internal.Type
|
||||
for _, t := range d.Types {
|
||||
if t.ID == n {
|
||||
typ = t
|
||||
|
@ -484,9 +476,9 @@ func addEnumValues(d *Domain, n string, p *Type) {
|
|||
}
|
||||
}
|
||||
if typ == nil {
|
||||
typ = &Type{
|
||||
typ = &internal.Type{
|
||||
ID: n,
|
||||
Type: TypeString,
|
||||
Type: internal.TypeString,
|
||||
Description: p.Description,
|
||||
Optional: p.Optional,
|
||||
}
|
||||
|
@ -513,8 +505,9 @@ func addEnumValues(d *Domain, n string, p *Type) {
|
|||
|
||||
// enumRefMap is the fully qualified parameter name to ref.
|
||||
var enumRefMap = map[string]string{
|
||||
"Animation.Animation.type": "Type",
|
||||
"CSS.CSSMedia.source": "MediaSource",
|
||||
"CSS.forcePseudoState.forcedPseudoClasses": "PseudoClass",
|
||||
"CSS.Media.source": "MediaSource",
|
||||
"Debugger.setPauseOnExceptions.state": "ExceptionsState",
|
||||
"Emulation.ScreenOrientation.type": "OrientationType",
|
||||
"Emulation.setTouchEmulationEnabled.configuration": "EnabledConfiguration",
|
||||
|
@ -544,9 +537,9 @@ var enumRefMap = map[string]string{
|
|||
|
||||
// fixupEnumParameter takes an enum parameter, adds it to the domain and
|
||||
// returns a type suitable for use in place of the type.
|
||||
func fixupEnumParameter(typ string, p *Type, d *Domain) *Type {
|
||||
func fixupEnumParameter(typ string, p *internal.Type, d *internal.Domain) *internal.Type {
|
||||
fqname := strings.TrimSuffix(fmt.Sprintf("%s.%s.%s", d.Domain, typ, p.Name), ".")
|
||||
ref := ForceCamel(typ + "." + p.Name)
|
||||
ref := internal.ForceCamel(typ + "." + p.Name)
|
||||
if n, ok := enumRefMap[fqname]; ok {
|
||||
ref = n
|
||||
}
|
||||
|
@ -554,7 +547,7 @@ func fixupEnumParameter(typ string, p *Type, d *Domain) *Type {
|
|||
// add enum values to type name
|
||||
addEnumValues(d, ref, p)
|
||||
|
||||
return &Type{
|
||||
return &internal.Type{
|
||||
Name: p.Name,
|
||||
Ref: ref,
|
||||
Description: p.Description,
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"github.com/gedex/inflector"
|
||||
qtpl "github.com/valyala/quicktemplate"
|
||||
|
||||
. "github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
. "github.com/knq/chromedp/cmd/chromedp-gen/templates"
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
||||
"github.com/knq/chromedp/cmd/chromedp-gen/templates"
|
||||
)
|
||||
|
||||
// fileBuffers is a type to manage buffers for file data.
|
||||
|
@ -16,17 +16,17 @@ type fileBuffers map[string]*bytes.Buffer
|
|||
|
||||
// GenerateDomains generates domains for the Chrome Debugging Protocol domain
|
||||
// definitions, returning generated file buffers.
|
||||
func GenerateDomains(domains []*Domain) map[string]*bytes.Buffer {
|
||||
func GenerateDomains(domains []*internal.Domain) map[string]*bytes.Buffer {
|
||||
fb := make(fileBuffers)
|
||||
|
||||
var w *qtpl.Writer
|
||||
|
||||
// determine base (also used for the domains manager type name)
|
||||
pkgBase := path.Base(*FlagPkg)
|
||||
DomainTypeSuffix = inflector.Singularize(ForceCamel(pkgBase))
|
||||
pkgBase := path.Base(*internal.FlagPkg)
|
||||
internal.DomainTypeSuffix = inflector.Singularize(internal.ForceCamel(pkgBase))
|
||||
|
||||
// generate internal types
|
||||
fb.generateInternalTypes(domains)
|
||||
fb.generateCDPTypes(domains)
|
||||
|
||||
// generate util package
|
||||
fb.generateUtilPackage(domains)
|
||||
|
@ -38,14 +38,14 @@ func GenerateDomains(domains []*Domain) map[string]*bytes.Buffer {
|
|||
|
||||
// do command template
|
||||
w = fb.get(pkgOut, pkgName, d)
|
||||
StreamDomainTemplate(w, d, domains)
|
||||
templates.StreamDomainTemplate(w, d, domains)
|
||||
fb.release(w)
|
||||
|
||||
// generate domain types
|
||||
if len(d.Types) != 0 {
|
||||
fb.generateTypes(
|
||||
pkgName+"/types.go",
|
||||
d.Types, TypePrefix, TypeSuffix, d, domains,
|
||||
d.Types, internal.TypePrefix, internal.TypeSuffix, d, domains,
|
||||
"", "", "", "", "",
|
||||
)
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ func GenerateDomains(domains []*Domain) map[string]*bytes.Buffer {
|
|||
if len(d.Events) != 0 {
|
||||
fb.generateTypes(
|
||||
pkgName+"/events.go",
|
||||
d.Events, EventTypePrefix, EventTypeSuffix, d, domains,
|
||||
"EventTypes", "MethodType", EventMethodPrefix+d.String(), EventMethodSuffix,
|
||||
"EventTypes is all event types in the domain.",
|
||||
d.Events, internal.EventTypePrefix, internal.EventTypeSuffix, d, domains,
|
||||
"EventTypes", "cdp.MethodType", "cdp."+internal.EventMethodPrefix+d.String(), internal.EventMethodSuffix,
|
||||
"All event types in the domain.",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -64,23 +64,32 @@ func GenerateDomains(domains []*Domain) map[string]*bytes.Buffer {
|
|||
return map[string]*bytes.Buffer(fb)
|
||||
}
|
||||
|
||||
// generateInternalTypes generates the internal types for domain d.
|
||||
// generateCDPTypes generates the internal types for domain d.
|
||||
//
|
||||
// because there are circular package dependencies, some types need to be moved
|
||||
// to the shared internal package.
|
||||
func (fb fileBuffers) generateInternalTypes(domains []*Domain) {
|
||||
pkg := path.Base(*FlagPkg)
|
||||
w := fb.get(pkg+".go", pkg, nil)
|
||||
|
||||
func (fb fileBuffers) generateCDPTypes(domains []*internal.Domain) {
|
||||
var types []*internal.Type
|
||||
for _, d := range domains {
|
||||
// process internal types
|
||||
for _, t := range d.Types {
|
||||
if IsInternalType(d.Domain, t.IdOrName()) {
|
||||
StreamTypeTemplate(w, t, TypePrefix, TypeSuffix, d, domains, nil, false, false)
|
||||
if internal.IsCDPType(d.Domain, t.IdOrName()) {
|
||||
types = append(types, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pkg := path.Base(*internal.FlagPkg)
|
||||
cdpDomain := &internal.Domain{
|
||||
Domain: internal.DomainType("cdp"),
|
||||
Types: types,
|
||||
}
|
||||
doms := append(domains, cdpDomain)
|
||||
|
||||
w := fb.get(pkg+".go", pkg, nil)
|
||||
for _, t := range types {
|
||||
templates.StreamTypeTemplate(w, t, internal.TypePrefix, internal.TypeSuffix, cdpDomain, doms, nil, false, false)
|
||||
}
|
||||
fb.release(w)
|
||||
}
|
||||
|
||||
|
@ -88,40 +97,39 @@ func (fb fileBuffers) generateInternalTypes(domains []*Domain) {
|
|||
//
|
||||
// currently only contains the message unmarshaler: if this wasn't in a
|
||||
// separate package, there would be circular dependencies.
|
||||
func (fb fileBuffers) generateUtilPackage(domains []*Domain) {
|
||||
func (fb fileBuffers) generateUtilPackage(domains []*internal.Domain) {
|
||||
// generate imports
|
||||
importMap := map[string]string{
|
||||
*FlagPkg: ".",
|
||||
*internal.FlagPkg: "cdp",
|
||||
}
|
||||
for _, d := range domains {
|
||||
importMap[*FlagPkg+"/"+d.PackageName()] = d.PackageImportAlias()
|
||||
importMap[*internal.FlagPkg+"/"+d.PackageName()] = d.PackageImportAlias()
|
||||
}
|
||||
|
||||
w := fb.get("util/util.go", "util", nil)
|
||||
StreamFileImportTemplate(w, importMap)
|
||||
StreamExtraUtilTemplate(w, domains)
|
||||
templates.StreamFileImportTemplate(w, importMap)
|
||||
templates.StreamExtraUtilTemplate(w, domains)
|
||||
fb.release(w)
|
||||
}
|
||||
|
||||
// generateTypes generates the types.
|
||||
func (fb fileBuffers) generateTypes(
|
||||
path string,
|
||||
types []*Type, prefix, suffix string, d *Domain, domains []*Domain,
|
||||
types []*internal.Type, prefix, suffix string, d *internal.Domain, domains []*internal.Domain,
|
||||
emit, emitType, emitPrefix, emitSuffix, emitDesc string,
|
||||
) {
|
||||
w := fb.get(path, d.PackageName(), d)
|
||||
|
||||
// add internal import
|
||||
StreamFileLocalImportTemplate(w, *FlagPkg)
|
||||
StreamFileEmptyVarTemplate(w, InternalTypeList()...)
|
||||
templates.StreamFileImportTemplate(w, map[string]string{*internal.FlagPkg: "cdp"})
|
||||
|
||||
// process type list
|
||||
var names []string
|
||||
for _, t := range types {
|
||||
if IsInternalType(d.Domain, t.IdOrName()) {
|
||||
if internal.IsCDPType(d.Domain, t.IdOrName()) {
|
||||
continue
|
||||
}
|
||||
StreamTypeTemplate(w, t, prefix, suffix, d, domains, nil, false, false)
|
||||
templates.StreamTypeTemplate(w, t, prefix, suffix, d, domains, nil, false, false)
|
||||
names = append(names, t.TypeName(emitPrefix, emitSuffix))
|
||||
}
|
||||
|
||||
|
@ -132,14 +140,14 @@ func (fb fileBuffers) generateTypes(
|
|||
s += "\n" + n + ","
|
||||
}
|
||||
s += "\n}"
|
||||
StreamFileVarTemplate(w, emit, s, emitDesc)
|
||||
templates.StreamFileVarTemplate(w, emit, s, emitDesc)
|
||||
}
|
||||
|
||||
fb.release(w)
|
||||
}
|
||||
|
||||
// get retrieves the file buffer for s, or creates it if it is not yet available.
|
||||
func (fb fileBuffers) get(s string, pkgName string, d *Domain) *qtpl.Writer {
|
||||
func (fb fileBuffers) get(s string, pkgName string, d *internal.Domain) *qtpl.Writer {
|
||||
// check if it already exists
|
||||
if b, ok := fb[s]; ok {
|
||||
return qtpl.AcquireWriter(b)
|
||||
|
@ -156,7 +164,7 @@ func (fb fileBuffers) get(s string, pkgName string, d *Domain) *qtpl.Writer {
|
|||
}
|
||||
|
||||
// add package header
|
||||
StreamFileHeader(w, pkgName, v)
|
||||
templates.StreamFileHeader(w, pkgName, v)
|
||||
|
||||
return w
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user