Fixing race issues
- Refactored chromedp-gen and cdp code so that Execute no longer returns a channel - Fixing potential race problems in handler - Eliminated some dead code - Updated examples to include new logging parameters
This commit is contained in:
parent
7326b390a0
commit
b5032069e3
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetPartialAXTreeParams fetches the accessibility node and partial
|
// GetPartialAXTreeParams fetches the accessibility node and partial
|
||||||
|
@ -49,44 +48,12 @@ type GetPartialAXTreeReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
|
// 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 cdp.Handler) (nodes []*AXNode, err error) {
|
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.Handler) (nodes []*AXNode, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetPartialAXTreeReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandAccessibilityGetPartialAXTree, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Nodes, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandAccessibilityGetPartialAXTree, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetPartialAXTreeReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Nodes, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,6 @@ import (
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/knq/chromedp/cdp/runtime"
|
"github.com/knq/chromedp/cdp/runtime"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables animation domain notifications.
|
// EnableParams enables animation domain notifications.
|
||||||
|
@ -25,33 +24,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Animation.enable against the provided context and
|
// Do executes Animation.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables animation domain notifications.
|
// DisableParams disables animation domain notifications.
|
||||||
|
@ -65,33 +38,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Animation.disable against the provided context and
|
// Do executes Animation.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPlaybackRateParams gets the playback rate of the document timeline.
|
// GetPlaybackRateParams gets the playback rate of the document timeline.
|
||||||
|
@ -113,40 +60,14 @@ type GetPlaybackRateReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// playbackRate - Playback rate for animations on page.
|
// playbackRate - Playback rate for animations on page.
|
||||||
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (playbackRate float64, err error) {
|
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (playbackRate float64, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, cdp.Empty)
|
var res GetPlaybackRateReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return 0, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return 0, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetPlaybackRateReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return 0, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.PlaybackRate, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return 0, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return 0, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, cdp.ErrUnknownResult
|
return res.PlaybackRate, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPlaybackRateParams sets the playback rate of the document timeline.
|
// SetPlaybackRateParams sets the playback rate of the document timeline.
|
||||||
|
@ -167,39 +88,7 @@ func SetPlaybackRate(playbackRate float64) *SetPlaybackRateParams {
|
||||||
// Do executes Animation.setPlaybackRate against the provided context and
|
// Do executes Animation.setPlaybackRate against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationSetPlaybackRate, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetPlaybackRate, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentTimeParams returns the current time of the an animation.
|
// GetCurrentTimeParams returns the current time of the an animation.
|
||||||
|
@ -228,46 +117,14 @@ type GetCurrentTimeReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// currentTime - Current time of the page.
|
// currentTime - Current time of the page.
|
||||||
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentTime float64, err error) {
|
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentTime float64, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetCurrentTimeReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandAnimationGetCurrentTime, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.CurrentTime, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationGetCurrentTime, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return 0, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetCurrentTimeReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return 0, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.CurrentTime, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return 0, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return 0, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPausedParams sets the paused state of a set of animations.
|
// SetPausedParams sets the paused state of a set of animations.
|
||||||
|
@ -291,39 +148,7 @@ func SetPaused(animations []string, paused bool) *SetPausedParams {
|
||||||
// Do executes Animation.setPaused against the provided context and
|
// Do executes Animation.setPaused against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationSetPaused, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetPaused, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTimingParams sets the timing of an animation node.
|
// SetTimingParams sets the timing of an animation node.
|
||||||
|
@ -350,39 +175,7 @@ func SetTiming(animationID string, duration float64, delay float64) *SetTimingPa
|
||||||
// Do executes Animation.setTiming against the provided context and
|
// Do executes Animation.setTiming against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationSetTiming, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationSetTiming, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeekAnimationsParams seek a set of animations to a particular time within
|
// SeekAnimationsParams seek a set of animations to a particular time within
|
||||||
|
@ -408,39 +201,7 @@ func SeekAnimations(animations []string, currentTime float64) *SeekAnimationsPar
|
||||||
// Do executes Animation.seekAnimations against the provided context and
|
// Do executes Animation.seekAnimations against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationSeekAnimations, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationSeekAnimations, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseAnimationsParams releases a set of animations to no longer be
|
// ReleaseAnimationsParams releases a set of animations to no longer be
|
||||||
|
@ -463,39 +224,7 @@ func ReleaseAnimations(animations []string) *ReleaseAnimationsParams {
|
||||||
// Do executes Animation.releaseAnimations against the provided context and
|
// Do executes Animation.releaseAnimations against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandAnimationReleaseAnimations, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationReleaseAnimations, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolveAnimationParams gets the remote object of the Animation.
|
// ResolveAnimationParams gets the remote object of the Animation.
|
||||||
|
@ -524,44 +253,12 @@ type ResolveAnimationReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// remoteObject - Corresponding remote object.
|
// remoteObject - Corresponding remote object.
|
||||||
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remoteObject *runtime.RemoteObject, err error) {
|
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remoteObject *runtime.RemoteObject, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res ResolveAnimationReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandAnimationResolveAnimation, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.RemoteObject, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandAnimationResolveAnimation, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r ResolveAnimationReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.RemoteObject, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetFramesWithManifestsParams returns array of frame identifiers with
|
// GetFramesWithManifestsParams returns array of frame identifiers with
|
||||||
|
@ -36,40 +35,14 @@ type GetFramesWithManifestsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
|
// 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 cdp.Handler) (frameIds []*FrameWithManifest, err error) {
|
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.Handler) (frameIds []*FrameWithManifest, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, cdp.Empty)
|
var res GetFramesWithManifestsReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetFramesWithManifestsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.FrameIds, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.FrameIds, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableParams enables application cache domain notifications.
|
// EnableParams enables application cache domain notifications.
|
||||||
|
@ -83,33 +56,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes ApplicationCache.enable against the provided context and
|
// Do executes ApplicationCache.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandApplicationCacheEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetManifestForFrameParams returns manifest URL for document in the given
|
// GetManifestForFrameParams returns manifest URL for document in the given
|
||||||
|
@ -139,46 +86,14 @@ type GetManifestForFrameReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// manifestURL - Manifest URL for document in the given frame.
|
// manifestURL - Manifest URL for document in the given frame.
|
||||||
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.Handler) (manifestURL string, err error) {
|
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.Handler) (manifestURL string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetManifestForFrameReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetManifestForFrame, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.ManifestURL, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetManifestForFrame, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetManifestForFrameReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.ManifestURL, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetApplicationCacheForFrameParams returns relevant application cache data
|
// GetApplicationCacheForFrameParams returns relevant application cache data
|
||||||
|
@ -209,44 +124,12 @@ type GetApplicationCacheForFrameReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// applicationCache - Relevant application cache data for the document in given frame.
|
// applicationCache - Relevant application cache data for the document in given frame.
|
||||||
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Handler) (applicationCache *ApplicationCache, err error) {
|
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Handler) (applicationCache *ApplicationCache, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetApplicationCacheForFrameReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetApplicationCacheForFrame, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.ApplicationCache, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetApplicationCacheForFrame, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetApplicationCacheForFrameReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.ApplicationCache, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RequestCacheNamesParams requests cache names.
|
// RequestCacheNamesParams requests cache names.
|
||||||
|
@ -39,46 +38,14 @@ type RequestCacheNamesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// caches - Caches for the security origin.
|
// caches - Caches for the security origin.
|
||||||
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
|
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RequestCacheNamesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Caches, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestCacheNamesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Caches, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestEntriesParams requests data from cache.
|
// RequestEntriesParams requests data from cache.
|
||||||
|
@ -115,46 +82,14 @@ type RequestEntriesReturns struct {
|
||||||
// cacheDataEntries - Array of object store data entries.
|
// cacheDataEntries - Array of object store data entries.
|
||||||
// hasMore - If true, there are more entries to fetch in the given range.
|
// hasMore - If true, there are more entries to fetch in the given range.
|
||||||
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RequestEntriesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.CacheDataEntries, res.HasMore, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestEntriesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.CacheDataEntries, r.HasMore, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteCacheParams deletes a cache.
|
// DeleteCacheParams deletes a cache.
|
||||||
|
@ -175,39 +110,7 @@ func DeleteCache(cacheID CacheID) *DeleteCacheParams {
|
||||||
// Do executes CacheStorage.deleteCache against the provided context and
|
// Do executes CacheStorage.deleteCache against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteEntryParams deletes a cache entry.
|
// DeleteEntryParams deletes a cache entry.
|
||||||
|
@ -231,37 +134,5 @@ func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
|
||||||
// Do executes CacheStorage.deleteEntry against the provided context and
|
// Do executes CacheStorage.deleteEntry against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,317 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(in *jlexer.Lexer, out *RequestEntriesReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(in *jlexer.Lexer, out *Cache) {
|
||||||
|
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 "cacheId":
|
||||||
|
out.CacheID = CacheID(in.String())
|
||||||
|
case "securityOrigin":
|
||||||
|
out.SecurityOrigin = string(in.String())
|
||||||
|
case "cacheName":
|
||||||
|
out.CacheName = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(out *jwriter.Writer, in Cache) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.CacheID != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"cacheId\":")
|
||||||
|
out.String(string(in.CacheID))
|
||||||
|
}
|
||||||
|
if in.SecurityOrigin != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"securityOrigin\":")
|
||||||
|
out.String(string(in.SecurityOrigin))
|
||||||
|
}
|
||||||
|
if in.CacheName != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"cacheName\":")
|
||||||
|
out.String(string(in.CacheName))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v Cache) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v Cache) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *Cache) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(in *jlexer.Lexer, out *DataEntry) {
|
||||||
|
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 "request":
|
||||||
|
out.Request = string(in.String())
|
||||||
|
case "response":
|
||||||
|
out.Response = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(out *jwriter.Writer, in DataEntry) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.Request != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"request\":")
|
||||||
|
out.String(string(in.Request))
|
||||||
|
}
|
||||||
|
if in.Response != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"response\":")
|
||||||
|
out.String(string(in.Response))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v DataEntry) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *DataEntry) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer, out *DeleteEntryParams) {
|
||||||
|
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 "cacheId":
|
||||||
|
out.CacheID = CacheID(in.String())
|
||||||
|
case "request":
|
||||||
|
out.Request = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in DeleteEntryParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"cacheId\":")
|
||||||
|
out.String(string(in.CacheID))
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"request\":")
|
||||||
|
out.String(string(in.Request))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v DeleteEntryParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *DeleteEntryParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer, out *DeleteCacheParams) {
|
||||||
|
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 "cacheId":
|
||||||
|
out.CacheID = CacheID(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in DeleteCacheParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"cacheId\":")
|
||||||
|
out.String(string(in.CacheID))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v DeleteCacheParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *DeleteCacheParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer, out *RequestEntriesReturns) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -75,7 +385,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(in *jlexer.Lexer,
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(out *jwriter.Writer, in RequestEntriesReturns) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in RequestEntriesReturns) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -116,27 +426,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(out *jwriter.Writ
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v RequestEntriesReturns) MarshalJSON() ([]byte, error) {
|
func (v RequestEntriesReturns) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v RequestEntriesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v RequestEntriesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *RequestEntriesReturns) UnmarshalJSON(data []byte) error {
|
func (v *RequestEntriesReturns) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *RequestEntriesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *RequestEntriesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(in *jlexer.Lexer, out *RequestEntriesParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer, out *RequestEntriesParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -171,7 +481,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(in *jlexer.Lexer
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(out *jwriter.Writer, in RequestEntriesParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in RequestEntriesParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -199,27 +509,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(out *jwriter.Wri
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v RequestEntriesParams) MarshalJSON() ([]byte, error) {
|
func (v RequestEntriesParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v RequestEntriesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v RequestEntriesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *RequestEntriesParams) UnmarshalJSON(data []byte) error {
|
func (v *RequestEntriesParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *RequestEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *RequestEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer, out *RequestCacheNamesReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *RequestCacheNamesReturns) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -275,7 +585,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in RequestCacheNamesReturns) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in RequestCacheNamesReturns) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -308,27 +618,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Wri
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) {
|
func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error {
|
func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *RequestCacheNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *RequestCacheNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer, out *RequestCacheNamesParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *RequestCacheNamesParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -359,7 +669,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in RequestCacheNamesParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in RequestCacheNamesParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -374,334 +684,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Wri
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v RequestCacheNamesParams) MarshalJSON() ([]byte, error) {
|
func (v RequestCacheNamesParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer, out *DeleteEntryParams) {
|
|
||||||
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 "cacheId":
|
|
||||||
out.CacheID = CacheID(in.String())
|
|
||||||
case "request":
|
|
||||||
out.Request = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in DeleteEntryParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"cacheId\":")
|
|
||||||
out.String(string(in.CacheID))
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"request\":")
|
|
||||||
out.String(string(in.Request))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v DeleteEntryParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *DeleteEntryParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer, out *DeleteCacheParams) {
|
|
||||||
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 "cacheId":
|
|
||||||
out.CacheID = CacheID(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in DeleteCacheParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"cacheId\":")
|
|
||||||
out.String(string(in.CacheID))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v DeleteCacheParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *DeleteCacheParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *DataEntry) {
|
|
||||||
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 "request":
|
|
||||||
out.Request = string(in.String())
|
|
||||||
case "response":
|
|
||||||
out.Response = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DataEntry) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.Request != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"request\":")
|
|
||||||
out.String(string(in.Request))
|
|
||||||
}
|
|
||||||
if in.Response != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"response\":")
|
|
||||||
out.String(string(in.Response))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v DataEntry) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *DataEntry) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *Cache) {
|
|
||||||
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 "cacheId":
|
|
||||||
out.CacheID = CacheID(in.String())
|
|
||||||
case "securityOrigin":
|
|
||||||
out.SecurityOrigin = string(in.String())
|
|
||||||
case "cacheName":
|
|
||||||
out.CacheName = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in Cache) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.CacheID != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"cacheId\":")
|
|
||||||
out.String(string(in.CacheID))
|
|
||||||
}
|
|
||||||
if in.SecurityOrigin != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"securityOrigin\":")
|
|
||||||
out.String(string(in.SecurityOrigin))
|
|
||||||
}
|
|
||||||
if in.CacheName != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"cacheName\":")
|
|
||||||
out.String(string(in.CacheName))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v Cache) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v Cache) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *Cache) UnmarshalJSON(data []byte) error {
|
func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1352,7 +1352,7 @@ type Handler interface {
|
||||||
|
|
||||||
// Execute executes the specified command using the supplied context and
|
// Execute executes the specified command using the supplied context and
|
||||||
// parameters.
|
// parameters.
|
||||||
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
|
Execute(context.Context, MethodType, easyjson.Marshaler, easyjson.Unmarshaler) error
|
||||||
|
|
||||||
// Listen creates a channel that will receive an event for the types
|
// Listen creates a channel that will receive an event for the types
|
||||||
// specified.
|
// specified.
|
||||||
|
@ -1362,9 +1362,6 @@ type Handler interface {
|
||||||
Release(<-chan interface{})
|
Release(<-chan interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty is an empty JSON object message.
|
|
||||||
var Empty = easyjson.RawMessage(`{}`)
|
|
||||||
|
|
||||||
// FrameID unique frame identifier.
|
// FrameID unique frame identifier.
|
||||||
type FrameID string
|
type FrameID string
|
||||||
|
|
||||||
|
|
825
cdp/css/css.go
825
cdp/css/css.go
File diff suppressed because it is too large
Load Diff
9136
cdp/css/easyjson.go
9136
cdp/css/easyjson.go
File diff suppressed because it is too large
Load Diff
|
@ -26,33 +26,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Database.enable against the provided context and
|
// Do executes Database.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDatabaseEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables database tracking, prevents database events from
|
// DisableParams disables database tracking, prevents database events from
|
||||||
|
@ -68,33 +42,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Database.disable against the provided context and
|
// Do executes Database.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDatabaseDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDatabaseTableNamesParams [no description].
|
// GetDatabaseTableNamesParams [no description].
|
||||||
|
@ -123,46 +71,14 @@ type GetDatabaseTableNamesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// tableNames
|
// tableNames
|
||||||
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetDatabaseTableNamesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.TableNames, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetDatabaseTableNamesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.TableNames, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteSQLParams [no description].
|
// ExecuteSQLParams [no description].
|
||||||
|
@ -198,44 +114,12 @@ type ExecuteSQLReturns struct {
|
||||||
// values
|
// values
|
||||||
// sqlError
|
// sqlError
|
||||||
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res ExecuteSQLReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.ColumnNames, res.Values, res.SQLError, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r ExecuteSQLReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.ColumnNames, r.Values, r.SQLError, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out *Error) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -36,25 +36,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "tableNames":
|
case "message":
|
||||||
if in.IsNull() {
|
out.Message = string(in.String())
|
||||||
in.Skip()
|
case "code":
|
||||||
out.TableNames = nil
|
out.Code = int64(in.Int64())
|
||||||
} else {
|
|
||||||
in.Delim('[')
|
|
||||||
if !in.IsDelim(']') {
|
|
||||||
out.TableNames = make([]string, 0, 4)
|
|
||||||
} else {
|
|
||||||
out.TableNames = []string{}
|
|
||||||
}
|
|
||||||
for !in.IsDelim(']') {
|
|
||||||
var v1 string
|
|
||||||
v1 = string(in.String())
|
|
||||||
out.TableNames = append(out.TableNames, v1)
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim(']')
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -65,56 +50,53 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(out *jwriter.Writer, in Error) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if len(in.TableNames) != 0 {
|
if in.Message != "" {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"tableNames\":")
|
out.RawString("\"message\":")
|
||||||
if in.TableNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
out.String(string(in.Message))
|
||||||
out.RawString("null")
|
}
|
||||||
} else {
|
if in.Code != 0 {
|
||||||
out.RawByte('[')
|
if !first {
|
||||||
for v2, v3 := range in.TableNames {
|
out.RawByte(',')
|
||||||
if v2 > 0 {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
out.String(string(v3))
|
|
||||||
}
|
|
||||||
out.RawByte(']')
|
|
||||||
}
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"code\":")
|
||||||
|
out.Int64(int64(in.Code))
|
||||||
}
|
}
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
|
func (v Error) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
|
func (v *Error) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, out *Database) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -133,8 +115,14 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, ou
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "databaseId":
|
case "id":
|
||||||
out.DatabaseID = ID(in.String())
|
out.ID = ID(in.String())
|
||||||
|
case "domain":
|
||||||
|
out.Domain = string(in.String())
|
||||||
|
case "name":
|
||||||
|
out.Name = string(in.String())
|
||||||
|
case "version":
|
||||||
|
out.Version = string(in.String())
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -145,275 +133,69 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(out *jwriter.Writer, in Database) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if !first {
|
if in.ID != "" {
|
||||||
out.RawByte(',')
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"id\":")
|
||||||
|
out.String(string(in.ID))
|
||||||
|
}
|
||||||
|
if in.Domain != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"domain\":")
|
||||||
|
out.String(string(in.Domain))
|
||||||
|
}
|
||||||
|
if in.Name != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"name\":")
|
||||||
|
out.String(string(in.Name))
|
||||||
|
}
|
||||||
|
if in.Version != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"version\":")
|
||||||
|
out.String(string(in.Version))
|
||||||
}
|
}
|
||||||
first = false
|
|
||||||
out.RawString("\"databaseId\":")
|
|
||||||
out.String(string(in.DatabaseID))
|
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
|
func (v Database) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
|
func (v *Database) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(in *jlexer.Lexer, out *ExecuteSQLReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(in *jlexer.Lexer, out *EventAddDatabase) {
|
||||||
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 "columnNames":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.ColumnNames = nil
|
|
||||||
} else {
|
|
||||||
in.Delim('[')
|
|
||||||
if !in.IsDelim(']') {
|
|
||||||
out.ColumnNames = make([]string, 0, 4)
|
|
||||||
} else {
|
|
||||||
out.ColumnNames = []string{}
|
|
||||||
}
|
|
||||||
for !in.IsDelim(']') {
|
|
||||||
var v4 string
|
|
||||||
v4 = string(in.String())
|
|
||||||
out.ColumnNames = append(out.ColumnNames, v4)
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim(']')
|
|
||||||
}
|
|
||||||
case "values":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.Values = nil
|
|
||||||
} else {
|
|
||||||
in.Delim('[')
|
|
||||||
if !in.IsDelim(']') {
|
|
||||||
out.Values = make([]easyjson.RawMessage, 0, 2)
|
|
||||||
} else {
|
|
||||||
out.Values = []easyjson.RawMessage{}
|
|
||||||
}
|
|
||||||
for !in.IsDelim(']') {
|
|
||||||
var v5 easyjson.RawMessage
|
|
||||||
(v5).UnmarshalEasyJSON(in)
|
|
||||||
out.Values = append(out.Values, v5)
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim(']')
|
|
||||||
}
|
|
||||||
case "sqlError":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.SQLError = nil
|
|
||||||
} else {
|
|
||||||
if out.SQLError == nil {
|
|
||||||
out.SQLError = new(Error)
|
|
||||||
}
|
|
||||||
(*out.SQLError).UnmarshalEasyJSON(in)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(out *jwriter.Writer, in ExecuteSQLReturns) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if len(in.ColumnNames) != 0 {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"columnNames\":")
|
|
||||||
if in.ColumnNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
out.RawByte('[')
|
|
||||||
for v6, v7 := range in.ColumnNames {
|
|
||||||
if v6 > 0 {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
out.String(string(v7))
|
|
||||||
}
|
|
||||||
out.RawByte(']')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(in.Values) != 0 {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"values\":")
|
|
||||||
if in.Values == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
out.RawByte('[')
|
|
||||||
for v8, v9 := range in.Values {
|
|
||||||
if v8 > 0 {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
(v9).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
out.RawByte(']')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.SQLError != nil {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"sqlError\":")
|
|
||||||
if in.SQLError == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
(*in.SQLError).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v ExecuteSQLReturns) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v ExecuteSQLReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *ExecuteSQLReturns) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *ExecuteSQLReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(in *jlexer.Lexer, out *ExecuteSQLParams) {
|
|
||||||
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 "databaseId":
|
|
||||||
out.DatabaseID = ID(in.String())
|
|
||||||
case "query":
|
|
||||||
out.Query = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(out *jwriter.Writer, in ExecuteSQLParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"databaseId\":")
|
|
||||||
out.String(string(in.DatabaseID))
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"query\":")
|
|
||||||
out.String(string(in.Query))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v ExecuteSQLParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v ExecuteSQLParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *ExecuteSQLParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *ExecuteSQLParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(in *jlexer.Lexer, out *EventAddDatabase) {
|
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -452,7 +234,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer, in EventAddDatabase) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(out *jwriter.Writer, in EventAddDatabase) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -474,27 +256,259 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer,
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventAddDatabase) MarshalJSON() ([]byte, error) {
|
func (v EventAddDatabase) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v EventAddDatabase) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventAddDatabase) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *EventAddDatabase) UnmarshalJSON(data []byte) error {
|
func (v *EventAddDatabase) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *EventAddDatabase) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(in *jlexer.Lexer, out *ExecuteSQLReturns) {
|
||||||
|
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 "columnNames":
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
out.ColumnNames = nil
|
||||||
|
} else {
|
||||||
|
in.Delim('[')
|
||||||
|
if !in.IsDelim(']') {
|
||||||
|
out.ColumnNames = make([]string, 0, 4)
|
||||||
|
} else {
|
||||||
|
out.ColumnNames = []string{}
|
||||||
|
}
|
||||||
|
for !in.IsDelim(']') {
|
||||||
|
var v1 string
|
||||||
|
v1 = string(in.String())
|
||||||
|
out.ColumnNames = append(out.ColumnNames, v1)
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim(']')
|
||||||
|
}
|
||||||
|
case "values":
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
out.Values = nil
|
||||||
|
} else {
|
||||||
|
in.Delim('[')
|
||||||
|
if !in.IsDelim(']') {
|
||||||
|
out.Values = make([]easyjson.RawMessage, 0, 2)
|
||||||
|
} else {
|
||||||
|
out.Values = []easyjson.RawMessage{}
|
||||||
|
}
|
||||||
|
for !in.IsDelim(']') {
|
||||||
|
var v2 easyjson.RawMessage
|
||||||
|
(v2).UnmarshalEasyJSON(in)
|
||||||
|
out.Values = append(out.Values, v2)
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim(']')
|
||||||
|
}
|
||||||
|
case "sqlError":
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
out.SQLError = nil
|
||||||
|
} else {
|
||||||
|
if out.SQLError == nil {
|
||||||
|
out.SQLError = new(Error)
|
||||||
|
}
|
||||||
|
(*out.SQLError).UnmarshalEasyJSON(in)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(out *jwriter.Writer, in ExecuteSQLReturns) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if len(in.ColumnNames) != 0 {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"columnNames\":")
|
||||||
|
if in.ColumnNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||||||
|
out.RawString("null")
|
||||||
|
} else {
|
||||||
|
out.RawByte('[')
|
||||||
|
for v3, v4 := range in.ColumnNames {
|
||||||
|
if v3 > 0 {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
out.String(string(v4))
|
||||||
|
}
|
||||||
|
out.RawByte(']')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(in.Values) != 0 {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"values\":")
|
||||||
|
if in.Values == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||||||
|
out.RawString("null")
|
||||||
|
} else {
|
||||||
|
out.RawByte('[')
|
||||||
|
for v5, v6 := range in.Values {
|
||||||
|
if v5 > 0 {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
(v6).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
out.RawByte(']')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if in.SQLError != nil {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"sqlError\":")
|
||||||
|
if in.SQLError == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
} else {
|
||||||
|
(*in.SQLError).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v ExecuteSQLReturns) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v ExecuteSQLReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *ExecuteSQLReturns) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *ExecuteSQLReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(in *jlexer.Lexer, out *ExecuteSQLParams) {
|
||||||
|
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 "databaseId":
|
||||||
|
out.DatabaseID = ID(in.String())
|
||||||
|
case "query":
|
||||||
|
out.Query = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer, in ExecuteSQLParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"databaseId\":")
|
||||||
|
out.String(string(in.DatabaseID))
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"query\":")
|
||||||
|
out.String(string(in.Query))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v ExecuteSQLParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v ExecuteSQLParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *ExecuteSQLParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *EventAddDatabase) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *ExecuteSQLParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, out *Error) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -513,10 +527,25 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, ou
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "message":
|
case "tableNames":
|
||||||
out.Message = string(in.String())
|
if in.IsNull() {
|
||||||
case "code":
|
in.Skip()
|
||||||
out.Code = int64(in.Int64())
|
out.TableNames = nil
|
||||||
|
} else {
|
||||||
|
in.Delim('[')
|
||||||
|
if !in.IsDelim(']') {
|
||||||
|
out.TableNames = make([]string, 0, 4)
|
||||||
|
} else {
|
||||||
|
out.TableNames = []string{}
|
||||||
|
}
|
||||||
|
for !in.IsDelim(']') {
|
||||||
|
var v7 string
|
||||||
|
v7 = string(in.String())
|
||||||
|
out.TableNames = append(out.TableNames, v7)
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim(']')
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -527,53 +556,56 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, in Error) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if in.Message != "" {
|
if len(in.TableNames) != 0 {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"message\":")
|
out.RawString("\"tableNames\":")
|
||||||
out.String(string(in.Message))
|
if in.TableNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||||||
}
|
out.RawString("null")
|
||||||
if in.Code != 0 {
|
} else {
|
||||||
if !first {
|
out.RawByte('[')
|
||||||
out.RawByte(',')
|
for v8, v9 := range in.TableNames {
|
||||||
|
if v8 > 0 {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
out.String(string(v9))
|
||||||
|
}
|
||||||
|
out.RawByte(']')
|
||||||
}
|
}
|
||||||
first = false
|
|
||||||
out.RawString("\"code\":")
|
|
||||||
out.Int64(int64(in.Code))
|
|
||||||
}
|
}
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v Error) MarshalJSON() ([]byte, error) {
|
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *Error) UnmarshalJSON(data []byte) error {
|
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, out *EnableParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -592,6 +624,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, ou
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
|
case "databaseId":
|
||||||
|
out.DatabaseID = ID(in.String())
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -602,34 +636,40 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(out *jwriter.Writer, in EnableParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"databaseId\":")
|
||||||
|
out.String(string(in.DatabaseID))
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(in *jlexer.Lexer, out *DisableParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(in *jlexer.Lexer, out *DisableParams) {
|
||||||
|
@ -691,7 +731,7 @@ func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, out *Database) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, out *EnableParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -710,14 +750,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, ou
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "id":
|
|
||||||
out.ID = ID(in.String())
|
|
||||||
case "domain":
|
|
||||||
out.Domain = string(in.String())
|
|
||||||
case "name":
|
|
||||||
out.Name = string(in.String())
|
|
||||||
case "version":
|
|
||||||
out.Version = string(in.String())
|
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -728,65 +760,33 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, in Database) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, in EnableParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if in.ID != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"id\":")
|
|
||||||
out.String(string(in.ID))
|
|
||||||
}
|
|
||||||
if in.Domain != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"domain\":")
|
|
||||||
out.String(string(in.Domain))
|
|
||||||
}
|
|
||||||
if in.Name != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"name\":")
|
|
||||||
out.String(string(in.Name))
|
|
||||||
}
|
|
||||||
if in.Version != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"version\":")
|
|
||||||
out.String(string(in.Version))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v Database) MarshalJSON() ([]byte, error) {
|
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *Database) UnmarshalJSON(data []byte) error {
|
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(l, v)
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
|
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
|
||||||
|
@ -37,39 +36,7 @@ func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *S
|
||||||
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context and
|
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearDeviceOrientationOverrideParams clears the overridden Device
|
// ClearDeviceOrientationOverrideParams clears the overridden Device
|
||||||
|
@ -84,31 +51,5 @@ func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
|
||||||
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
|
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDeviceOrientationClearDeviceOrientationOverride, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDeviceOrientationClearDeviceOrientationOverride, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,66 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(in *jlexer.Lexer, out *SetDeviceOrientationOverrideParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(in *jlexer.Lexer, out *ClearDeviceOrientationOverrideParams) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter.Writer, in ClearDeviceOrientationOverrideParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v ClearDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v ClearDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *ClearDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *ClearDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(in *jlexer.Lexer, out *SetDeviceOrientationOverrideParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -52,7 +111,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(in *jlexer.L
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -79,83 +138,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v SetDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
|
func (v SetDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v SetDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *SetDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *SetDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(in *jlexer.Lexer, out *ClearDeviceOrientationOverrideParams) {
|
|
||||||
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(out *jwriter.Writer, in ClearDeviceOrientationOverrideParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v ClearDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v ClearDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v SetDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *ClearDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
func (v *SetDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *ClearDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *SetDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(l, v)
|
||||||
}
|
}
|
||||||
|
|
1512
cdp/dom/dom.go
1512
cdp/dom/dom.go
File diff suppressed because it is too large
Load Diff
11936
cdp/dom/easyjson.go
11936
cdp/dom/easyjson.go
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,6 @@ import (
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/knq/chromedp/cdp/runtime"
|
"github.com/knq/chromedp/cdp/runtime"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetDOMBreakpointParams sets breakpoint on particular operation with DOM.
|
// SetDOMBreakpointParams sets breakpoint on particular operation with DOM.
|
||||||
|
@ -39,39 +38,7 @@ func SetDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *SetDOMBreak
|
||||||
// Do executes DOMDebugger.setDOMBreakpoint against the provided context and
|
// Do executes DOMDebugger.setDOMBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetDOMBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetDOMBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveDOMBreakpointParams removes DOM breakpoint that was set using
|
// RemoveDOMBreakpointParams removes DOM breakpoint that was set using
|
||||||
|
@ -97,39 +64,7 @@ func RemoveDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *RemoveDO
|
||||||
// Do executes DOMDebugger.removeDOMBreakpoint against the provided context and
|
// Do executes DOMDebugger.removeDOMBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveDOMBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveDOMBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEventListenerBreakpointParams sets breakpoint on particular DOM event.
|
// SetEventListenerBreakpointParams sets breakpoint on particular DOM event.
|
||||||
|
@ -158,39 +93,7 @@ func (p SetEventListenerBreakpointParams) WithTargetName(targetName string) *Set
|
||||||
// Do executes DOMDebugger.setEventListenerBreakpoint against the provided context and
|
// Do executes DOMDebugger.setEventListenerBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetEventListenerBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetEventListenerBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveEventListenerBreakpointParams removes breakpoint on particular DOM
|
// RemoveEventListenerBreakpointParams removes breakpoint on particular DOM
|
||||||
|
@ -219,39 +122,7 @@ func (p RemoveEventListenerBreakpointParams) WithTargetName(targetName string) *
|
||||||
// Do executes DOMDebugger.removeEventListenerBreakpoint against the provided context and
|
// Do executes DOMDebugger.removeEventListenerBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveEventListenerBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveEventListenerBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetInstrumentationBreakpointParams sets breakpoint on particular native
|
// SetInstrumentationBreakpointParams sets breakpoint on particular native
|
||||||
|
@ -273,39 +144,7 @@ func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpoin
|
||||||
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context and
|
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetInstrumentationBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
|
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
|
||||||
|
@ -328,39 +167,7 @@ func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBre
|
||||||
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context and
|
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveInstrumentationBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveInstrumentationBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
|
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
|
||||||
|
@ -381,39 +188,7 @@ func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
|
||||||
// Do executes DOMDebugger.setXHRBreakpoint against the provided context and
|
// Do executes DOMDebugger.setXHRBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetXHRBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerSetXHRBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
|
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
|
||||||
|
@ -434,39 +209,7 @@ func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
|
||||||
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context and
|
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveXHRBreakpoint, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveXHRBreakpoint, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEventListenersParams returns event listeners of the given object.
|
// GetEventListenersParams returns event listeners of the given object.
|
||||||
|
@ -513,44 +256,12 @@ type GetEventListenersReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// listeners - Array of relevant listeners.
|
// listeners - Array of relevant listeners.
|
||||||
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (listeners []*EventListener, err error) {
|
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (listeners []*EventListener, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetEventListenersReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandDOMDebuggerGetEventListeners, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Listeners, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMDebuggerGetEventListeners, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetEventListenersReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Listeners, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,6 +68,5 @@ type EventListener struct {
|
||||||
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
|
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
|
||||||
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event handler function value.
|
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event handler function value.
|
||||||
OriginalHandler *runtime.RemoteObject `json:"originalHandler,omitempty"` // Event original handler function value.
|
OriginalHandler *runtime.RemoteObject `json:"originalHandler,omitempty"` // Event original handler function value.
|
||||||
RemoveFunction *runtime.RemoteObject `json:"removeFunction,omitempty"` // Event listener remove function.
|
|
||||||
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any).
|
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any).
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables storage tracking, storage events will now be
|
// EnableParams enables storage tracking, storage events will now be
|
||||||
|
@ -28,33 +27,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes DOMStorage.enable against the provided context and
|
// Do executes DOMStorage.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMStorageEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables storage tracking, prevents storage events from
|
// DisableParams disables storage tracking, prevents storage events from
|
||||||
|
@ -70,33 +43,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes DOMStorage.disable against the provided context and
|
// Do executes DOMStorage.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMStorageDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearParams [no description].
|
// ClearParams [no description].
|
||||||
|
@ -117,39 +64,7 @@ func Clear(storageID *StorageID) *ClearParams {
|
||||||
// Do executes DOMStorage.clear against the provided context and
|
// Do executes DOMStorage.clear against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMStorageClear, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageClear, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDOMStorageItemsParams [no description].
|
// GetDOMStorageItemsParams [no description].
|
||||||
|
@ -178,46 +93,14 @@ type GetDOMStorageItemsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// entries
|
// entries
|
||||||
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entries []Item, err error) {
|
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entries []Item, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetDOMStorageItemsReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandDOMStorageGetDOMStorageItems, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Entries, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageGetDOMStorageItems, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetDOMStorageItemsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Entries, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDOMStorageItemParams [no description].
|
// SetDOMStorageItemParams [no description].
|
||||||
|
@ -244,39 +127,7 @@ func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMSt
|
||||||
// Do executes DOMStorage.setDOMStorageItem against the provided context and
|
// Do executes DOMStorage.setDOMStorageItem against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveDOMStorageItemParams [no description].
|
// RemoveDOMStorageItemParams [no description].
|
||||||
|
@ -300,37 +151,5 @@ func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageIte
|
||||||
// Do executes DOMStorage.removeDOMStorageItem against the provided context and
|
// Do executes DOMStorage.removeDOMStorageItem against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandDOMStorageRemoveDOMStorageItem, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandDOMStorageRemoveDOMStorageItem, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
328
cdp/easyjson.go
328
cdp/easyjson.go
|
@ -679,7 +679,7 @@ func (v *Node) UnmarshalJSON(data []byte) error {
|
||||||
func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *MessageError) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *BackendNode) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -698,10 +698,12 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *Messa
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "code":
|
case "nodeType":
|
||||||
out.Code = int64(in.Int64())
|
(out.NodeType).UnmarshalEasyJSON(in)
|
||||||
case "message":
|
case "nodeName":
|
||||||
out.Message = string(in.String())
|
out.NodeName = string(in.String())
|
||||||
|
case "backendNodeId":
|
||||||
|
(out.BackendNodeID).UnmarshalEasyJSON(in)
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -712,174 +714,61 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *Messa
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(out *jwriter.Writer, in MessageError) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(out *jwriter.Writer, in BackendNode) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if in.Code != 0 {
|
if in.NodeType != 0 {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"code\":")
|
out.RawString("\"nodeType\":")
|
||||||
out.Int64(int64(in.Code))
|
(in.NodeType).MarshalEasyJSON(out)
|
||||||
}
|
}
|
||||||
if in.Message != "" {
|
if in.NodeName != "" {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"message\":")
|
out.RawString("\"nodeName\":")
|
||||||
out.String(string(in.Message))
|
out.String(string(in.NodeName))
|
||||||
|
}
|
||||||
|
if in.BackendNodeID != 0 {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"backendNodeId\":")
|
||||||
|
out.Int64(int64(in.BackendNodeID))
|
||||||
}
|
}
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v MessageError) MarshalJSON() ([]byte, error) {
|
func (v BackendNode) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v MessageError) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *MessageError) UnmarshalJSON(data []byte) error {
|
func (v *BackendNode) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *MessageError) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(in *jlexer.Lexer, out *Message) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(in *jlexer.Lexer, out *Frame) {
|
||||||
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 "id":
|
|
||||||
out.ID = int64(in.Int64())
|
|
||||||
case "method":
|
|
||||||
(out.Method).UnmarshalEasyJSON(in)
|
|
||||||
case "params":
|
|
||||||
(out.Params).UnmarshalEasyJSON(in)
|
|
||||||
case "result":
|
|
||||||
(out.Result).UnmarshalEasyJSON(in)
|
|
||||||
case "error":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.Error = nil
|
|
||||||
} else {
|
|
||||||
if out.Error == nil {
|
|
||||||
out.Error = new(MessageError)
|
|
||||||
}
|
|
||||||
(*out.Error).UnmarshalEasyJSON(in)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(out *jwriter.Writer, in Message) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.ID != 0 {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"id\":")
|
|
||||||
out.Int64(int64(in.ID))
|
|
||||||
}
|
|
||||||
if in.Method != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"method\":")
|
|
||||||
(in.Method).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
if (in.Params).IsDefined() {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"params\":")
|
|
||||||
(in.Params).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
if (in.Result).IsDefined() {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"result\":")
|
|
||||||
(in.Result).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
if in.Error != nil {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"error\":")
|
|
||||||
if in.Error == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
(*in.Error).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v Message) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v Message) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *Message) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Frame) {
|
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -922,7 +811,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Frame
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Frame) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(out *jwriter.Writer, in Frame) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -988,27 +877,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v Frame) MarshalJSON() ([]byte, error) {
|
func (v Frame) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v Frame) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v Frame) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *Frame) UnmarshalJSON(data []byte) error {
|
func (v *Frame) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *Frame) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *Frame) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *BackendNode) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Message) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -1027,12 +916,24 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *Backe
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
switch key {
|
||||||
case "nodeType":
|
case "id":
|
||||||
(out.NodeType).UnmarshalEasyJSON(in)
|
out.ID = int64(in.Int64())
|
||||||
case "nodeName":
|
case "method":
|
||||||
out.NodeName = string(in.String())
|
(out.Method).UnmarshalEasyJSON(in)
|
||||||
case "backendNodeId":
|
case "params":
|
||||||
(out.BackendNodeID).UnmarshalEasyJSON(in)
|
(out.Params).UnmarshalEasyJSON(in)
|
||||||
|
case "result":
|
||||||
|
(out.Result).UnmarshalEasyJSON(in)
|
||||||
|
case "error":
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
out.Error = nil
|
||||||
|
} else {
|
||||||
|
if out.Error == nil {
|
||||||
|
out.Error = new(MessageError)
|
||||||
|
}
|
||||||
|
(*out.Error).UnmarshalEasyJSON(in)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -1043,57 +944,156 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *Backe
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in BackendNode) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Message) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
if in.NodeType != 0 {
|
if in.ID != 0 {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"nodeType\":")
|
out.RawString("\"id\":")
|
||||||
(in.NodeType).MarshalEasyJSON(out)
|
out.Int64(int64(in.ID))
|
||||||
}
|
}
|
||||||
if in.NodeName != "" {
|
if in.Method != "" {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"nodeName\":")
|
out.RawString("\"method\":")
|
||||||
out.String(string(in.NodeName))
|
(in.Method).MarshalEasyJSON(out)
|
||||||
}
|
}
|
||||||
if in.BackendNodeID != 0 {
|
if (in.Params).IsDefined() {
|
||||||
if !first {
|
if !first {
|
||||||
out.RawByte(',')
|
out.RawByte(',')
|
||||||
}
|
}
|
||||||
first = false
|
first = false
|
||||||
out.RawString("\"backendNodeId\":")
|
out.RawString("\"params\":")
|
||||||
out.Int64(int64(in.BackendNodeID))
|
(in.Params).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
if (in.Result).IsDefined() {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"result\":")
|
||||||
|
(in.Result).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
if in.Error != nil {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"error\":")
|
||||||
|
if in.Error == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
} else {
|
||||||
|
(*in.Error).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v BackendNode) MarshalJSON() ([]byte, error) {
|
func (v Message) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v Message) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *Message) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *MessageError) {
|
||||||
|
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 "code":
|
||||||
|
out.Code = int64(in.Int64())
|
||||||
|
case "message":
|
||||||
|
out.Message = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in MessageError) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.Code != 0 {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"code\":")
|
||||||
|
out.Int64(int64(in.Code))
|
||||||
|
}
|
||||||
|
if in.Message != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"message\":")
|
||||||
|
out.String(string(in.Message))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v MessageError) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v MessageError) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *BackendNode) UnmarshalJSON(data []byte) error {
|
func (v *MessageError) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *MessageError) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(l, v)
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetDeviceMetricsOverrideParams overrides the values of device screen
|
// SetDeviceMetricsOverrideParams overrides the values of device screen
|
||||||
|
@ -98,39 +97,7 @@ func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation
|
||||||
// Do executes Emulation.setDeviceMetricsOverride against the provided context and
|
// Do executes Emulation.setDeviceMetricsOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearDeviceMetricsOverrideParams clears the overriden device metrics.
|
// ClearDeviceMetricsOverrideParams clears the overriden device metrics.
|
||||||
|
@ -144,33 +111,7 @@ func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
|
||||||
// Do executes Emulation.clearDeviceMetricsOverride against the provided context and
|
// Do executes Emulation.clearDeviceMetricsOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationClearDeviceMetricsOverride, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationClearDeviceMetricsOverride, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForceViewportParams overrides the visible area of the page. The change is
|
// ForceViewportParams overrides the visible area of the page. The change is
|
||||||
|
@ -203,39 +144,7 @@ func ForceViewport(x float64, y float64, scale float64) *ForceViewportParams {
|
||||||
// Do executes Emulation.forceViewport against the provided context and
|
// Do executes Emulation.forceViewport against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationForceViewport, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationForceViewport, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetViewportParams resets the visible area of the page to the original
|
// ResetViewportParams resets the visible area of the page to the original
|
||||||
|
@ -251,33 +160,7 @@ func ResetViewport() *ResetViewportParams {
|
||||||
// Do executes Emulation.resetViewport against the provided context and
|
// Do executes Emulation.resetViewport against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationResetViewport, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationResetViewport, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetPageScaleFactorParams requests that page scale factor is reset to
|
// ResetPageScaleFactorParams requests that page scale factor is reset to
|
||||||
|
@ -293,33 +176,7 @@ func ResetPageScaleFactor() *ResetPageScaleFactorParams {
|
||||||
// Do executes Emulation.resetPageScaleFactor against the provided context and
|
// Do executes Emulation.resetPageScaleFactor against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationResetPageScaleFactor, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationResetPageScaleFactor, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPageScaleFactorParams sets a specified page scale factor.
|
// SetPageScaleFactorParams sets a specified page scale factor.
|
||||||
|
@ -340,39 +197,7 @@ func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams {
|
||||||
// Do executes Emulation.setPageScaleFactor against the provided context and
|
// Do executes Emulation.setPageScaleFactor against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetPageScaleFactor, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetPageScaleFactor, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVisibleSizeParams resizes the frame/viewport of the page. Note that
|
// SetVisibleSizeParams resizes the frame/viewport of the page. Note that
|
||||||
|
@ -400,39 +225,7 @@ func SetVisibleSize(width int64, height int64) *SetVisibleSizeParams {
|
||||||
// Do executes Emulation.setVisibleSize against the provided context and
|
// Do executes Emulation.setVisibleSize against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetVisibleSize, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetVisibleSize, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetScriptExecutionDisabledParams switches script execution in the page.
|
// SetScriptExecutionDisabledParams switches script execution in the page.
|
||||||
|
@ -453,39 +246,7 @@ func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams {
|
||||||
// Do executes Emulation.setScriptExecutionDisabled against the provided context and
|
// Do executes Emulation.setScriptExecutionDisabled against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetScriptExecutionDisabled, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetScriptExecutionDisabled, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGeolocationOverrideParams overrides the Geolocation Position or Error.
|
// SetGeolocationOverrideParams overrides the Geolocation Position or Error.
|
||||||
|
@ -525,39 +286,7 @@ func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeoloca
|
||||||
// Do executes Emulation.setGeolocationOverride against the provided context and
|
// Do executes Emulation.setGeolocationOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearGeolocationOverrideParams clears the overriden Geolocation Position
|
// ClearGeolocationOverrideParams clears the overriden Geolocation Position
|
||||||
|
@ -573,33 +302,7 @@ func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
|
||||||
// Do executes Emulation.clearGeolocationOverride against the provided context and
|
// Do executes Emulation.clearGeolocationOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTouchEmulationEnabledParams toggles mouse event-based touch event
|
// SetTouchEmulationEnabledParams toggles mouse event-based touch event
|
||||||
|
@ -629,39 +332,7 @@ func (p SetTouchEmulationEnabledParams) WithConfiguration(configuration EnabledC
|
||||||
// Do executes Emulation.setTouchEmulationEnabled against the provided context and
|
// Do executes Emulation.setTouchEmulationEnabled against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEmulatedMediaParams emulates the given media for CSS media queries.
|
// SetEmulatedMediaParams emulates the given media for CSS media queries.
|
||||||
|
@ -682,39 +353,7 @@ func SetEmulatedMedia(media string) *SetEmulatedMediaParams {
|
||||||
// Do executes Emulation.setEmulatedMedia against the provided context and
|
// Do executes Emulation.setEmulatedMedia against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
|
// SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
|
||||||
|
@ -735,39 +374,7 @@ func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams {
|
||||||
// Do executes Emulation.setCPUThrottlingRate against the provided context and
|
// Do executes Emulation.setCPUThrottlingRate against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanEmulateParams tells whether emulation is supported.
|
// CanEmulateParams tells whether emulation is supported.
|
||||||
|
@ -789,40 +396,14 @@ type CanEmulateReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// result - True if emulation is supported.
|
// result - True if emulation is supported.
|
||||||
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationCanEmulate, cdp.Empty)
|
var res CanEmulateReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandEmulationCanEmulate, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return false, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CanEmulateReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
return res.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVirtualTimePolicyParams turns on virtual time for all frames (replacing
|
// SetVirtualTimePolicyParams turns on virtual time for all frames (replacing
|
||||||
|
@ -855,39 +436,7 @@ func (p SetVirtualTimePolicyParams) WithBudget(budget int64) *SetVirtualTimePoli
|
||||||
// Do executes Emulation.setVirtualTimePolicy against the provided context and
|
// Do executes Emulation.setVirtualTimePolicy against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetVirtualTimePolicy, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetVirtualTimePolicy, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaultBackgroundColorOverrideParams sets or clears an override of the
|
// SetDefaultBackgroundColorOverrideParams sets or clears an override of the
|
||||||
|
@ -916,37 +465,5 @@ func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *Set
|
||||||
// Do executes Emulation.setDefaultBackgroundColorOverride against the provided context and
|
// Do executes Emulation.setDefaultBackgroundColorOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandEmulationSetDefaultBackgroundColorOverride, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandEmulationSetDefaultBackgroundColorOverride, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,6 @@ import (
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/knq/chromedp/cdp/runtime"
|
"github.com/knq/chromedp/cdp/runtime"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams [no description].
|
// EnableParams [no description].
|
||||||
|
@ -25,33 +24,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes HeapProfiler.enable against the provided context and
|
// Do executes HeapProfiler.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams [no description].
|
// DisableParams [no description].
|
||||||
|
@ -65,33 +38,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes HeapProfiler.disable against the provided context and
|
// Do executes HeapProfiler.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartTrackingHeapObjectsParams [no description].
|
// StartTrackingHeapObjectsParams [no description].
|
||||||
|
@ -115,39 +62,7 @@ func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bo
|
||||||
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
|
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerStartTrackingHeapObjects, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStartTrackingHeapObjects, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopTrackingHeapObjectsParams [no description].
|
// StopTrackingHeapObjectsParams [no description].
|
||||||
|
@ -172,39 +87,7 @@ func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *
|
||||||
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
|
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerStopTrackingHeapObjects, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStopTrackingHeapObjects, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TakeHeapSnapshotParams [no description].
|
// TakeHeapSnapshotParams [no description].
|
||||||
|
@ -229,39 +112,7 @@ func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHea
|
||||||
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
|
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollectGarbageParams [no description].
|
// CollectGarbageParams [no description].
|
||||||
|
@ -275,33 +126,7 @@ func CollectGarbage() *CollectGarbageParams {
|
||||||
// Do executes HeapProfiler.collectGarbage against the provided context and
|
// Do executes HeapProfiler.collectGarbage against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerCollectGarbage, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerCollectGarbage, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObjectByHeapObjectIDParams [no description].
|
// GetObjectByHeapObjectIDParams [no description].
|
||||||
|
@ -338,46 +163,14 @@ type GetObjectByHeapObjectIDReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// result - Evaluation result.
|
// result - Evaluation result.
|
||||||
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, err error) {
|
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetObjectByHeapObjectIDReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetObjectByHeapObjectID, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerGetObjectByHeapObjectID, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetObjectByHeapObjectIDReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddInspectedHeapObjectParams enables console to refer to the node with
|
// AddInspectedHeapObjectParams enables console to refer to the node with
|
||||||
|
@ -400,39 +193,7 @@ func AddInspectedHeapObject(heapObjectID HeapSnapshotObjectID) *AddInspectedHeap
|
||||||
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
|
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerAddInspectedHeapObject, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerAddInspectedHeapObject, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHeapObjectIDParams [no description].
|
// GetHeapObjectIDParams [no description].
|
||||||
|
@ -461,46 +222,14 @@ type GetHeapObjectIDReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
|
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
|
||||||
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
|
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetHeapObjectIDReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetHeapObjectID, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.HeapSnapshotObjectID, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerGetHeapObjectID, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetHeapObjectIDReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.HeapSnapshotObjectID, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartSamplingParams [no description].
|
// StartSamplingParams [no description].
|
||||||
|
@ -525,39 +254,7 @@ func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *Sta
|
||||||
// Do executes HeapProfiler.startSampling against the provided context and
|
// Do executes HeapProfiler.startSampling against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandHeapProfilerStartSampling, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStartSampling, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopSamplingParams [no description].
|
// StopSamplingParams [no description].
|
||||||
|
@ -579,38 +276,12 @@ type StopSamplingReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// profile - Recorded sampling heap profile.
|
// profile - Recorded sampling heap profile.
|
||||||
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
|
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, cdp.Empty)
|
var res StopSamplingReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r StopSamplingReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Profile, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.Profile, nil
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables events from backend.
|
// EnableParams enables events from backend.
|
||||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes IndexedDB.enable against the provided context and
|
// Do executes IndexedDB.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandIndexedDBEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables events from backend.
|
// DisableParams disables events from backend.
|
||||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes IndexedDB.disable against the provided context and
|
// Do executes IndexedDB.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandIndexedDBDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestDatabaseNamesParams requests database names for given security
|
// RequestDatabaseNamesParams requests database names for given security
|
||||||
|
@ -120,46 +67,14 @@ type RequestDatabaseNamesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// databaseNames - Database names for origin.
|
// databaseNames - Database names for origin.
|
||||||
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
|
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RequestDatabaseNamesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.DatabaseNames, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestDatabaseNamesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.DatabaseNames, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestDatabaseParams requests database with given name in given frame.
|
// RequestDatabaseParams requests database with given name in given frame.
|
||||||
|
@ -191,46 +106,14 @@ type RequestDatabaseReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// databaseWithObjectStores - Database with an array of object stores.
|
// databaseWithObjectStores - Database with an array of object stores.
|
||||||
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RequestDatabaseReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.DatabaseWithObjectStores, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestDatabaseReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.DatabaseWithObjectStores, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestDataParams requests data from object store or index.
|
// RequestDataParams requests data from object store or index.
|
||||||
|
@ -283,46 +166,14 @@ type RequestDataReturns struct {
|
||||||
// objectStoreDataEntries - Array of object store data entries.
|
// objectStoreDataEntries - Array of object store data entries.
|
||||||
// hasMore - If true, there are more entries to fetch in the given range.
|
// hasMore - If true, there are more entries to fetch in the given range.
|
||||||
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RequestDataReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestData, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.ObjectStoreDataEntries, res.HasMore, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBRequestData, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestDataReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.ObjectStoreDataEntries, r.HasMore, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearObjectStoreParams clears all entries from an object store.
|
// ClearObjectStoreParams clears all entries from an object store.
|
||||||
|
@ -349,39 +200,7 @@ func ClearObjectStore(securityOrigin string, databaseName string, objectStoreNam
|
||||||
// Do executes IndexedDB.clearObjectStore against the provided context and
|
// Do executes IndexedDB.clearObjectStore against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteDatabaseParams deletes a database.
|
// DeleteDatabaseParams deletes a database.
|
||||||
|
@ -405,37 +224,5 @@ func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseP
|
||||||
// Do executes IndexedDB.deleteDatabase against the provided context and
|
// Do executes IndexedDB.deleteDatabase against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DispatchKeyEventParams dispatches a key event to the page.
|
// DispatchKeyEventParams dispatches a key event to the page.
|
||||||
|
@ -126,39 +125,7 @@ func (p DispatchKeyEventParams) WithIsSystemKey(isSystemKey bool) *DispatchKeyEv
|
||||||
// Do executes Input.dispatchKeyEvent against the provided context and
|
// Do executes Input.dispatchKeyEvent against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputDispatchKeyEvent, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchKeyEvent, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DispatchMouseEventParams dispatches a mouse event to the page.
|
// DispatchMouseEventParams dispatches a mouse event to the page.
|
||||||
|
@ -215,39 +182,7 @@ func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMous
|
||||||
// Do executes Input.dispatchMouseEvent against the provided context and
|
// Do executes Input.dispatchMouseEvent against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputDispatchMouseEvent, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchMouseEvent, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DispatchTouchEventParams dispatches a touch event to the page.
|
// DispatchTouchEventParams dispatches a touch event to the page.
|
||||||
|
@ -287,39 +222,7 @@ func (p DispatchTouchEventParams) WithTimestamp(timestamp float64) *DispatchTouc
|
||||||
// Do executes Input.dispatchTouchEvent against the provided context and
|
// Do executes Input.dispatchTouchEvent against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputDispatchTouchEvent, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputDispatchTouchEvent, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// EmulateTouchFromMouseEventParams emulates touch event from the mouse event
|
// EmulateTouchFromMouseEventParams emulates touch event from the mouse event
|
||||||
|
@ -383,39 +286,7 @@ func (p EmulateTouchFromMouseEventParams) WithClickCount(clickCount int64) *Emul
|
||||||
// Do executes Input.emulateTouchFromMouseEvent against the provided context and
|
// Do executes Input.emulateTouchFromMouseEvent against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputEmulateTouchFromMouseEvent, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputEmulateTouchFromMouseEvent, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SynthesizePinchGestureParams synthesizes a pinch gesture over a time
|
// SynthesizePinchGestureParams synthesizes a pinch gesture over a time
|
||||||
|
@ -460,39 +331,7 @@ func (p SynthesizePinchGestureParams) WithGestureSourceType(gestureSourceType Ge
|
||||||
// Do executes Input.synthesizePinchGesture against the provided context and
|
// Do executes Input.synthesizePinchGesture against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputSynthesizePinchGesture, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizePinchGesture, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SynthesizeScrollGestureParams synthesizes a scroll gesture over a time
|
// SynthesizeScrollGestureParams synthesizes a scroll gesture over a time
|
||||||
|
@ -595,39 +434,7 @@ func (p SynthesizeScrollGestureParams) WithInteractionMarkerName(interactionMark
|
||||||
// Do executes Input.synthesizeScrollGesture against the provided context and
|
// Do executes Input.synthesizeScrollGesture against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputSynthesizeScrollGesture, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizeScrollGesture, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SynthesizeTapGestureParams synthesizes a tap gesture over a time period by
|
// SynthesizeTapGestureParams synthesizes a tap gesture over a time period by
|
||||||
|
@ -677,37 +484,5 @@ func (p SynthesizeTapGestureParams) WithGestureSourceType(gestureSourceType Gest
|
||||||
// Do executes Input.synthesizeTapGesture against the provided context and
|
// Do executes Input.synthesizeTapGesture against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInputSynthesizeTapGesture, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInputSynthesizeTapGesture, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, out *EventTargetCrashed) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, out *DisableParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -46,7 +46,125 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(out *jwriter.Writer, in EventTargetCrashed) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(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{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(in *jlexer.Lexer, out *EnableParams) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer, in EnableParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(in *jlexer.Lexer, out *EventTargetCrashed) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(out *jwriter.Writer, in EventTargetCrashed) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -56,27 +174,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(out *jwriter.Writer,
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventTargetCrashed) MarshalJSON() ([]byte, error) {
|
func (v EventTargetCrashed) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v EventTargetCrashed) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventTargetCrashed) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *EventTargetCrashed) UnmarshalJSON(data []byte) error {
|
func (v *EventTargetCrashed) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *EventTargetCrashed) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *EventTargetCrashed) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(in *jlexer.Lexer, out *EventDetached) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(in *jlexer.Lexer, out *EventDetached) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -107,7 +225,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(in *jlexer.Lexer, o
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer, in EventDetached) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(out *jwriter.Writer, in EventDetached) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -124,142 +242,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventDetached) MarshalJSON() ([]byte, error) {
|
func (v EventDetached) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v EventDetached) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *EventDetached) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *EventDetached) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(in *jlexer.Lexer, out *EnableParams) {
|
|
||||||
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(out *jwriter.Writer, in EnableParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(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{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventDetached) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
func (v *EventDetached) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *EventDetached) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(l, v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables inspector domain notifications.
|
// EnableParams enables inspector domain notifications.
|
||||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Inspector.enable against the provided context and
|
// Do executes Inspector.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInspectorEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInspectorEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables inspector domain notifications.
|
// DisableParams disables inspector domain notifications.
|
||||||
|
@ -64,31 +37,5 @@ func Disable() *DisableParams {
|
||||||
// Do executes Inspector.disable against the provided context and
|
// Do executes Inspector.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandInspectorDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandInspectorDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,74 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *ReadReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *CloseParams) {
|
||||||
|
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 "handle":
|
||||||
|
out.Handle = StreamHandle(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in CloseParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"handle\":")
|
||||||
|
out.String(string(in.Handle))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v CloseParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *CloseParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *ReadReturns) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -50,7 +117,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *Read
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ReadReturns) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadReturns) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -76,27 +143,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in Rea
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v ReadReturns) MarshalJSON() ([]byte, error) {
|
func (v ReadReturns) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *ReadReturns) UnmarshalJSON(data []byte) error {
|
func (v *ReadReturns) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *ReadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *ReadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *ReadParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *ReadParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -131,7 +198,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *Rea
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in ReadParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -162,91 +229,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in Re
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v ReadParams) MarshalJSON() ([]byte, error) {
|
func (v ReadParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *ReadParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *CloseParams) {
|
|
||||||
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 "handle":
|
|
||||||
out.Handle = StreamHandle(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in CloseParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"handle\":")
|
|
||||||
out.String(string(in.Handle))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v CloseParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *CloseParams) UnmarshalJSON(data []byte) error {
|
func (v *ReadParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v)
|
||||||
}
|
}
|
||||||
|
|
75
cdp/io/io.go
75
cdp/io/io.go
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReadParams read a chunk of the stream.
|
// ReadParams read a chunk of the stream.
|
||||||
|
@ -59,46 +58,14 @@ type ReadReturns struct {
|
||||||
// data - Data that were read.
|
// data - Data that were read.
|
||||||
// eof - Set if the end-of-file condition occured while reading.
|
// eof - Set if the end-of-file condition occured while reading.
|
||||||
func (p *ReadParams) Do(ctxt context.Context, h cdp.Handler) (data string, eof bool, err error) {
|
func (p *ReadParams) Do(ctxt context.Context, h cdp.Handler) (data string, eof bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res ReadReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandIORead, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false, err
|
return "", false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Data, res.EOF, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandIORead, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r ReadReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Data, r.EOF, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloseParams close the stream, discard any temporary backing storage.
|
// CloseParams close the stream, discard any temporary backing storage.
|
||||||
|
@ -119,37 +86,5 @@ func Close(handle StreamHandle) *CloseParams {
|
||||||
// Do executes IO.close against the provided context and
|
// Do executes IO.close against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandIOClose, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandIOClose, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,33 +25,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes LayerTree.enable against the provided context and
|
// Do executes LayerTree.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLayerTreeEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables compositing tree inspection.
|
// DisableParams disables compositing tree inspection.
|
||||||
|
@ -65,33 +39,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes LayerTree.disable against the provided context and
|
// Do executes LayerTree.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLayerTreeDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompositingReasonsParams provides the reasons why the given layer was
|
// CompositingReasonsParams provides the reasons why the given layer was
|
||||||
|
@ -122,46 +70,14 @@ type CompositingReasonsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
|
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
|
||||||
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (compositingReasons []string, err error) {
|
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (compositingReasons []string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res CompositingReasonsReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeCompositingReasons, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.CompositingReasons, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeCompositingReasons, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CompositingReasonsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.CompositingReasons, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeSnapshotParams returns the layer snapshot identifier.
|
// MakeSnapshotParams returns the layer snapshot identifier.
|
||||||
|
@ -190,46 +106,14 @@ type MakeSnapshotReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// snapshotID - The id of the layer snapshot.
|
// snapshotID - The id of the layer snapshot.
|
||||||
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res MakeSnapshotReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeMakeSnapshot, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.SnapshotID, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeMakeSnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r MakeSnapshotReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.SnapshotID, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadSnapshotParams returns the snapshot identifier.
|
// LoadSnapshotParams returns the snapshot identifier.
|
||||||
|
@ -258,46 +142,14 @@ type LoadSnapshotReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// snapshotID - The id of the snapshot.
|
// snapshotID - The id of the snapshot.
|
||||||
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res LoadSnapshotReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeLoadSnapshot, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.SnapshotID, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeLoadSnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r LoadSnapshotReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.SnapshotID, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseSnapshotParams releases layer snapshot captured by the back-end.
|
// ReleaseSnapshotParams releases layer snapshot captured by the back-end.
|
||||||
|
@ -318,39 +170,7 @@ func ReleaseSnapshot(snapshotID SnapshotID) *ReleaseSnapshotParams {
|
||||||
// Do executes LayerTree.releaseSnapshot against the provided context and
|
// Do executes LayerTree.releaseSnapshot against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProfileSnapshotParams [no description].
|
// ProfileSnapshotParams [no description].
|
||||||
|
@ -401,46 +221,14 @@ type ProfileSnapshotReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// timings - The array of paint profiles, one per run.
|
// timings - The array of paint profiles, one per run.
|
||||||
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings []PaintProfile, err error) {
|
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings []PaintProfile, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res ProfileSnapshotReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeProfileSnapshot, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Timings, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeProfileSnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r ProfileSnapshotReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Timings, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplaySnapshotParams replays the layer snapshot and returns the resulting
|
// ReplaySnapshotParams replays the layer snapshot and returns the resulting
|
||||||
|
@ -494,46 +282,14 @@ type ReplaySnapshotReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// dataURL - A data: URL for resulting image.
|
// dataURL - A data: URL for resulting image.
|
||||||
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.Handler) (dataURL string, err error) {
|
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.Handler) (dataURL string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res ReplaySnapshotReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeReplaySnapshot, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.DataURL, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeReplaySnapshot, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r ReplaySnapshotReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.DataURL, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotCommandLogParams replays the layer snapshot and returns canvas
|
// SnapshotCommandLogParams replays the layer snapshot and returns canvas
|
||||||
|
@ -563,44 +319,12 @@ type SnapshotCommandLogReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// commandLog - The array of canvas function calls.
|
// commandLog - The array of canvas function calls.
|
||||||
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.Handler) (commandLog []easyjson.RawMessage, err error) {
|
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.Handler) (commandLog []easyjson.RawMessage, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res SnapshotCommandLogReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandLayerTreeSnapshotCommandLog, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.CommandLog, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandLayerTreeSnapshotCommandLog, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r SnapshotCommandLogReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.CommandLog, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,86 +19,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(in *jlexer.Lexer, out *ViolationSetting) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(in *jlexer.Lexer, out *StopViolationsReportParams) {
|
||||||
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).UnmarshalEasyJSON(in)
|
|
||||||
case "threshold":
|
|
||||||
out.Threshold = float64(in.Float64())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(out *jwriter.Writer, in ViolationSetting) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.Name != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"name\":")
|
|
||||||
(in.Name).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
if in.Threshold != 0 {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"threshold\":")
|
|
||||||
out.Float64(float64(in.Threshold))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v ViolationSetting) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v ViolationSetting) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *ViolationSetting) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *ViolationSetting) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(in *jlexer.Lexer, out *StopViolationsReportParams) {
|
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -127,7 +48,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(in *jlexer.Lexer, out *St
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in StopViolationsReportParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(out *jwriter.Writer, in StopViolationsReportParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -137,27 +58,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in S
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v StopViolationsReportParams) MarshalJSON() ([]byte, error) {
|
func (v StopViolationsReportParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v StopViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v StopViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *StopViolationsReportParams) UnmarshalJSON(data []byte) error {
|
func (v *StopViolationsReportParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *StopViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *StopViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(in *jlexer.Lexer, out *StartViolationsReportParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(in *jlexer.Lexer, out *StartViolationsReportParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -213,7 +134,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(in *jlexer.Lexer, out *St
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in StartViolationsReportParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in StartViolationsReportParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -244,27 +165,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in S
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v StartViolationsReportParams) MarshalJSON() ([]byte, error) {
|
func (v StartViolationsReportParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v StartViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v StartViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *StartViolationsReportParams) UnmarshalJSON(data []byte) error {
|
func (v *StartViolationsReportParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *StartViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *StartViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *EventEntryAdded) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(in *jlexer.Lexer, out *ClearParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -283,16 +204,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *Ev
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
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:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -303,49 +214,234 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *Ev
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in EventEntryAdded) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in ClearParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = 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('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
func (v ClearParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v ClearParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *ClearParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *ClearParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(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{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *Entry) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *EnableParams) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in EnableParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(in *jlexer.Lexer, out *ViolationSetting) {
|
||||||
|
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).UnmarshalEasyJSON(in)
|
||||||
|
case "threshold":
|
||||||
|
out.Threshold = float64(in.Float64())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(out *jwriter.Writer, in ViolationSetting) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.Name != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"name\":")
|
||||||
|
(in.Name).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
if in.Threshold != 0 {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"threshold\":")
|
||||||
|
out.Float64(float64(in.Threshold))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v ViolationSetting) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v ViolationSetting) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *ViolationSetting) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *ViolationSetting) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(in *jlexer.Lexer, out *Entry) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -400,7 +496,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *En
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in Entry) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(out *jwriter.Writer, in Entry) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -485,146 +581,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in E
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v Entry) 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 Entry) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
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 *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(in *jlexer.Lexer, out *EnableParams) {
|
|
||||||
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(out *jwriter.Writer, in EnableParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(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{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v Entry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
func (v *Entry) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *ClearParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *EventEntryAdded) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -643,6 +621,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *Cl
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch key {
|
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:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -653,33 +641,45 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *Cl
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(out *jwriter.Writer, in ClearParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(out *jwriter.Writer, in EventEntryAdded) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = 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('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v ClearParams) MarshalJSON() ([]byte, error) {
|
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v ClearParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *ClearParams) UnmarshalJSON(data []byte) error {
|
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *ClearParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(l, v)
|
||||||
}
|
}
|
||||||
|
|
147
cdp/log/log.go
147
cdp/log/log.go
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables log domain, sends the entries collected so far to the
|
// EnableParams enables log domain, sends the entries collected so far to the
|
||||||
|
@ -28,33 +27,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Log.enable against the provided context and
|
// Do executes Log.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLogEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLogEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables log domain, prevents further log entries from being
|
// DisableParams disables log domain, prevents further log entries from being
|
||||||
|
@ -70,33 +43,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Log.disable against the provided context and
|
// Do executes Log.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLogDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLogDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearParams clears the log.
|
// ClearParams clears the log.
|
||||||
|
@ -110,33 +57,7 @@ func Clear() *ClearParams {
|
||||||
// Do executes Log.clear against the provided context and
|
// Do executes Log.clear against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLogClear, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLogClear, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartViolationsReportParams start violation reporting.
|
// StartViolationsReportParams start violation reporting.
|
||||||
|
@ -157,39 +78,7 @@ func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportPar
|
||||||
// Do executes Log.startViolationsReport against the provided context and
|
// Do executes Log.startViolationsReport against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLogStartViolationsReport, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLogStartViolationsReport, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopViolationsReportParams stop violation reporting.
|
// StopViolationsReportParams stop violation reporting.
|
||||||
|
@ -203,31 +92,5 @@ func StopViolationsReport() *StopViolationsReportParams {
|
||||||
// Do executes Log.stopViolationsReport against the provided context and
|
// Do executes Log.stopViolationsReport against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandLogStopViolationsReport, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandLogStopViolationsReport, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDOMCountersParams [no description].
|
// GetDOMCountersParams [no description].
|
||||||
|
@ -36,40 +35,14 @@ type GetDOMCountersReturns struct {
|
||||||
// nodes
|
// nodes
|
||||||
// jsEventListeners
|
// jsEventListeners
|
||||||
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.Handler) (documents int64, nodes int64, jsEventListeners int64, err error) {
|
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.Handler) (documents int64, nodes int64, jsEventListeners int64, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, cdp.Empty)
|
var res GetDOMCountersReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return 0, 0, 0, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return 0, 0, 0, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetDOMCountersReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, 0, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Documents, r.Nodes, r.JsEventListeners, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return 0, 0, 0, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return 0, 0, 0, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, 0, 0, cdp.ErrUnknownResult
|
return res.Documents, res.Nodes, res.JsEventListeners, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPressureNotificationsSuppressedParams enable/disable suppressing memory
|
// SetPressureNotificationsSuppressedParams enable/disable suppressing memory
|
||||||
|
@ -92,39 +65,7 @@ func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificatio
|
||||||
// Do executes Memory.setPressureNotificationsSuppressed against the provided context and
|
// Do executes Memory.setPressureNotificationsSuppressed against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimulatePressureNotificationParams simulate a memory pressure notification
|
// SimulatePressureNotificationParams simulate a memory pressure notification
|
||||||
|
@ -147,37 +88,5 @@ func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotifica
|
||||||
// Do executes Memory.simulatePressureNotification against the provided context and
|
// Do executes Memory.simulatePressureNotification against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,6 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables network tracking, network events will now be
|
// EnableParams enables network tracking, network events will now be
|
||||||
|
@ -50,39 +49,7 @@ func (p EnableParams) WithMaxResourceBufferSize(maxResourceBufferSize int64) *En
|
||||||
// Do executes Network.enable against the provided context and
|
// Do executes Network.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkEnable, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkEnable, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables network tracking, prevents network events from
|
// DisableParams disables network tracking, prevents network events from
|
||||||
|
@ -98,33 +65,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Network.disable against the provided context and
|
// Do executes Network.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetUserAgentOverrideParams allows overriding user agent with the given
|
// SetUserAgentOverrideParams allows overriding user agent with the given
|
||||||
|
@ -146,39 +87,7 @@ func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams {
|
||||||
// Do executes Network.setUserAgentOverride against the provided context and
|
// Do executes Network.setUserAgentOverride against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetUserAgentOverride, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetUserAgentOverride, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
|
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
|
||||||
|
@ -201,39 +110,7 @@ func SetExtraHTTPHeaders(headers *Headers) *SetExtraHTTPHeadersParams {
|
||||||
// Do executes Network.setExtraHTTPHeaders against the provided context and
|
// Do executes Network.setExtraHTTPHeaders against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetExtraHTTPHeaders, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetExtraHTTPHeaders, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponseBodyParams returns content served for the given request.
|
// GetResponseBodyParams returns content served for the given request.
|
||||||
|
@ -263,57 +140,24 @@ type GetResponseBodyReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// body - Response body.
|
// body - Response body.
|
||||||
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
|
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetResponseBodyReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
// decode
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, easyjson.RawMessage(buf))
|
var dec []byte
|
||||||
|
if res.Base64encoded {
|
||||||
// read response
|
dec, err = base64.StdEncoding.DecodeString(res.Body)
|
||||||
select {
|
if err != nil {
|
||||||
case res := <-ch:
|
return nil, err
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
switch v := res.(type) {
|
dec = []byte(res.Body)
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetResponseBodyReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
// decode
|
|
||||||
var dec []byte
|
|
||||||
if r.Base64encoded {
|
|
||||||
dec, err = base64.StdEncoding.DecodeString(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dec = []byte(r.Body)
|
|
||||||
}
|
|
||||||
|
|
||||||
return dec, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
return dec, nil
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddBlockedURLParams blocks specific URL from loading.
|
// AddBlockedURLParams blocks specific URL from loading.
|
||||||
|
@ -334,39 +178,7 @@ func AddBlockedURL(url string) *AddBlockedURLParams {
|
||||||
// Do executes Network.addBlockedURL against the provided context and
|
// Do executes Network.addBlockedURL against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkAddBlockedURL, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkAddBlockedURL, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveBlockedURLParams cancels blocking of a specific URL from loading.
|
// RemoveBlockedURLParams cancels blocking of a specific URL from loading.
|
||||||
|
@ -387,39 +199,7 @@ func RemoveBlockedURL(url string) *RemoveBlockedURLParams {
|
||||||
// Do executes Network.removeBlockedURL against the provided context and
|
// Do executes Network.removeBlockedURL against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkRemoveBlockedURL, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkRemoveBlockedURL, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplayXHRParams this method sends a new XMLHttpRequest which is identical
|
// ReplayXHRParams this method sends a new XMLHttpRequest which is identical
|
||||||
|
@ -446,39 +226,7 @@ func ReplayXHR(requestID RequestID) *ReplayXHRParams {
|
||||||
// Do executes Network.replayXHR against the provided context and
|
// Do executes Network.replayXHR against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkReplayXHR, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkReplayXHR, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMonitoringXHREnabledParams toggles monitoring of XMLHttpRequest. If
|
// SetMonitoringXHREnabledParams toggles monitoring of XMLHttpRequest. If
|
||||||
|
@ -501,39 +249,7 @@ func SetMonitoringXHREnabled(enabled bool) *SetMonitoringXHREnabledParams {
|
||||||
// Do executes Network.setMonitoringXHREnabled against the provided context and
|
// Do executes Network.setMonitoringXHREnabled against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetMonitoringXHREnabled, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetMonitoringXHREnabled, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanClearBrowserCacheParams tells whether clearing browser cache is
|
// CanClearBrowserCacheParams tells whether clearing browser cache is
|
||||||
|
@ -556,40 +272,14 @@ type CanClearBrowserCacheReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// result - True if browser cache can be cleared.
|
// result - True if browser cache can be cleared.
|
||||||
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCache, cdp.Empty)
|
var res CanClearBrowserCacheReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCache, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return false, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CanClearBrowserCacheReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
return res.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBrowserCacheParams clears browser cache.
|
// ClearBrowserCacheParams clears browser cache.
|
||||||
|
@ -603,33 +293,7 @@ func ClearBrowserCache() *ClearBrowserCacheParams {
|
||||||
// Do executes Network.clearBrowserCache against the provided context and
|
// Do executes Network.clearBrowserCache against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCache, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkClearBrowserCache, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanClearBrowserCookiesParams tells whether clearing browser cookies is
|
// CanClearBrowserCookiesParams tells whether clearing browser cookies is
|
||||||
|
@ -653,40 +317,14 @@ type CanClearBrowserCookiesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// result - True if browser cookies can be cleared.
|
// result - True if browser cookies can be cleared.
|
||||||
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCookies, cdp.Empty)
|
var res CanClearBrowserCookiesReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCookies, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return false, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CanClearBrowserCookiesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
return res.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBrowserCookiesParams clears browser cookies.
|
// ClearBrowserCookiesParams clears browser cookies.
|
||||||
|
@ -700,33 +338,7 @@ func ClearBrowserCookies() *ClearBrowserCookiesParams {
|
||||||
// Do executes Network.clearBrowserCookies against the provided context and
|
// Do executes Network.clearBrowserCookies against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCookies, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkClearBrowserCookies, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCookiesParams returns all browser cookies for the current URL.
|
// GetCookiesParams returns all browser cookies for the current URL.
|
||||||
|
@ -762,46 +374,14 @@ type GetCookiesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// cookies - Array of cookie objects.
|
// cookies - Array of cookie objects.
|
||||||
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetCookiesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandNetworkGetCookies, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Cookies, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetCookies, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetCookiesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Cookies, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllCookiesParams returns all browser cookies. Depending on the backend
|
// GetAllCookiesParams returns all browser cookies. Depending on the backend
|
||||||
|
@ -825,40 +405,14 @@ type GetAllCookiesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// cookies - Array of cookie objects.
|
// cookies - Array of cookie objects.
|
||||||
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, cdp.Empty)
|
var res GetAllCookiesReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetAllCookiesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Cookies, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.Cookies, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteCookieParams deletes browser cookie with given name, domain and
|
// DeleteCookieParams deletes browser cookie with given name, domain and
|
||||||
|
@ -883,39 +437,7 @@ func DeleteCookie(cookieName string, url string) *DeleteCookieParams {
|
||||||
// Do executes Network.deleteCookie against the provided context and
|
// Do executes Network.deleteCookie against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkDeleteCookie, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkDeleteCookie, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCookieParams sets a cookie with the given cookie data; may overwrite
|
// SetCookieParams sets a cookie with the given cookie data; may overwrite
|
||||||
|
@ -994,46 +516,14 @@ type SetCookieReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// success - True if successfully set cookie.
|
// success - True if successfully set cookie.
|
||||||
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res SetCookieReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandNetworkSetCookie, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Success, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetCookie, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r SetCookieReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Success, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanEmulateNetworkConditionsParams tells whether emulation of network
|
// CanEmulateNetworkConditionsParams tells whether emulation of network
|
||||||
|
@ -1057,40 +547,14 @@ type CanEmulateNetworkConditionsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// result - True if emulation of network conditions is supported.
|
// result - True if emulation of network conditions is supported.
|
||||||
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanEmulateNetworkConditions, cdp.Empty)
|
var res CanEmulateNetworkConditionsReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandNetworkCanEmulateNetworkConditions, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return false, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CanEmulateNetworkConditionsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
return res.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EmulateNetworkConditionsParams activates emulation of network conditions.
|
// EmulateNetworkConditionsParams activates emulation of network conditions.
|
||||||
|
@ -1127,39 +591,7 @@ func (p EmulateNetworkConditionsParams) WithConnectionType(connectionType Connec
|
||||||
// Do executes Network.emulateNetworkConditions against the provided context and
|
// Do executes Network.emulateNetworkConditions against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkEmulateNetworkConditions, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkEmulateNetworkConditions, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCacheDisabledParams toggles ignoring cache for each request. If true,
|
// SetCacheDisabledParams toggles ignoring cache for each request. If true,
|
||||||
|
@ -1182,39 +614,7 @@ func SetCacheDisabled(cacheDisabled bool) *SetCacheDisabledParams {
|
||||||
// Do executes Network.setCacheDisabled against the provided context and
|
// Do executes Network.setCacheDisabled against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetCacheDisabled, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetCacheDisabled, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBypassServiceWorkerParams toggles ignoring of service worker for each
|
// SetBypassServiceWorkerParams toggles ignoring of service worker for each
|
||||||
|
@ -1237,39 +637,7 @@ func SetBypassServiceWorker(bypass bool) *SetBypassServiceWorkerParams {
|
||||||
// Do executes Network.setBypassServiceWorker against the provided context and
|
// Do executes Network.setBypassServiceWorker against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetBypassServiceWorker, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetBypassServiceWorker, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDataSizeLimitsForTestParams for testing.
|
// SetDataSizeLimitsForTestParams for testing.
|
||||||
|
@ -1293,39 +661,7 @@ func SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) *SetDat
|
||||||
// Do executes Network.setDataSizeLimitsForTest against the provided context and
|
// Do executes Network.setDataSizeLimitsForTest against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandNetworkSetDataSizeLimitsForTest, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkSetDataSizeLimitsForTest, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCertificateParams returns the DER-encoded certificate.
|
// GetCertificateParams returns the DER-encoded certificate.
|
||||||
|
@ -1354,44 +690,12 @@ type GetCertificateReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// tableNames
|
// tableNames
|
||||||
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetCertificateReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandNetworkGetCertificate, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.TableNames, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetCertificate, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetCertificateReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.TableNames, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
6762
cdp/page/easyjson.go
6762
cdp/page/easyjson.go
File diff suppressed because it is too large
Load Diff
921
cdp/page/page.go
921
cdp/page/page.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams [no description].
|
// EnableParams [no description].
|
||||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Profiler.enable against the provided context and
|
// Do executes Profiler.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandProfilerEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandProfilerEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams [no description].
|
// DisableParams [no description].
|
||||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Profiler.disable against the provided context and
|
// Do executes Profiler.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandProfilerDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandProfilerDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSamplingIntervalParams changes CPU profiler sampling interval. Must be
|
// SetSamplingIntervalParams changes CPU profiler sampling interval. Must be
|
||||||
|
@ -113,39 +60,7 @@ func SetSamplingInterval(interval int64) *SetSamplingIntervalParams {
|
||||||
// Do executes Profiler.setSamplingInterval against the provided context and
|
// Do executes Profiler.setSamplingInterval against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandProfilerSetSamplingInterval, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandProfilerSetSamplingInterval, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartParams [no description].
|
// StartParams [no description].
|
||||||
|
@ -159,33 +74,7 @@ func Start() *StartParams {
|
||||||
// Do executes Profiler.start against the provided context and
|
// Do executes Profiler.start against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandProfilerStart, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandProfilerStart, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopParams [no description].
|
// StopParams [no description].
|
||||||
|
@ -207,38 +96,12 @@ type StopReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// profile - Recorded profile.
|
// profile - Recorded profile.
|
||||||
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandProfilerStop, cdp.Empty)
|
var res StopReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandProfilerStop, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r StopReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Profile, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.Profile, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,141 @@ func (v *SetShowScrollBottleneckRectsParams) UnmarshalJSON(data []byte) error {
|
||||||
func (v *SetShowScrollBottleneckRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *SetShowScrollBottleneckRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(in *jlexer.Lexer, out *SetShowPaintRectsParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(in *jlexer.Lexer, out *SetShowFPSCounterParams) {
|
||||||
|
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 "show":
|
||||||
|
out.Show = bool(in.Bool())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer, in SetShowFPSCounterParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"show\":")
|
||||||
|
out.Bool(bool(in.Show))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v SetShowFPSCounterParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v SetShowFPSCounterParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *SetShowFPSCounterParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *SetShowFPSCounterParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(in *jlexer.Lexer, out *SetShowDebugBordersParams) {
|
||||||
|
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 "show":
|
||||||
|
out.Show = bool(in.Bool())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(out *jwriter.Writer, in SetShowDebugBordersParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"show\":")
|
||||||
|
out.Bool(bool(in.Show))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v SetShowDebugBordersParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v SetShowDebugBordersParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *SetShowDebugBordersParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *SetShowDebugBordersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(in *jlexer.Lexer, out *SetShowPaintRectsParams) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -182,7 +316,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(in *jlexer.Lexer, o
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer, in SetShowPaintRectsParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(out *jwriter.Writer, in SetShowPaintRectsParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -197,158 +331,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v SetShowPaintRectsParams) MarshalJSON() ([]byte, error) {
|
func (v SetShowPaintRectsParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v SetShowPaintRectsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *SetShowPaintRectsParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *SetShowPaintRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(in *jlexer.Lexer, out *SetShowFPSCounterParams) {
|
|
||||||
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 "show":
|
|
||||||
out.Show = bool(in.Bool())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(out *jwriter.Writer, in SetShowFPSCounterParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"show\":")
|
|
||||||
out.Bool(bool(in.Show))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v SetShowFPSCounterParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v SetShowFPSCounterParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *SetShowFPSCounterParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *SetShowFPSCounterParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(in *jlexer.Lexer, out *SetShowDebugBordersParams) {
|
|
||||||
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 "show":
|
|
||||||
out.Show = bool(in.Bool())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(out *jwriter.Writer, in SetShowDebugBordersParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"show\":")
|
|
||||||
out.Bool(bool(in.Show))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v SetShowDebugBordersParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v SetShowDebugBordersParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v SetShowPaintRectsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *SetShowDebugBordersParams) UnmarshalJSON(data []byte) error {
|
func (v *SetShowPaintRectsParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *SetShowDebugBordersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *SetShowPaintRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(l, v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetShowPaintRectsParams requests that backend shows paint rectangles.
|
// SetShowPaintRectsParams requests that backend shows paint rectangles.
|
||||||
|
@ -33,39 +32,7 @@ func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
|
||||||
// Do executes Rendering.setShowPaintRects against the provided context and
|
// Do executes Rendering.setShowPaintRects against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRenderingSetShowPaintRects, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowPaintRects, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetShowDebugBordersParams requests that backend shows debug borders on
|
// SetShowDebugBordersParams requests that backend shows debug borders on
|
||||||
|
@ -87,39 +54,7 @@ func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
|
||||||
// Do executes Rendering.setShowDebugBorders against the provided context and
|
// Do executes Rendering.setShowDebugBorders against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRenderingSetShowDebugBorders, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowDebugBorders, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetShowFPSCounterParams requests that backend shows the FPS counter.
|
// SetShowFPSCounterParams requests that backend shows the FPS counter.
|
||||||
|
@ -140,39 +75,7 @@ func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
|
||||||
// Do executes Rendering.setShowFPSCounter against the provided context and
|
// Do executes Rendering.setShowFPSCounter against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRenderingSetShowFPSCounter, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowFPSCounter, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
|
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
|
||||||
|
@ -195,39 +98,7 @@ func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams
|
||||||
// Do executes Rendering.setShowScrollBottleneckRects against the provided context and
|
// Do executes Rendering.setShowScrollBottleneckRects against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRenderingSetShowScrollBottleneckRects, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowScrollBottleneckRects, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetShowViewportSizeOnResizeParams paints viewport size upon main frame
|
// SetShowViewportSizeOnResizeParams paints viewport size upon main frame
|
||||||
|
@ -249,37 +120,5 @@ func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
|
||||||
// Do executes Rendering.setShowViewportSizeOnResize against the provided context and
|
// Do executes Rendering.setShowViewportSizeOnResize against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRenderingSetShowViewportSizeOnResize, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRenderingSetShowViewportSizeOnResize, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EvaluateParams evaluates expression on global object.
|
// EvaluateParams evaluates expression on global object.
|
||||||
|
@ -112,46 +111,14 @@ type EvaluateReturns struct {
|
||||||
// result - Evaluation result.
|
// result - Evaluation result.
|
||||||
// exceptionDetails - Exception details.
|
// exceptionDetails - Exception details.
|
||||||
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res EvaluateReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeEvaluate, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeEvaluate, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r EvaluateReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AwaitPromiseParams add handler to promise with given promise object id.
|
// AwaitPromiseParams add handler to promise with given promise object id.
|
||||||
|
@ -197,46 +164,14 @@ type AwaitPromiseReturns struct {
|
||||||
// result - Promise result. Will contain rejected value if promise was rejected.
|
// result - Promise result. Will contain rejected value if promise was rejected.
|
||||||
// exceptionDetails - Exception details if stack strace is available.
|
// exceptionDetails - Exception details if stack strace is available.
|
||||||
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res AwaitPromiseReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeAwaitPromise, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeAwaitPromise, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r AwaitPromiseReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CallFunctionOnParams calls function with given declaration on the given
|
// CallFunctionOnParams calls function with given declaration on the given
|
||||||
|
@ -319,46 +254,14 @@ type CallFunctionOnReturns struct {
|
||||||
// result - Call result.
|
// result - Call result.
|
||||||
// exceptionDetails - Exception details.
|
// exceptionDetails - Exception details.
|
||||||
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res CallFunctionOnReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeCallFunctionOn, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeCallFunctionOn, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CallFunctionOnReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPropertiesParams returns properties of a given object. Object group of
|
// GetPropertiesParams returns properties of a given object. Object group of
|
||||||
|
@ -416,46 +319,14 @@ type GetPropertiesReturns struct {
|
||||||
// internalProperties - Internal object properties (only of the element itself).
|
// internalProperties - Internal object properties (only of the element itself).
|
||||||
// exceptionDetails - Exception details.
|
// exceptionDetails - Exception details.
|
||||||
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.Handler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.Handler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetPropertiesReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeGetProperties, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, res.InternalProperties, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeGetProperties, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetPropertiesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, r.InternalProperties, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseObjectParams releases remote object with given id.
|
// ReleaseObjectParams releases remote object with given id.
|
||||||
|
@ -476,39 +347,7 @@ func ReleaseObject(objectID RemoteObjectID) *ReleaseObjectParams {
|
||||||
// Do executes Runtime.releaseObject against the provided context and
|
// Do executes Runtime.releaseObject against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeReleaseObject, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeReleaseObject, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseObjectGroupParams releases all remote objects that belong to a
|
// ReleaseObjectGroupParams releases all remote objects that belong to a
|
||||||
|
@ -531,39 +370,7 @@ func ReleaseObjectGroup(objectGroup string) *ReleaseObjectGroupParams {
|
||||||
// Do executes Runtime.releaseObjectGroup against the provided context and
|
// Do executes Runtime.releaseObjectGroup against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeReleaseObjectGroup, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeReleaseObjectGroup, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunIfWaitingForDebuggerParams tells inspected instance to run if it was
|
// RunIfWaitingForDebuggerParams tells inspected instance to run if it was
|
||||||
|
@ -579,33 +386,7 @@ func RunIfWaitingForDebugger() *RunIfWaitingForDebuggerParams {
|
||||||
// Do executes Runtime.runIfWaitingForDebugger against the provided context and
|
// Do executes Runtime.runIfWaitingForDebugger against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeRunIfWaitingForDebugger, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeRunIfWaitingForDebugger, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableParams enables reporting of execution contexts creation by means of
|
// EnableParams enables reporting of execution contexts creation by means of
|
||||||
|
@ -623,33 +404,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Runtime.enable against the provided context and
|
// Do executes Runtime.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables reporting of execution contexts creation.
|
// DisableParams disables reporting of execution contexts creation.
|
||||||
|
@ -663,33 +418,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Runtime.disable against the provided context and
|
// Do executes Runtime.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||||
|
@ -704,33 +433,7 @@ func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
||||||
// Do executes Runtime.discardConsoleEntries against the provided context and
|
// Do executes Runtime.discardConsoleEntries against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCustomObjectFormatterEnabledParams [no description].
|
// SetCustomObjectFormatterEnabledParams [no description].
|
||||||
|
@ -751,39 +454,7 @@ func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnab
|
||||||
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
|
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompileScriptParams compiles expression.
|
// CompileScriptParams compiles expression.
|
||||||
|
@ -829,46 +500,14 @@ type CompileScriptReturns struct {
|
||||||
// scriptID - Id of the script.
|
// scriptID - Id of the script.
|
||||||
// exceptionDetails - Exception details.
|
// exceptionDetails - Exception details.
|
||||||
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res CompileScriptReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeCompileScript, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.ScriptID, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeCompileScript, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CompileScriptReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.ScriptID, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunScriptParams runs script with given id in a given context.
|
// RunScriptParams runs script with given id in a given context.
|
||||||
|
@ -955,44 +594,12 @@ type RunScriptReturns struct {
|
||||||
// result - Run result.
|
// result - Run result.
|
||||||
// exceptionDetails - Exception details.
|
// exceptionDetails - Exception details.
|
||||||
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res RunScriptReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandRuntimeRunScript, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Result, res.ExceptionDetails, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandRuntimeRunScript, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RunScriptReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Result, r.ExceptionDetails, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDomainsParams returns supported domains.
|
// GetDomainsParams returns supported domains.
|
||||||
|
@ -34,38 +33,12 @@ type GetDomainsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// domains - List of supported domains.
|
// domains - List of supported domains.
|
||||||
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.Handler) (domains []*Domain, err error) {
|
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.Handler) (domains []*Domain, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandSchemaGetDomains, cdp.Empty)
|
var res GetDomainsReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandSchemaGetDomains, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetDomainsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Domains, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.Domains, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,106 +17,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out *StateExplanation) {
|
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 {
|
|
||||||
case "securityState":
|
|
||||||
(out.SecurityState).UnmarshalEasyJSON(in)
|
|
||||||
case "summary":
|
|
||||||
out.Summary = string(in.String())
|
|
||||||
case "description":
|
|
||||||
out.Description = string(in.String())
|
|
||||||
case "hasCertificate":
|
|
||||||
out.HasCertificate = bool(in.Bool())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, in StateExplanation) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.SecurityState != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"securityState\":")
|
|
||||||
(in.SecurityState).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
if in.Summary != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"summary\":")
|
|
||||||
out.String(string(in.Summary))
|
|
||||||
}
|
|
||||||
if in.Description != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"description\":")
|
|
||||||
out.String(string(in.Description))
|
|
||||||
}
|
|
||||||
if in.HasCertificate {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"hasCertificate\":")
|
|
||||||
out.Bool(bool(in.HasCertificate))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
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()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -145,7 +46,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -155,27 +56,145 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer,
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v ShowCertificateViewerParams) MarshalJSON() ([]byte, error) {
|
func (v ShowCertificateViewerParams) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v ShowCertificateViewerParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v ShowCertificateViewerParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *ShowCertificateViewerParams) UnmarshalJSON(data []byte) error {
|
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 *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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(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{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, out *InsecureContentStatus) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, out *EnableParams) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer, in EnableParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, out *InsecureContentStatus) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -216,7 +235,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer, in InsecureContentStatus) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in InsecureContentStatus) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -274,27 +293,126 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer,
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v InsecureContentStatus) MarshalJSON() ([]byte, error) {
|
func (v InsecureContentStatus) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v InsecureContentStatus) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v InsecureContentStatus) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *InsecureContentStatus) UnmarshalJSON(data []byte) error {
|
func (v *InsecureContentStatus) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *InsecureContentStatus) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *InsecureContentStatus) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, out *EventSecurityStateChanged) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(in *jlexer.Lexer, out *StateExplanation) {
|
||||||
|
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 "securityState":
|
||||||
|
(out.SecurityState).UnmarshalEasyJSON(in)
|
||||||
|
case "summary":
|
||||||
|
out.Summary = string(in.String())
|
||||||
|
case "description":
|
||||||
|
out.Description = string(in.String())
|
||||||
|
case "hasCertificate":
|
||||||
|
out.HasCertificate = bool(in.Bool())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(out *jwriter.Writer, in StateExplanation) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.SecurityState != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"securityState\":")
|
||||||
|
(in.SecurityState).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
if in.Summary != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"summary\":")
|
||||||
|
out.String(string(in.Summary))
|
||||||
|
}
|
||||||
|
if in.Description != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"description\":")
|
||||||
|
out.String(string(in.Description))
|
||||||
|
}
|
||||||
|
if in.HasCertificate {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"hasCertificate\":")
|
||||||
|
out.Bool(bool(in.HasCertificate))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v StateExplanation) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v StateExplanation) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *StateExplanation) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *StateExplanation) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(in *jlexer.Lexer, out *EventSecurityStateChanged) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -366,7 +484,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, ou
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in EventSecurityStateChanged) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer, in EventSecurityStateChanged) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -434,142 +552,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer,
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventSecurityStateChanged) MarshalJSON() ([]byte, error) {
|
func (v EventSecurityStateChanged) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v EventSecurityStateChanged) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *EventSecurityStateChanged) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *EventSecurityStateChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(in *jlexer.Lexer, out *EnableParams) {
|
|
||||||
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(out *jwriter.Writer, in EnableParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(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{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventSecurityStateChanged) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
func (v *EventSecurityStateChanged) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *EventSecurityStateChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(l, v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams enables tracking security state changes.
|
// EnableParams enables tracking security state changes.
|
||||||
|
@ -26,33 +25,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes Security.enable against the provided context and
|
// Do executes Security.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandSecurityEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandSecurityEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams disables tracking security state changes.
|
// DisableParams disables tracking security state changes.
|
||||||
|
@ -66,33 +39,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes Security.disable against the provided context and
|
// Do executes Security.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandSecurityDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandSecurityDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShowCertificateViewerParams displays native dialog with the certificate
|
// ShowCertificateViewerParams displays native dialog with the certificate
|
||||||
|
@ -107,31 +54,5 @@ func ShowCertificateViewer() *ShowCertificateViewerParams {
|
||||||
// Do executes Security.showCertificateViewer against the provided context and
|
// Do executes Security.showCertificateViewer against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandSecurityShowCertificateViewer, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandSecurityShowCertificateViewer, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableParams [no description].
|
// EnableParams [no description].
|
||||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
||||||
// Do executes ServiceWorker.enable against the provided context and
|
// Do executes ServiceWorker.enable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerEnable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerEnable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisableParams [no description].
|
// DisableParams [no description].
|
||||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
||||||
// Do executes ServiceWorker.disable against the provided context and
|
// Do executes ServiceWorker.disable against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerDisable, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDisable, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnregisterParams [no description].
|
// UnregisterParams [no description].
|
||||||
|
@ -111,39 +58,7 @@ func Unregister(scopeURL string) *UnregisterParams {
|
||||||
// Do executes ServiceWorker.unregister against the provided context and
|
// Do executes ServiceWorker.unregister against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateRegistrationParams [no description].
|
// UpdateRegistrationParams [no description].
|
||||||
|
@ -164,39 +79,7 @@ func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
||||||
// Do executes ServiceWorker.updateRegistration against the provided context and
|
// Do executes ServiceWorker.updateRegistration against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartWorkerParams [no description].
|
// StartWorkerParams [no description].
|
||||||
|
@ -217,39 +100,7 @@ func StartWorker(scopeURL string) *StartWorkerParams {
|
||||||
// Do executes ServiceWorker.startWorker against the provided context and
|
// Do executes ServiceWorker.startWorker against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkipWaitingParams [no description].
|
// SkipWaitingParams [no description].
|
||||||
|
@ -270,39 +121,7 @@ func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
||||||
// Do executes ServiceWorker.skipWaiting against the provided context and
|
// Do executes ServiceWorker.skipWaiting against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopWorkerParams [no description].
|
// StopWorkerParams [no description].
|
||||||
|
@ -323,39 +142,7 @@ func StopWorker(versionID string) *StopWorkerParams {
|
||||||
// Do executes ServiceWorker.stopWorker against the provided context and
|
// Do executes ServiceWorker.stopWorker against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InspectWorkerParams [no description].
|
// InspectWorkerParams [no description].
|
||||||
|
@ -376,39 +163,7 @@ func InspectWorker(versionID string) *InspectWorkerParams {
|
||||||
// Do executes ServiceWorker.inspectWorker against the provided context and
|
// Do executes ServiceWorker.inspectWorker against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerInspectWorker, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerInspectWorker, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetForceUpdateOnPageLoadParams [no description].
|
// SetForceUpdateOnPageLoadParams [no description].
|
||||||
|
@ -429,39 +184,7 @@ func SetForceUpdateOnPageLoad(forceUpdateOnPageLoad bool) *SetForceUpdateOnPageL
|
||||||
// Do executes ServiceWorker.setForceUpdateOnPageLoad against the provided context and
|
// Do executes ServiceWorker.setForceUpdateOnPageLoad against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerSetForceUpdateOnPageLoad, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerSetForceUpdateOnPageLoad, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeliverPushMessageParams [no description].
|
// DeliverPushMessageParams [no description].
|
||||||
|
@ -488,39 +211,7 @@ func DeliverPushMessage(origin string, registrationID string, data string) *Deli
|
||||||
// Do executes ServiceWorker.deliverPushMessage against the provided context and
|
// Do executes ServiceWorker.deliverPushMessage against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DispatchSyncEventParams [no description].
|
// DispatchSyncEventParams [no description].
|
||||||
|
@ -550,37 +241,5 @@ func DispatchSyncEvent(origin string, registrationID string, tag string, lastCha
|
||||||
// Do executes ServiceWorker.dispatchSyncEvent against the provided context and
|
// Do executes ServiceWorker.dispatchSyncEvent against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClearDataForOriginParams clears storage for origin.
|
// ClearDataForOriginParams clears storage for origin.
|
||||||
|
@ -34,37 +33,5 @@ func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginP
|
||||||
// Do executes Storage.clearDataForOrigin against the provided context and
|
// Do executes Storage.clearDataForOrigin against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,167 +17,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(in *jlexer.Lexer, out *GetInfoReturns) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(in *jlexer.Lexer, out *GPUInfo) {
|
||||||
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 "gpu":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.Gpu = nil
|
|
||||||
} else {
|
|
||||||
if out.Gpu == nil {
|
|
||||||
out.Gpu = new(GPUInfo)
|
|
||||||
}
|
|
||||||
(*out.Gpu).UnmarshalEasyJSON(in)
|
|
||||||
}
|
|
||||||
case "modelName":
|
|
||||||
out.ModelName = string(in.String())
|
|
||||||
case "modelVersion":
|
|
||||||
out.ModelVersion = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(out *jwriter.Writer, in GetInfoReturns) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if in.Gpu != nil {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"gpu\":")
|
|
||||||
if in.Gpu == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
(*in.Gpu).MarshalEasyJSON(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.ModelName != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"modelName\":")
|
|
||||||
out.String(string(in.ModelName))
|
|
||||||
}
|
|
||||||
if in.ModelVersion != "" {
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"modelVersion\":")
|
|
||||||
out.String(string(in.ModelVersion))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v GetInfoReturns) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v GetInfoReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *GetInfoReturns) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *GetInfoReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(in *jlexer.Lexer, out *GetInfoParams) {
|
|
||||||
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(out *jwriter.Writer, in GetInfoParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v GetInfoParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v GetInfoParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *GetInfoParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *GetInfoParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(in *jlexer.Lexer, out *GPUInfo) {
|
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -256,7 +96,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(in *jlexer.Lexer,
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Writer, in GPUInfo) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(out *jwriter.Writer, in GPUInfo) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -324,27 +164,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Write
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v GPUInfo) MarshalJSON() ([]byte, error) {
|
func (v GPUInfo) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v GPUInfo) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v GPUInfo) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *GPUInfo) UnmarshalJSON(data []byte) error {
|
func (v *GPUInfo) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *GPUInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *GPUInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(in *jlexer.Lexer, out *GPUDevice) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(in *jlexer.Lexer, out *GPUDevice) {
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -381,7 +221,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(in *jlexer.Lexer,
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Writer, in GPUDevice) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(out *jwriter.Writer, in GPUDevice) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -423,23 +263,183 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Write
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v GPUDevice) MarshalJSON() ([]byte, error) {
|
func (v GPUDevice) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v GPUDevice) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v GPUDevice) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *GPUDevice) UnmarshalJSON(data []byte) error {
|
func (v *GPUDevice) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *GPUDevice) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo1(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(in *jlexer.Lexer, out *GetInfoReturns) {
|
||||||
|
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 "gpu":
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
out.Gpu = nil
|
||||||
|
} else {
|
||||||
|
if out.Gpu == nil {
|
||||||
|
out.Gpu = new(GPUInfo)
|
||||||
|
}
|
||||||
|
(*out.Gpu).UnmarshalEasyJSON(in)
|
||||||
|
}
|
||||||
|
case "modelName":
|
||||||
|
out.ModelName = string(in.String())
|
||||||
|
case "modelVersion":
|
||||||
|
out.ModelVersion = string(in.String())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Writer, in GetInfoReturns) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if in.Gpu != nil {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"gpu\":")
|
||||||
|
if in.Gpu == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
} else {
|
||||||
|
(*in.Gpu).MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if in.ModelName != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"modelName\":")
|
||||||
|
out.String(string(in.ModelName))
|
||||||
|
}
|
||||||
|
if in.ModelVersion != "" {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"modelVersion\":")
|
||||||
|
out.String(string(in.ModelVersion))
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v GetInfoReturns) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v GetInfoReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *GetInfoReturns) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *GetInfoReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(in *jlexer.Lexer, out *GetInfoParams) {
|
||||||
|
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 easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Writer, in GetInfoParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v GetInfoParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v GetInfoParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *GetInfoParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *GPUDevice) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *GetInfoParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(l, v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetInfoParams returns information about the system.
|
// GetInfoParams returns information about the system.
|
||||||
|
@ -39,38 +38,12 @@ type GetInfoReturns struct {
|
||||||
// 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.
|
// 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.
|
// 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 cdp.Handler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
|
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.Handler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, cdp.Empty)
|
var res GetInfoReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, "", "", err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, "", "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetInfoReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Gpu, r.ModelName, r.ModelVersion, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, "", "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, "", "", ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, "", "", cdp.ErrUnknownResult
|
return res.Gpu, res.ModelName, res.ModelVersion, nil
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetDiscoverTargetsParams controls whether to discover available targets
|
// SetDiscoverTargetsParams controls whether to discover available targets
|
||||||
|
@ -35,39 +34,7 @@ func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams {
|
||||||
// Do executes Target.setDiscoverTargets against the provided context and
|
// Do executes Target.setDiscoverTargets against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAutoAttachParams controls whether to automatically attach to new
|
// SetAutoAttachParams controls whether to automatically attach to new
|
||||||
|
@ -97,39 +64,7 @@ func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachP
|
||||||
// Do executes Target.setAutoAttach against the provided context and
|
// Do executes Target.setAutoAttach against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAttachToFramesParams [no description].
|
// SetAttachToFramesParams [no description].
|
||||||
|
@ -150,39 +85,7 @@ func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
||||||
// Do executes Target.setAttachToFrames against the provided context and
|
// Do executes Target.setAttachToFrames against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRemoteLocationsParams enables target discovery for the specified
|
// SetRemoteLocationsParams enables target discovery for the specified
|
||||||
|
@ -205,39 +108,7 @@ func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams {
|
||||||
// Do executes Target.setRemoteLocations against the provided context and
|
// Do executes Target.setRemoteLocations against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessageToTargetParams sends protocol message to the target with given
|
// SendMessageToTargetParams sends protocol message to the target with given
|
||||||
|
@ -262,39 +133,7 @@ func SendMessageToTarget(targetID string, message string) *SendMessageToTargetPa
|
||||||
// Do executes Target.sendMessageToTarget against the provided context and
|
// Do executes Target.sendMessageToTarget against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTargetInfoParams returns information about a target.
|
// GetTargetInfoParams returns information about a target.
|
||||||
|
@ -323,46 +162,14 @@ type GetTargetInfoReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// targetInfo
|
// targetInfo
|
||||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
|
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res GetTargetInfoReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.TargetInfo, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetTargetInfoReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.TargetInfo, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActivateTargetParams activates (focuses) the target.
|
// ActivateTargetParams activates (focuses) the target.
|
||||||
|
@ -383,39 +190,7 @@ func ActivateTarget(targetID ID) *ActivateTargetParams {
|
||||||
// Do executes Target.activateTarget against the provided context and
|
// Do executes Target.activateTarget against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetActivateTarget, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetActivateTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloseTargetParams closes the target. If the target is a page that gets
|
// CloseTargetParams closes the target. If the target is a page that gets
|
||||||
|
@ -446,46 +221,14 @@ type CloseTargetReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// success
|
// success
|
||||||
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res CloseTargetReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandTargetCloseTarget, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Success, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetCloseTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CloseTargetReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Success, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AttachToTargetParams attaches to the target with given id.
|
// AttachToTargetParams attaches to the target with given id.
|
||||||
|
@ -514,46 +257,14 @@ type AttachToTargetReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// success - Whether attach succeeded.
|
// success - Whether attach succeeded.
|
||||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res AttachToTargetReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Success, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetAttachToTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r AttachToTargetReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Success, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetachFromTargetParams detaches from the target with given id.
|
// DetachFromTargetParams detaches from the target with given id.
|
||||||
|
@ -574,39 +285,7 @@ func DetachFromTarget(targetID ID) *DetachFromTargetParams {
|
||||||
// Do executes Target.detachFromTarget against the provided context and
|
// Do executes Target.detachFromTarget against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateBrowserContextParams creates a new empty BrowserContext. Similar to
|
// CreateBrowserContextParams creates a new empty BrowserContext. Similar to
|
||||||
|
@ -630,40 +309,14 @@ type CreateBrowserContextReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// browserContextID - The id of the context created.
|
// browserContextID - The id of the context created.
|
||||||
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (browserContextID BrowserContextID, err error) {
|
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (browserContextID BrowserContextID, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetCreateBrowserContext, cdp.Empty)
|
var res CreateBrowserContextReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandTargetCreateBrowserContext, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return "", err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CreateBrowserContextReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.BrowserContextID, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
return res.BrowserContextID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
||||||
|
@ -694,46 +347,14 @@ type DisposeBrowserContextReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// success
|
// success
|
||||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res DisposeBrowserContextReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.Success, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r DisposeBrowserContextReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Success, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return false, ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return false, cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTargetParams creates a new page.
|
// CreateTargetParams creates a new page.
|
||||||
|
@ -784,46 +405,14 @@ type CreateTargetReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// targetID - The id of the page opened.
|
// targetID - The id of the page opened.
|
||||||
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.Handler) (targetID ID, err error) {
|
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.Handler) (targetID ID, err error) {
|
||||||
if ctxt == nil {
|
// execute
|
||||||
ctxt = context.Background()
|
var res CreateTargetReturns
|
||||||
}
|
err = h.Execute(ctxt, cdp.CommandTargetCreateTarget, p, &res)
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
return res.TargetID, nil
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetCreateTarget, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r CreateTargetReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.TargetID, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTargetsParams retrieves a list of available targets.
|
// GetTargetsParams retrieves a list of available targets.
|
||||||
|
@ -845,38 +434,12 @@ type GetTargetsReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// targetInfos - The list of targets.
|
// targetInfos - The list of targets.
|
||||||
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.Handler) (targetInfos []*Info, err error) {
|
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.Handler) (targetInfos []*Info, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandTargetGetTargets, cdp.Empty)
|
var res GetTargetsReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandTargetGetTargets, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetTargetsReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.TargetInfos, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.TargetInfos, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,74 +17,7 @@ var (
|
||||||
_ easyjson.Marshaler
|
_ easyjson.Marshaler
|
||||||
)
|
)
|
||||||
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(in *jlexer.Lexer, out *UnbindParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(in *jlexer.Lexer, out *EventAccepted) {
|
||||||
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 "port":
|
|
||||||
out.Port = int64(in.Int64())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(out *jwriter.Writer, in UnbindParams) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
if !first {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
first = false
|
|
||||||
out.RawString("\"port\":")
|
|
||||||
out.Int64(int64(in.Port))
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v UnbindParams) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v UnbindParams) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *UnbindParams) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *UnbindParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(in *jlexer.Lexer, out *EventAccepted) {
|
|
||||||
isTopLevel := in.IsStart()
|
isTopLevel := in.IsStart()
|
||||||
if in.IsNull() {
|
if in.IsNull() {
|
||||||
if isTopLevel {
|
if isTopLevel {
|
||||||
|
@ -117,7 +50,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(in *jlexer.Lexer, o
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer, in EventAccepted) {
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(out *jwriter.Writer, in EventAccepted) {
|
||||||
out.RawByte('{')
|
out.RawByte('{')
|
||||||
first := true
|
first := true
|
||||||
_ = first
|
_ = first
|
||||||
|
@ -143,24 +76,91 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer
|
||||||
// MarshalJSON supports json.Marshaler interface
|
// MarshalJSON supports json.Marshaler interface
|
||||||
func (v EventAccepted) MarshalJSON() ([]byte, error) {
|
func (v EventAccepted) MarshalJSON() ([]byte, error) {
|
||||||
w := jwriter.Writer{}
|
w := jwriter.Writer{}
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(&w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(&w, v)
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
func (v EventAccepted) MarshalEasyJSON(w *jwriter.Writer) {
|
func (v EventAccepted) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(w, v)
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(w, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
func (v *EventAccepted) UnmarshalJSON(data []byte) error {
|
func (v *EventAccepted) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(&r, v)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
|
func (v *EventAccepted) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(l, v)
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(in *jlexer.Lexer, out *UnbindParams) {
|
||||||
|
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 "port":
|
||||||
|
out.Port = int64(in.Int64())
|
||||||
|
default:
|
||||||
|
in.SkipRecursive()
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer, in UnbindParams) {
|
||||||
|
out.RawByte('{')
|
||||||
|
first := true
|
||||||
|
_ = first
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"port\":")
|
||||||
|
out.Int64(int64(in.Port))
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON supports json.Marshaler interface
|
||||||
|
func (v UnbindParams) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(&w, v)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||||
|
func (v UnbindParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||||
|
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(w, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON supports json.Unmarshaler interface
|
||||||
|
func (v *UnbindParams) UnmarshalJSON(data []byte) error {
|
||||||
r := jlexer.Lexer{Data: data}
|
r := jlexer.Lexer{Data: data}
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(&r, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(&r, v)
|
||||||
return r.Error()
|
return r.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||||
func (v *EventAccepted) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
func (v *UnbindParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(l, v)
|
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(l, v)
|
||||||
}
|
}
|
||||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering2(in *jlexer.Lexer, out *BindParams) {
|
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering2(in *jlexer.Lexer, out *BindParams) {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BindParams request browser port binding.
|
// BindParams request browser port binding.
|
||||||
|
@ -33,39 +32,7 @@ func Bind(port int64) *BindParams {
|
||||||
// Do executes Tethering.bind against the provided context and
|
// Do executes Tethering.bind against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *BindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *BindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTetheringBind, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTetheringBind, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnbindParams request browser port unbinding.
|
// UnbindParams request browser port unbinding.
|
||||||
|
@ -86,37 +53,5 @@ func Unbind(port int64) *UnbindParams {
|
||||||
// Do executes Tethering.unbind against the provided context and
|
// Do executes Tethering.unbind against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *UnbindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *UnbindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTetheringUnbind, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTetheringUnbind, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp/cdp"
|
cdp "github.com/knq/chromedp/cdp"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// StartParams start trace events collection.
|
// StartParams start trace events collection.
|
||||||
|
@ -50,39 +49,7 @@ func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams {
|
||||||
// Do executes Tracing.start against the provided context and
|
// Do executes Tracing.start against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTracingStart, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTracingStart, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndParams stop trace events collection.
|
// EndParams stop trace events collection.
|
||||||
|
@ -96,33 +63,7 @@ func End() *EndParams {
|
||||||
// Do executes Tracing.end against the provided context and
|
// Do executes Tracing.end against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *EndParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *EndParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTracingEnd, nil, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTracingEnd, cdp.Empty)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCategoriesParams gets supported tracing categories.
|
// GetCategoriesParams gets supported tracing categories.
|
||||||
|
@ -144,40 +85,14 @@ type GetCategoriesReturns struct {
|
||||||
// returns:
|
// returns:
|
||||||
// categories - A list of supported tracing categories.
|
// categories - A list of supported tracing categories.
|
||||||
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.Handler) (categories []string, err error) {
|
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.Handler) (categories []string, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandTracingGetCategories, cdp.Empty)
|
var res GetCategoriesReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandTracingGetCategories, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return nil, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return nil, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r GetCategoriesReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.Categories, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return nil, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return nil, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, cdp.ErrUnknownResult
|
return res.Categories, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestMemoryDumpParams request a global memory dump.
|
// RequestMemoryDumpParams request a global memory dump.
|
||||||
|
@ -201,40 +116,14 @@ type RequestMemoryDumpReturns struct {
|
||||||
// dumpGUID - GUID of the resulting global memory dump.
|
// dumpGUID - GUID of the resulting global memory dump.
|
||||||
// success - True iff the global memory dump succeeded.
|
// success - True iff the global memory dump succeeded.
|
||||||
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.Handler) (dumpGUID string, success bool, err error) {
|
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.Handler) (dumpGUID string, success bool, err error) {
|
||||||
if ctxt == nil {
|
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
ch := h.Execute(ctxt, cdp.CommandTracingRequestMemoryDump, cdp.Empty)
|
var res RequestMemoryDumpReturns
|
||||||
|
err = h.Execute(ctxt, cdp.CommandTracingRequestMemoryDump, nil, &res)
|
||||||
// read response
|
if err != nil {
|
||||||
select {
|
return "", false, err
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return "", false, cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
// unmarshal
|
|
||||||
var r RequestMemoryDumpReturns
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return "", false, cdp.ErrInvalidResult
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.DumpGUID, r.Success, nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return "", false, v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return "", false, ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", false, cdp.ErrUnknownResult
|
return res.DumpGUID, res.Success, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
|
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
|
||||||
|
@ -255,37 +144,5 @@ func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams {
|
||||||
// Do executes Tracing.recordClockSyncMarker against the provided context and
|
// Do executes Tracing.recordClockSyncMarker against the provided context and
|
||||||
// target handler.
|
// target handler.
|
||||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, p, nil)
|
||||||
ctxt = context.Background()
|
|
||||||
}
|
|
||||||
|
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, easyjson.RawMessage(buf))
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:
|
|
||||||
return nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return cdp.ErrUnknownResult
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ var defaultContext = context.Background()
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
pool, err = NewPool()
|
pool, err = NewPool(PoolLog(log.Printf, log.Printf, log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,8 +360,8 @@ func (t *Type) EmptyRetList(d *Domain, domains []*Domain) string {
|
||||||
return strings.TrimSuffix(s, ", ")
|
return strings.TrimSuffix(s, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetValueList returns the return value list for a command.
|
// RetNameList returns a <valname>.<name> list for a command's return list.
|
||||||
func (t *Type) RetValueList(d *Domain, domains []*Domain) string {
|
func (t *Type) RetNameList(valname string, d *Domain, domains []*Domain) string {
|
||||||
var s string
|
var s string
|
||||||
b64ret := t.Base64EncodedRetParam()
|
b64ret := t.Base64EncodedRetParam()
|
||||||
for _, p := range t.Returns {
|
for _, p := range t.Returns {
|
||||||
|
@ -369,7 +369,7 @@ func (t *Type) RetValueList(d *Domain, domains []*Domain) string {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
n := "r." + p.GoName(false)
|
n := valname + "." + p.GoName(false)
|
||||||
if b64ret != nil && b64ret.Name == p.Name {
|
if b64ret != nil && b64ret.Name == p.Name {
|
||||||
n = "dec"
|
n = "dec"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7174,12 +7174,6 @@
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"description": "Event original handler function value."
|
"description": "Event original handler function value."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "removeFunction",
|
|
||||||
"$ref": "Runtime.RemoteObject",
|
|
||||||
"optional": true,
|
|
||||||
"description": "Event listener remove function."
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "backendNodeId",
|
"name": "backendNodeId",
|
||||||
"$ref": "DOM.BackendNodeId",
|
"$ref": "DOM.BackendNodeId",
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
|
||||||
retTypeList += ", "
|
retTypeList += ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
retValueList := c.RetValueList(d, domains)
|
retValueList := c.RetNameList("res", d, domains)
|
||||||
if retValueList != "" {
|
if retValueList != "" {
|
||||||
retValueList += ", "
|
retValueList += ", "
|
||||||
}
|
}
|
||||||
|
@ -102,63 +102,36 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pval := "p"
|
||||||
|
if hasEmptyParams {
|
||||||
|
pval = "nil"
|
||||||
|
}
|
||||||
%}
|
%}
|
||||||
// Do executes {%s= c.ProtoName(d) %} against the provided context and
|
// Do executes {%s= c.ProtoName(d) %} against the provided context and
|
||||||
// target handler.{% if len(c.Returns) > 0 %}
|
// target handler.{% if !hasEmptyRet %}
|
||||||
//
|
//
|
||||||
// returns:{% for _, p := range c.Returns %}{% if p.Name == internal.Base64EncodedParamName %}{% continue %}{% end %}
|
// returns:{% for _, p := range c.Returns %}{% if p.Name == internal.Base64EncodedParamName %}{% continue %}{% end %}
|
||||||
// {%s= p.String() %}{% endfor %}{% endif %}
|
// {%s= p.String() %}{% endfor %}{% endif %}
|
||||||
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.Handler) ({%s= retTypeList %}err error) {
|
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.Handler) ({%s= retTypeList %}err error) {{% if hasEmptyRet %}
|
||||||
if ctxt == nil {
|
return h.Execute(ctxt, cdp.{%s= c.CommandMethodType(d) %}, {%s= pval %}, nil){% else %}
|
||||||
ctxt = context.Background()
|
// execute
|
||||||
}{% if !hasEmptyParams %}
|
var res {%s= c.CommandReturnsType() %}
|
||||||
|
err = h.Execute(ctxt, cdp.{%s= c.CommandMethodType(d) %}, {%s= pval %}, &res)
|
||||||
// marshal
|
|
||||||
buf, err := easyjson.Marshal(p)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return {%s= emptyRet %}err
|
return {%s= emptyRet %}err
|
||||||
}{% endif %}
|
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.{%s= c.CommandMethodType(d) %}, {% if hasEmptyParams %}cdp.Empty{% else %}easyjson.RawMessage(buf){% end %})
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return {%s= emptyRet %}cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:{% if !hasEmptyRet %}
|
|
||||||
// unmarshal
|
|
||||||
var r {%s= c.CommandReturnsType() %}
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return {%s= emptyRet %}cdp.ErrInvalidResult
|
|
||||||
}{% if b64ret != nil %}
|
|
||||||
|
|
||||||
// decode
|
|
||||||
var dec []byte{% if b64cond %}
|
|
||||||
if r.Base64encoded {{% endif %}
|
|
||||||
dec, err = base64.StdEncoding.DecodeString(r.{%s= b64ret.GoName(false) %})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}{% if b64cond %}
|
|
||||||
} else {
|
|
||||||
dec = []byte(r.{%s= b64ret.GoName(false) %})
|
|
||||||
}{% endif %}{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
return {%s= retValueList %}nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return {%s= emptyRet %}v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return {%s= emptyRet %}ctxt.Err()
|
|
||||||
}
|
}
|
||||||
|
{% if b64ret != nil %}
|
||||||
return {%s= emptyRet %}cdp.ErrUnknownResult
|
// decode
|
||||||
|
var dec []byte{% if b64cond %}
|
||||||
|
if res.Base64encoded {{% endif %}
|
||||||
|
dec, err = base64.StdEncoding.DecodeString(res.{%s= b64ret.GoName(false) %})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}{% if b64cond %}
|
||||||
|
} else {
|
||||||
|
dec = []byte(res.{%s= b64ret.GoName(false) %})
|
||||||
|
}{% endif %}{% endif %}
|
||||||
|
return {%s= retValueList %}nil{% endif %}
|
||||||
}
|
}
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
|
@ -424,7 +424,7 @@ func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d
|
||||||
retTypeList += ", "
|
retTypeList += ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
retValueList := c.RetValueList(d, domains)
|
retValueList := c.RetNameList("res", d, domains)
|
||||||
if retValueList != "" {
|
if retValueList != "" {
|
||||||
retValueList += ", "
|
retValueList += ", "
|
||||||
}
|
}
|
||||||
|
@ -441,220 +441,169 @@ func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/domain.qtpl:105
|
pval := "p"
|
||||||
|
if hasEmptyParams {
|
||||||
|
pval = "nil"
|
||||||
|
}
|
||||||
|
|
||||||
|
//line templates/domain.qtpl:110
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
// Do executes `)
|
// Do executes `)
|
||||||
//line templates/domain.qtpl:106
|
//line templates/domain.qtpl:111
|
||||||
qw422016.N().S(c.ProtoName(d))
|
qw422016.N().S(c.ProtoName(d))
|
||||||
//line templates/domain.qtpl:106
|
//line templates/domain.qtpl:111
|
||||||
qw422016.N().S(` against the provided context and
|
qw422016.N().S(` against the provided context and
|
||||||
// target handler.`)
|
// target handler.`)
|
||||||
//line templates/domain.qtpl:107
|
//line templates/domain.qtpl:112
|
||||||
if len(c.Returns) > 0 {
|
if !hasEmptyRet {
|
||||||
//line templates/domain.qtpl:107
|
//line templates/domain.qtpl:112
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
//
|
//
|
||||||
// returns:`)
|
// returns:`)
|
||||||
//line templates/domain.qtpl:109
|
//line templates/domain.qtpl:114
|
||||||
for _, p := range c.Returns {
|
for _, p := range c.Returns {
|
||||||
//line templates/domain.qtpl:109
|
//line templates/domain.qtpl:114
|
||||||
if p.Name == internal.Base64EncodedParamName {
|
if p.Name == internal.Base64EncodedParamName {
|
||||||
//line templates/domain.qtpl:109
|
//line templates/domain.qtpl:114
|
||||||
continue
|
continue
|
||||||
//line templates/domain.qtpl:109
|
//line templates/domain.qtpl:114
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:109
|
//line templates/domain.qtpl:114
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
// `)
|
// `)
|
||||||
//line templates/domain.qtpl:110
|
//line templates/domain.qtpl:115
|
||||||
qw422016.N().S(p.String())
|
qw422016.N().S(p.String())
|
||||||
//line templates/domain.qtpl:110
|
//line templates/domain.qtpl:115
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:110
|
//line templates/domain.qtpl:115
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:110
|
//line templates/domain.qtpl:115
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
func (p *`)
|
func (p *`)
|
||||||
//line templates/domain.qtpl:111
|
//line templates/domain.qtpl:116
|
||||||
qw422016.N().S(typ)
|
qw422016.N().S(typ)
|
||||||
//line templates/domain.qtpl:111
|
//line templates/domain.qtpl:116
|
||||||
qw422016.N().S(`) Do(ctxt context.Context, h cdp.Handler) (`)
|
qw422016.N().S(`) Do(ctxt context.Context, h cdp.Handler) (`)
|
||||||
//line templates/domain.qtpl:111
|
//line templates/domain.qtpl:116
|
||||||
qw422016.N().S(retTypeList)
|
qw422016.N().S(retTypeList)
|
||||||
//line templates/domain.qtpl:111
|
//line templates/domain.qtpl:116
|
||||||
qw422016.N().S(`err error) {
|
qw422016.N().S(`err error) {`)
|
||||||
if ctxt == nil {
|
//line templates/domain.qtpl:116
|
||||||
ctxt = context.Background()
|
if hasEmptyRet {
|
||||||
}`)
|
//line templates/domain.qtpl:116
|
||||||
//line templates/domain.qtpl:114
|
|
||||||
if !hasEmptyParams {
|
|
||||||
//line templates/domain.qtpl:114
|
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
return h.Execute(ctxt, cdp.`)
|
||||||
// marshal
|
//line templates/domain.qtpl:117
|
||||||
buf, err := easyjson.Marshal(p)
|
qw422016.N().S(c.CommandMethodType(d))
|
||||||
|
//line templates/domain.qtpl:117
|
||||||
|
qw422016.N().S(`, `)
|
||||||
|
//line templates/domain.qtpl:117
|
||||||
|
qw422016.N().S(pval)
|
||||||
|
//line templates/domain.qtpl:117
|
||||||
|
qw422016.N().S(`, nil)`)
|
||||||
|
//line templates/domain.qtpl:117
|
||||||
|
} else {
|
||||||
|
//line templates/domain.qtpl:117
|
||||||
|
qw422016.N().S(`
|
||||||
|
// execute
|
||||||
|
var res `)
|
||||||
|
//line templates/domain.qtpl:119
|
||||||
|
qw422016.N().S(c.CommandReturnsType())
|
||||||
|
//line templates/domain.qtpl:119
|
||||||
|
qw422016.N().S(`
|
||||||
|
err = h.Execute(ctxt, cdp.`)
|
||||||
|
//line templates/domain.qtpl:120
|
||||||
|
qw422016.N().S(c.CommandMethodType(d))
|
||||||
|
//line templates/domain.qtpl:120
|
||||||
|
qw422016.N().S(`, `)
|
||||||
|
//line templates/domain.qtpl:120
|
||||||
|
qw422016.N().S(pval)
|
||||||
|
//line templates/domain.qtpl:120
|
||||||
|
qw422016.N().S(`, &res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return `)
|
return `)
|
||||||
//line templates/domain.qtpl:119
|
//line templates/domain.qtpl:122
|
||||||
qw422016.N().S(emptyRet)
|
qw422016.N().S(emptyRet)
|
||||||
//line templates/domain.qtpl:119
|
//line templates/domain.qtpl:122
|
||||||
qw422016.N().S(`err
|
qw422016.N().S(`err
|
||||||
}`)
|
|
||||||
//line templates/domain.qtpl:120
|
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:120
|
`)
|
||||||
qw422016.N().S(`
|
//line templates/domain.qtpl:124
|
||||||
|
|
||||||
// execute
|
|
||||||
ch := h.Execute(ctxt, cdp.`)
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
qw422016.N().S(c.CommandMethodType(d))
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
qw422016.N().S(`, `)
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
if hasEmptyParams {
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
qw422016.N().S(`cdp.Empty`)
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
} else {
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
qw422016.N().S(`easyjson.RawMessage(buf)`)
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
}
|
|
||||||
//line templates/domain.qtpl:123
|
|
||||||
qw422016.N().S(`)
|
|
||||||
|
|
||||||
// read response
|
|
||||||
select {
|
|
||||||
case res := <-ch:
|
|
||||||
if res == nil {
|
|
||||||
return `)
|
|
||||||
//line templates/domain.qtpl:129
|
|
||||||
qw422016.N().S(emptyRet)
|
|
||||||
//line templates/domain.qtpl:129
|
|
||||||
qw422016.N().S(`cdp.ErrChannelClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := res.(type) {
|
|
||||||
case easyjson.RawMessage:`)
|
|
||||||
//line templates/domain.qtpl:133
|
|
||||||
if !hasEmptyRet {
|
|
||||||
//line templates/domain.qtpl:133
|
|
||||||
qw422016.N().S(`
|
|
||||||
// unmarshal
|
|
||||||
var r `)
|
|
||||||
//line templates/domain.qtpl:135
|
|
||||||
qw422016.N().S(c.CommandReturnsType())
|
|
||||||
//line templates/domain.qtpl:135
|
|
||||||
qw422016.N().S(`
|
|
||||||
err = easyjson.Unmarshal(v, &r)
|
|
||||||
if err != nil {
|
|
||||||
return `)
|
|
||||||
//line templates/domain.qtpl:138
|
|
||||||
qw422016.N().S(emptyRet)
|
|
||||||
//line templates/domain.qtpl:138
|
|
||||||
qw422016.N().S(`cdp.ErrInvalidResult
|
|
||||||
}`)
|
|
||||||
//line templates/domain.qtpl:139
|
|
||||||
if b64ret != nil {
|
if b64ret != nil {
|
||||||
//line templates/domain.qtpl:139
|
//line templates/domain.qtpl:124
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
// decode
|
||||||
// decode
|
var dec []byte`)
|
||||||
var dec []byte`)
|
//line templates/domain.qtpl:126
|
||||||
//line templates/domain.qtpl:142
|
|
||||||
if b64cond {
|
if b64cond {
|
||||||
//line templates/domain.qtpl:142
|
//line templates/domain.qtpl:126
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
if r.Base64encoded {`)
|
if res.Base64encoded {`)
|
||||||
//line templates/domain.qtpl:143
|
//line templates/domain.qtpl:127
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:143
|
//line templates/domain.qtpl:127
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
dec, err = base64.StdEncoding.DecodeString(r.`)
|
dec, err = base64.StdEncoding.DecodeString(res.`)
|
||||||
//line templates/domain.qtpl:144
|
//line templates/domain.qtpl:128
|
||||||
qw422016.N().S(b64ret.GoName(false))
|
qw422016.N().S(b64ret.GoName(false))
|
||||||
//line templates/domain.qtpl:144
|
//line templates/domain.qtpl:128
|
||||||
qw422016.N().S(`)
|
qw422016.N().S(`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}`)
|
}`)
|
||||||
//line templates/domain.qtpl:147
|
//line templates/domain.qtpl:131
|
||||||
if b64cond {
|
if b64cond {
|
||||||
//line templates/domain.qtpl:147
|
//line templates/domain.qtpl:131
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
} else {
|
} else {
|
||||||
dec = []byte(r.`)
|
dec = []byte(res.`)
|
||||||
//line templates/domain.qtpl:149
|
//line templates/domain.qtpl:133
|
||||||
qw422016.N().S(b64ret.GoName(false))
|
qw422016.N().S(b64ret.GoName(false))
|
||||||
//line templates/domain.qtpl:149
|
//line templates/domain.qtpl:133
|
||||||
qw422016.N().S(`)
|
qw422016.N().S(`)
|
||||||
}`)
|
}`)
|
||||||
//line templates/domain.qtpl:150
|
//line templates/domain.qtpl:134
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:150
|
//line templates/domain.qtpl:134
|
||||||
}
|
}
|
||||||
//line templates/domain.qtpl:150
|
//line templates/domain.qtpl:134
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
|
||||||
//line templates/domain.qtpl:151
|
|
||||||
}
|
|
||||||
//line templates/domain.qtpl:151
|
|
||||||
qw422016.N().S(`
|
|
||||||
return `)
|
|
||||||
//line templates/domain.qtpl:152
|
|
||||||
qw422016.N().S(retValueList)
|
|
||||||
//line templates/domain.qtpl:152
|
|
||||||
qw422016.N().S(`nil
|
|
||||||
|
|
||||||
case error:
|
|
||||||
return `)
|
|
||||||
//line templates/domain.qtpl:155
|
|
||||||
qw422016.N().S(emptyRet)
|
|
||||||
//line templates/domain.qtpl:155
|
|
||||||
qw422016.N().S(`v
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctxt.Done():
|
|
||||||
return `)
|
|
||||||
//line templates/domain.qtpl:159
|
|
||||||
qw422016.N().S(emptyRet)
|
|
||||||
//line templates/domain.qtpl:159
|
|
||||||
qw422016.N().S(`ctxt.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
return `)
|
return `)
|
||||||
//line templates/domain.qtpl:162
|
//line templates/domain.qtpl:135
|
||||||
qw422016.N().S(emptyRet)
|
qw422016.N().S(retValueList)
|
||||||
//line templates/domain.qtpl:162
|
//line templates/domain.qtpl:135
|
||||||
qw422016.N().S(`cdp.ErrUnknownResult
|
qw422016.N().S(`nil`)
|
||||||
|
//line templates/domain.qtpl:135
|
||||||
|
}
|
||||||
|
//line templates/domain.qtpl:135
|
||||||
|
qw422016.N().S(`
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
func WriteCommandDoFuncTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
|
func WriteCommandDoFuncTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
StreamCommandDoFuncTemplate(qw422016, c, d, domains)
|
StreamCommandDoFuncTemplate(qw422016, c, d, domains)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
func CommandDoFuncTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
|
func CommandDoFuncTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
WriteCommandDoFuncTemplate(qb422016, c, d, domains)
|
WriteCommandDoFuncTemplate(qb422016, c, d, domains)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/domain.qtpl:164
|
//line templates/domain.qtpl:137
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ type Handler interface {
|
||||||
|
|
||||||
// Execute executes the specified command using the supplied context and
|
// Execute executes the specified command using the supplied context and
|
||||||
// parameters.
|
// parameters.
|
||||||
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
|
Execute(context.Context, MethodType, easyjson.Marshaler, easyjson.Unmarshaler) error
|
||||||
|
|
||||||
// Listen creates a channel that will receive an event for the types
|
// Listen creates a channel that will receive an event for the types
|
||||||
// specified.
|
// specified.
|
||||||
|
@ -240,9 +240,6 @@ type Handler interface {
|
||||||
// Release releases a channel returned from Listen.
|
// Release releases a channel returned from Listen.
|
||||||
Release(<-chan interface{})
|
Release(<-chan interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty is an empty JSON object message.
|
|
||||||
var Empty = easyjson.RawMessage(`{}`)
|
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
// ExtraUtilTemplate generates the decode func for the Message type.
|
// ExtraUtilTemplate generates the decode func for the Message type.
|
||||||
|
|
|
@ -492,7 +492,7 @@ type Handler interface {
|
||||||
|
|
||||||
// Execute executes the specified command using the supplied context and
|
// Execute executes the specified command using the supplied context and
|
||||||
// parameters.
|
// parameters.
|
||||||
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
|
Execute(context.Context, MethodType, easyjson.Marshaler, easyjson.Unmarshaler) error
|
||||||
|
|
||||||
// Listen creates a channel that will receive an event for the types
|
// Listen creates a channel that will receive an event for the types
|
||||||
// specified.
|
// specified.
|
||||||
|
@ -501,52 +501,41 @@ type Handler interface {
|
||||||
// Release releases a channel returned from Listen.
|
// Release releases a channel returned from Listen.
|
||||||
Release(<-chan interface{})
|
Release(<-chan interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty is an empty JSON object message.
|
|
||||||
var Empty = easyjson.RawMessage(`)
|
|
||||||
//line templates/extra.qtpl:211
|
|
||||||
qw422016.N().S("`")
|
|
||||||
//line templates/extra.qtpl:211
|
|
||||||
qw422016.N().S(`{}`)
|
|
||||||
//line templates/extra.qtpl:211
|
|
||||||
qw422016.N().S("`")
|
|
||||||
//line templates/extra.qtpl:211
|
|
||||||
qw422016.N().S(`)
|
|
||||||
`)
|
`)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
|
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
StreamExtraCDPTypes(qw422016)
|
StreamExtraCDPTypes(qw422016)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
func ExtraCDPTypes() string {
|
func ExtraCDPTypes() string {
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
WriteExtraCDPTypes(qb422016)
|
WriteExtraCDPTypes(qb422016)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/extra.qtpl:246
|
//line templates/extra.qtpl:243
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtraUtilTemplate generates the decode func for the Message type.
|
// ExtraUtilTemplate generates the decode func for the Message type.
|
||||||
|
|
||||||
//line templates/extra.qtpl:249
|
//line templates/extra.qtpl:246
|
||||||
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
|
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
|
||||||
//line templates/extra.qtpl:249
|
//line templates/extra.qtpl:246
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
type empty struct{}
|
type empty struct{}
|
||||||
var emptyVal = &empty{}
|
var emptyVal = &empty{}
|
||||||
|
@ -555,66 +544,66 @@ var emptyVal = &empty{}
|
||||||
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
||||||
var v easyjson.Unmarshaler
|
var v easyjson.Unmarshaler
|
||||||
switch msg.Method {`)
|
switch msg.Method {`)
|
||||||
//line templates/extra.qtpl:256
|
//line templates/extra.qtpl:253
|
||||||
for _, d := range domains {
|
for _, d := range domains {
|
||||||
//line templates/extra.qtpl:256
|
//line templates/extra.qtpl:253
|
||||||
for _, c := range d.Commands {
|
for _, c := range d.Commands {
|
||||||
//line templates/extra.qtpl:256
|
//line templates/extra.qtpl:253
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
case cdp.`)
|
case cdp.`)
|
||||||
//line templates/extra.qtpl:257
|
//line templates/extra.qtpl:254
|
||||||
qw422016.N().S(c.CommandMethodType(d))
|
qw422016.N().S(c.CommandMethodType(d))
|
||||||
//line templates/extra.qtpl:257
|
//line templates/extra.qtpl:254
|
||||||
qw422016.N().S(`:`)
|
qw422016.N().S(`:`)
|
||||||
//line templates/extra.qtpl:257
|
//line templates/extra.qtpl:254
|
||||||
if len(c.Returns) == 0 {
|
if len(c.Returns) == 0 {
|
||||||
//line templates/extra.qtpl:257
|
//line templates/extra.qtpl:254
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
return emptyVal, nil`)
|
return emptyVal, nil`)
|
||||||
//line templates/extra.qtpl:258
|
//line templates/extra.qtpl:255
|
||||||
} else {
|
} else {
|
||||||
//line templates/extra.qtpl:258
|
//line templates/extra.qtpl:255
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
v = new(`)
|
v = new(`)
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
qw422016.N().S(d.PackageRefName())
|
qw422016.N().S(d.PackageRefName())
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
qw422016.N().S(`.`)
|
qw422016.N().S(`.`)
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
qw422016.N().S(c.CommandReturnsType())
|
qw422016.N().S(c.CommandReturnsType())
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
qw422016.N().S(`)`)
|
qw422016.N().S(`)`)
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
}
|
}
|
||||||
//line templates/extra.qtpl:259
|
//line templates/extra.qtpl:256
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line templates/extra.qtpl:257
|
||||||
|
}
|
||||||
|
//line templates/extra.qtpl:257
|
||||||
|
for _, e := range d.Events {
|
||||||
|
//line templates/extra.qtpl:257
|
||||||
|
qw422016.N().S(`
|
||||||
|
case cdp.`)
|
||||||
|
//line templates/extra.qtpl:258
|
||||||
|
qw422016.N().S(e.EventMethodType(d))
|
||||||
|
//line templates/extra.qtpl:258
|
||||||
|
qw422016.N().S(`:
|
||||||
|
v = new(`)
|
||||||
|
//line templates/extra.qtpl:259
|
||||||
|
qw422016.N().S(d.PackageRefName())
|
||||||
|
//line templates/extra.qtpl:259
|
||||||
|
qw422016.N().S(`.`)
|
||||||
|
//line templates/extra.qtpl:259
|
||||||
|
qw422016.N().S(e.EventType())
|
||||||
|
//line templates/extra.qtpl:259
|
||||||
|
qw422016.N().S(`)
|
||||||
`)
|
`)
|
||||||
//line templates/extra.qtpl:260
|
//line templates/extra.qtpl:260
|
||||||
}
|
}
|
||||||
//line templates/extra.qtpl:260
|
//line templates/extra.qtpl:260
|
||||||
for _, e := range d.Events {
|
|
||||||
//line templates/extra.qtpl:260
|
|
||||||
qw422016.N().S(`
|
|
||||||
case cdp.`)
|
|
||||||
//line templates/extra.qtpl:261
|
|
||||||
qw422016.N().S(e.EventMethodType(d))
|
|
||||||
//line templates/extra.qtpl:261
|
|
||||||
qw422016.N().S(`:
|
|
||||||
v = new(`)
|
|
||||||
//line templates/extra.qtpl:262
|
|
||||||
qw422016.N().S(d.PackageRefName())
|
|
||||||
//line templates/extra.qtpl:262
|
|
||||||
qw422016.N().S(`.`)
|
|
||||||
//line templates/extra.qtpl:262
|
|
||||||
qw422016.N().S(e.EventType())
|
|
||||||
//line templates/extra.qtpl:262
|
|
||||||
qw422016.N().S(`)
|
|
||||||
`)
|
|
||||||
//line templates/extra.qtpl:263
|
|
||||||
}
|
|
||||||
//line templates/extra.qtpl:263
|
|
||||||
}
|
}
|
||||||
//line templates/extra.qtpl:263
|
//line templates/extra.qtpl:260
|
||||||
qw422016.N().S(`}
|
qw422016.N().S(`}
|
||||||
|
|
||||||
var buf easyjson.RawMessage
|
var buf easyjson.RawMessage
|
||||||
|
@ -637,69 +626,69 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
|
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
StreamExtraUtilTemplate(qw422016, domains)
|
StreamExtraUtilTemplate(qw422016, domains)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
func ExtraUtilTemplate(domains []*internal.Domain) string {
|
func ExtraUtilTemplate(domains []*internal.Domain) string {
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
WriteExtraUtilTemplate(qb422016, domains)
|
WriteExtraUtilTemplate(qb422016, domains)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/extra.qtpl:284
|
//line templates/extra.qtpl:281
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:286
|
//line templates/extra.qtpl:283
|
||||||
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
|
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
|
||||||
//line templates/extra.qtpl:286
|
//line templates/extra.qtpl:283
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
// Domain returns the Chrome Debugging Protocol domain of the event or command.
|
// Domain returns the Chrome Debugging Protocol domain of the event or command.
|
||||||
func (t MethodType) Domain() string {
|
func (t MethodType) Domain() string {
|
||||||
return string(t[:strings.IndexByte(string(t), '.')])
|
return string(t[:strings.IndexByte(string(t), '.')])
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
|
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
StreamExtraMethodTypeDomainDecoder(qw422016)
|
StreamExtraMethodTypeDomainDecoder(qw422016)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
func ExtraMethodTypeDomainDecoder() string {
|
func ExtraMethodTypeDomainDecoder() string {
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
WriteExtraMethodTypeDomainDecoder(qb422016)
|
WriteExtraMethodTypeDomainDecoder(qb422016)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/extra.qtpl:291
|
//line templates/extra.qtpl:288
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cdp "github.com/knq/chromedp"
|
cdp "github.com/knq/cdp"
|
||||||
cdptypes "github.com/knq/chromedp/cdp"
|
cdptypes "github.com/knq/cdp/cdp"
|
||||||
"github.com/knq/chromedp/client"
|
"github.com/knq/cdp/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -22,13 +22,13 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create edge instance -- FIXME: not able to launch separate process (yet)
|
// create edge instance -- FIXME: not able to launch separate process (yet)
|
||||||
/*cdp, err := chromedp.New(ctxt, chromedp.WithRunnerOptions(
|
/*cdp, err := cdp.New(ctxt, cdp.WithRunnerOptions(
|
||||||
runner.EdgeDiagnosticsAdapter(),
|
runner.EdgeDiagnosticsAdapter(),
|
||||||
))*/
|
))*/
|
||||||
|
|
||||||
// create edge instance
|
// create edge instance
|
||||||
watch := client.New().WatchPageTargets(ctxt)
|
watch := client.New().WatchPageTargets(ctxt)
|
||||||
c, err := chromedp.New(ctxt, chromedp.WithTargets(watch))
|
c, err := cdp.New(ctxt, cdp.WithTargets(watch), cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome
|
// create chrome
|
||||||
c, err := cdp.New(ctxt, cdp.WithTargets(client.New().WatchPageTargets(ctxt)))
|
c, err := cdp.New(ctxt, cdp.WithTargets(client.New().WatchPageTargets(ctxt)), cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ func main() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// create chrome instance
|
// create chrome instance
|
||||||
c, err := cdp.New(ctxt)
|
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
123
handler.go
123
handler.go
|
@ -50,7 +50,7 @@ type TargetHandler struct {
|
||||||
lastm sync.Mutex
|
lastm sync.Mutex
|
||||||
|
|
||||||
// res is the id->result channel map.
|
// res is the id->result channel map.
|
||||||
res map[int64]chan interface{}
|
res map[int64]chan easyjson.RawMessage
|
||||||
resrw sync.RWMutex
|
resrw sync.RWMutex
|
||||||
|
|
||||||
// logging funcs
|
// logging funcs
|
||||||
|
@ -87,7 +87,7 @@ func (h *TargetHandler) Run(ctxt context.Context) error {
|
||||||
h.qcmd = make(chan *cdp.Message)
|
h.qcmd = make(chan *cdp.Message)
|
||||||
h.qres = make(chan *cdp.Message)
|
h.qres = make(chan *cdp.Message)
|
||||||
h.qevents = make(chan *cdp.Message)
|
h.qevents = make(chan *cdp.Message)
|
||||||
h.res = make(map[int64]chan interface{})
|
h.res = make(map[int64]chan easyjson.RawMessage)
|
||||||
h.detached = make(chan *inspector.EventDetached)
|
h.detached = make(chan *inspector.EventDetached)
|
||||||
h.pageWaitGroup = new(sync.WaitGroup)
|
h.pageWaitGroup = new(sync.WaitGroup)
|
||||||
h.domWaitGroup = new(sync.WaitGroup)
|
h.domWaitGroup = new(sync.WaitGroup)
|
||||||
|
@ -182,19 +182,19 @@ func (h *TargetHandler) run(ctxt context.Context) {
|
||||||
case ev := <-h.qevents:
|
case ev := <-h.qevents:
|
||||||
err = h.processEvent(ctxt, ev)
|
err = h.processEvent(ctxt, ev)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.errorf("could not process event, got: %v", err)
|
h.errorf("could not process event %s, got: %v", ev.Method, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
case res := <-h.qres:
|
case res := <-h.qres:
|
||||||
err = h.processResult(res)
|
err = h.processResult(res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.errorf("could not process command result, got: %v", err)
|
h.errorf("could not process result for message %d, got: %v", res.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
case cmd := <-h.qcmd:
|
case cmd := <-h.qcmd:
|
||||||
err = h.processCommand(cmd)
|
err = h.processCommand(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.errorf("could not process command, got: %v", err)
|
h.errorf("could not process command message %d, got: %v", cmd.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-ctxt.Done():
|
case <-ctxt.Done():
|
||||||
|
@ -295,31 +295,27 @@ func (h *TargetHandler) documentUpdated(ctxt context.Context) {
|
||||||
|
|
||||||
// processResult processes an incoming command result.
|
// processResult processes an incoming command result.
|
||||||
func (h *TargetHandler) processResult(msg *cdp.Message) error {
|
func (h *TargetHandler) processResult(msg *cdp.Message) error {
|
||||||
h.resrw.Lock()
|
h.resrw.RLock()
|
||||||
defer h.resrw.Unlock()
|
defer h.resrw.RUnlock()
|
||||||
|
|
||||||
res, ok := h.res[msg.ID]
|
ch, ok := h.res[msg.ID]
|
||||||
if !ok {
|
if !ok {
|
||||||
err := fmt.Errorf("expected result to be present for message id %d", msg.ID)
|
return fmt.Errorf("id %d not present in res map", msg.ID)
|
||||||
h.errorf(err.Error())
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
if msg.Error != nil {
|
if msg.Error != nil {
|
||||||
res <- msg.Error
|
return msg.Error
|
||||||
} else {
|
|
||||||
res <- msg.Result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(h.res, msg.ID)
|
ch <- msg.Result
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// processCommand writes a command to the client connection.
|
// processCommand writes a command to the client connection.
|
||||||
func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
|
func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
|
||||||
// FIXME: there are two possible error conditions here, check and
|
// marshal
|
||||||
// do some kind of logging ...
|
|
||||||
buf, err := easyjson.Marshal(cmd)
|
buf, err := easyjson.Marshal(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -327,61 +323,70 @@ func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
|
||||||
|
|
||||||
h.debugf("<- %s", string(buf))
|
h.debugf("<- %s", string(buf))
|
||||||
|
|
||||||
// write
|
|
||||||
return h.conn.Write(buf)
|
return h.conn.Write(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// emptyObj is an empty JSON object message.
|
||||||
|
var emptyObj = easyjson.RawMessage([]byte(`{}`))
|
||||||
|
|
||||||
// Execute executes commandType against the endpoint passed to Run, using the
|
// Execute executes commandType against the endpoint passed to Run, using the
|
||||||
// provided context and the raw JSON encoded params.
|
// provided context and params, decoding the result of the command to res.
|
||||||
//
|
func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType, params easyjson.Marshaler, res easyjson.Unmarshaler) error {
|
||||||
// Returns a result channel that will receive AT MOST ONE result. A result is
|
var paramsBuf easyjson.RawMessage
|
||||||
// either the command's result value (as a raw JSON encoded value), or any
|
if params == nil {
|
||||||
// error encountered during operation. After the result (or an error) is passed
|
paramsBuf = emptyObj
|
||||||
// to the returned channel, the channel will be closed.
|
} else {
|
||||||
//
|
var err error
|
||||||
// Note: the returned channel will be closed after the result is read. If the
|
paramsBuf, err = easyjson.Marshal(params)
|
||||||
// passed context finishes prior to receiving the command result, then
|
if err != nil {
|
||||||
// ctxt.Err() will be sent to the channel.
|
return err
|
||||||
func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType, params easyjson.RawMessage) <-chan interface{} {
|
|
||||||
ch := make(chan interface{}, 1)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer close(ch)
|
|
||||||
|
|
||||||
res := make(chan interface{}, 1)
|
|
||||||
defer close(res)
|
|
||||||
|
|
||||||
// get next id
|
|
||||||
h.lastm.Lock()
|
|
||||||
h.last++
|
|
||||||
id := h.last
|
|
||||||
h.lastm.Unlock()
|
|
||||||
|
|
||||||
// save channel
|
|
||||||
h.resrw.Lock()
|
|
||||||
h.res[id] = res
|
|
||||||
h.resrw.Unlock()
|
|
||||||
|
|
||||||
h.qcmd <- &cdp.Message{
|
|
||||||
ID: id,
|
|
||||||
Method: commandType,
|
|
||||||
Params: params,
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
id := h.next()
|
||||||
|
|
||||||
|
// save channel
|
||||||
|
ch := make(chan easyjson.RawMessage, 1)
|
||||||
|
h.resrw.Lock()
|
||||||
|
h.res[id] = ch
|
||||||
|
h.resrw.Unlock()
|
||||||
|
|
||||||
|
// queue message
|
||||||
|
h.qcmd <- &cdp.Message{
|
||||||
|
ID: id,
|
||||||
|
Method: commandType,
|
||||||
|
Params: paramsBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
errch := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
defer close(errch)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case v := <-res:
|
case msg := <-ch:
|
||||||
if v != nil {
|
if res != nil {
|
||||||
ch <- v
|
errch <- easyjson.Unmarshal(msg, res)
|
||||||
} else {
|
|
||||||
ch <- cdp.ErrChannelClosed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-ctxt.Done():
|
case <-ctxt.Done():
|
||||||
ch <- ctxt.Err()
|
errch <- ctxt.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h.resrw.Lock()
|
||||||
|
defer h.resrw.Unlock()
|
||||||
|
|
||||||
|
delete(h.res, id)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return ch
|
return <-errch
|
||||||
|
}
|
||||||
|
|
||||||
|
// next returns the next message id.
|
||||||
|
func (h *TargetHandler) next() int64 {
|
||||||
|
h.lastm.Lock()
|
||||||
|
defer h.lastm.Unlock()
|
||||||
|
h.last++
|
||||||
|
return h.last
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoot returns the current top level frame's root document node.
|
// GetRoot returns the current top level frame's root document node.
|
||||||
|
|
4
util.go
4
util.go
|
@ -346,8 +346,8 @@ func removeNode(n []*cdp.Node, id cdp.NodeID) []*cdp.Node {
|
||||||
return append(n[:i], n[i+1:]...)
|
return append(n[:i], n[i+1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCouldNotComputeBoxModelError unwraps the err as a MessagError and
|
// isCouldNotComputeBoxModelError unwraps err as a MessageError and determines
|
||||||
// determines if it is a compute box model error.
|
// if it is a compute box model error.
|
||||||
func isCouldNotComputeBoxModelError(err error) bool {
|
func isCouldNotComputeBoxModelError(err error) bool {
|
||||||
e, ok := err.(*cdp.MessageError)
|
e, ok := err.(*cdp.MessageError)
|
||||||
return ok && e.Code == -32000 && e.Message == "Could not compute box model."
|
return ok && e.Code == -32000 && e.Message == "Could not compute box model."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user