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"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// GetPartialAXTreeParams fetches the accessibility node and partial
|
||||
|
@ -49,44 +48,12 @@ type GetPartialAXTreeReturns struct {
|
|||
// returns:
|
||||
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
|
||||
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.Handler) (nodes []*AXNode, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetPartialAXTreeReturns
|
||||
err = h.Execute(ctxt, cdp.CommandAccessibilityGetPartialAXTree, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Nodes, nil
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams enables animation domain notifications.
|
||||
|
@ -25,33 +24,7 @@ func Enable() *EnableParams {
|
|||
// Do executes Animation.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables animation domain notifications.
|
||||
|
@ -65,33 +38,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Animation.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationDisable, nil, nil)
|
||||
}
|
||||
|
||||
// GetPlaybackRateParams gets the playback rate of the document timeline.
|
||||
|
@ -113,40 +60,14 @@ type GetPlaybackRateReturns struct {
|
|||
// returns:
|
||||
// playbackRate - Playback rate for animations on page.
|
||||
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (playbackRate float64, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetPlaybackRateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, nil, &res)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return 0, cdp.ErrUnknownResult
|
||||
return res.PlaybackRate, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationSetPlaybackRate, p, nil)
|
||||
}
|
||||
|
||||
// GetCurrentTimeParams returns the current time of the an animation.
|
||||
|
@ -228,46 +117,14 @@ type GetCurrentTimeReturns struct {
|
|||
// returns:
|
||||
// currentTime - Current time of the page.
|
||||
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentTime float64, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetCurrentTimeReturns
|
||||
err = h.Execute(ctxt, cdp.CommandAnimationGetCurrentTime, p, &res)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.CurrentTime, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationSetPaused, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationSetTiming, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationSeekAnimations, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandAnimationReleaseAnimations, p, nil)
|
||||
}
|
||||
|
||||
// ResolveAnimationParams gets the remote object of the Animation.
|
||||
|
@ -524,44 +253,12 @@ type ResolveAnimationReturns struct {
|
|||
// returns:
|
||||
// remoteObject - Corresponding remote object.
|
||||
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remoteObject *runtime.RemoteObject, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res ResolveAnimationReturns
|
||||
err = h.Execute(ctxt, cdp.CommandAnimationResolveAnimation, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.RemoteObject, nil
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// GetFramesWithManifestsParams returns array of frame identifiers with
|
||||
|
@ -36,40 +35,14 @@ type GetFramesWithManifestsReturns struct {
|
|||
// returns:
|
||||
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
|
||||
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.Handler) (frameIds []*FrameWithManifest, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetFramesWithManifestsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return res.FrameIds, nil
|
||||
}
|
||||
|
||||
// EnableParams enables application cache domain notifications.
|
||||
|
@ -83,33 +56,7 @@ func Enable() *EnableParams {
|
|||
// Do executes ApplicationCache.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandApplicationCacheEnable, nil, nil)
|
||||
}
|
||||
|
||||
// GetManifestForFrameParams returns manifest URL for document in the given
|
||||
|
@ -139,46 +86,14 @@ type GetManifestForFrameReturns struct {
|
|||
// returns:
|
||||
// manifestURL - Manifest URL for document in the given frame.
|
||||
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.Handler) (manifestURL string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetManifestForFrameReturns
|
||||
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetManifestForFrame, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.ManifestURL, nil
|
||||
}
|
||||
|
||||
// GetApplicationCacheForFrameParams returns relevant application cache data
|
||||
|
@ -209,44 +124,12 @@ type GetApplicationCacheForFrameReturns struct {
|
|||
// returns:
|
||||
// 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) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetApplicationCacheForFrameReturns
|
||||
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetApplicationCacheForFrame, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.ApplicationCache, nil
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// RequestCacheNamesParams requests cache names.
|
||||
|
@ -39,46 +38,14 @@ type RequestCacheNamesReturns struct {
|
|||
// returns:
|
||||
// caches - Caches for the security origin.
|
||||
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RequestCacheNamesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Caches, nil
|
||||
}
|
||||
|
||||
// RequestEntriesParams requests data from cache.
|
||||
|
@ -115,46 +82,14 @@ type RequestEntriesReturns struct {
|
|||
// cacheDataEntries - Array of object store data entries.
|
||||
// hasMore - If true, there are more entries to fetch in the given range.
|
||||
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RequestEntriesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, p, &res)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.CacheDataEntries, res.HasMore, nil
|
||||
}
|
||||
|
||||
// DeleteCacheParams deletes a cache.
|
||||
|
@ -175,39 +110,7 @@ func DeleteCache(cacheID CacheID) *DeleteCacheParams {
|
|||
// Do executes CacheStorage.deleteCache against the provided context and
|
||||
// target handler.
|
||||
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,317 @@ var (
|
|||
_ 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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -75,7 +385,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(out *jwriter.Writer, in RequestEntriesReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in RequestEntriesReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -116,27 +426,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(out *jwriter.Writ
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v RequestEntriesReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v RequestEntriesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *RequestEntriesReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -171,7 +481,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(in *jlexer.Lexer
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(out *jwriter.Writer, in RequestEntriesParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in RequestEntriesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -199,27 +509,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(out *jwriter.Wri
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v RequestEntriesParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v RequestEntriesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *RequestEntriesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -275,7 +585,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in RequestCacheNamesReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in RequestCacheNamesReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -308,27 +618,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Wri
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -359,7 +669,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in RequestCacheNamesParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in RequestCacheNamesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -374,334 +684,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Wri
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Cache) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Cache) UnmarshalJSON(data []byte) error {
|
||||
func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
|
||||
}
|
||||
|
|
|
@ -1352,7 +1352,7 @@ type Handler interface {
|
|||
|
||||
// Execute executes the specified command using the supplied context and
|
||||
// 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
|
||||
// specified.
|
||||
|
@ -1362,9 +1362,6 @@ type Handler interface {
|
|||
Release(<-chan interface{})
|
||||
}
|
||||
|
||||
// Empty is an empty JSON object message.
|
||||
var Empty = easyjson.RawMessage(`{}`)
|
||||
|
||||
// FrameID unique frame identifier.
|
||||
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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables database tracking, prevents database events from
|
||||
|
@ -68,33 +42,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Database.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
|
||||
}
|
||||
|
||||
// GetDatabaseTableNamesParams [no description].
|
||||
|
@ -123,46 +71,14 @@ type GetDatabaseTableNamesReturns struct {
|
|||
// returns:
|
||||
// tableNames
|
||||
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetDatabaseTableNamesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.TableNames, nil
|
||||
}
|
||||
|
||||
// ExecuteSQLParams [no description].
|
||||
|
@ -198,44 +114,12 @@ type ExecuteSQLReturns struct {
|
|||
// values
|
||||
// sqlError
|
||||
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res ExecuteSQLReturns
|
||||
err = h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.ColumnNames, res.Values, res.SQLError, nil
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out *Error) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -36,25 +36,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "tableNames":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.TableNames = nil
|
||||
} 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(']')
|
||||
}
|
||||
case "message":
|
||||
out.Message = string(in.String())
|
||||
case "code":
|
||||
out.Code = int64(in.Int64())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -65,56 +50,53 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(out *jwriter.Writer, in Error) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if len(in.TableNames) != 0 {
|
||||
if in.Message != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"tableNames\":")
|
||||
if in.TableNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
out.RawByte('[')
|
||||
for v2, v3 := range in.TableNames {
|
||||
if v2 > 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.String(string(v3))
|
||||
}
|
||||
out.RawByte(']')
|
||||
out.RawString("\"message\":")
|
||||
out.String(string(in.Message))
|
||||
}
|
||||
if in.Code != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"code\":")
|
||||
out.Int64(int64(in.Code))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
|
||||
func (v Error) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
|
||||
func (v *Error) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, out *Database) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -133,8 +115,14 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, ou
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "databaseId":
|
||||
out.DatabaseID = ID(in.String())
|
||||
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:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -145,275 +133,69 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(out *jwriter.Writer, in Database) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
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))
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"databaseId\":")
|
||||
out.String(string(in.DatabaseID))
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
|
||||
func (v Database) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *Database) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(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 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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(in *jlexer.Lexer, out *EventAddDatabase) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -452,7 +234,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer, in EventAddDatabase) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(out *jwriter.Writer, in EventAddDatabase) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -474,27 +256,259 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer,
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventAddDatabase) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventAddDatabase) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
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}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventAddDatabase) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *ExecuteSQLParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, out *Error) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -513,10 +527,25 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, ou
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "message":
|
||||
out.Message = string(in.String())
|
||||
case "code":
|
||||
out.Code = int64(in.Int64())
|
||||
case "tableNames":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
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:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -527,53 +556,56 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, in Error) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Message != "" {
|
||||
if len(in.TableNames) != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"message\":")
|
||||
out.String(string(in.Message))
|
||||
}
|
||||
if in.Code != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
out.RawString("\"tableNames\":")
|
||||
if in.TableNames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
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('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v Error) MarshalJSON() ([]byte, error) {
|
||||
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Error) UnmarshalJSON(data []byte) error {
|
||||
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, out *EnableParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -592,6 +624,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, ou
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "databaseId":
|
||||
out.DatabaseID = ID(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -602,34 +636,40 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(out *jwriter.Writer, in EnableParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"databaseId\":")
|
||||
out.String(string(in.DatabaseID))
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(l, v)
|
||||
}
|
||||
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) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, out *Database) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, out *EnableParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -710,14 +750,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, ou
|
|||
continue
|
||||
}
|
||||
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:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -728,65 +760,33 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, in Database) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, in EnableParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = 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('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v Database) MarshalJSON() ([]byte, error) {
|
||||
func (v EnableParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Database) UnmarshalJSON(data []byte) error {
|
||||
func (v *EnableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
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"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, p, nil)
|
||||
}
|
||||
|
||||
// ClearDeviceOrientationOverrideParams clears the overridden Device
|
||||
|
@ -84,31 +51,5 @@ func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
|
|||
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDeviceOrientationClearDeviceOrientationOverride, nil, nil)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,66 @@ var (
|
|||
_ 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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -52,7 +111,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(in *jlexer.L
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -79,83 +138,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ClearDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v SetDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ClearDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *SetDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ClearDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *SetDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
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"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetDOMBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveDOMBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetEventListenerBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveEventListenerBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// SetInstrumentationBreakpointParams sets breakpoint on particular native
|
||||
|
@ -273,39 +144,7 @@ func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpoin
|
|||
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context and
|
||||
// target handler.
|
||||
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetInstrumentationBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
|
||||
|
@ -328,39 +167,7 @@ func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBre
|
|||
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context and
|
||||
// target handler.
|
||||
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveInstrumentationBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
|
||||
|
@ -381,39 +188,7 @@ func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
|
|||
// Do executes DOMDebugger.setXHRBreakpoint against the provided context and
|
||||
// target handler.
|
||||
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetXHRBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
|
||||
|
@ -434,39 +209,7 @@ func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
|
|||
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context and
|
||||
// target handler.
|
||||
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveXHRBreakpoint, p, nil)
|
||||
}
|
||||
|
||||
// GetEventListenersParams returns event listeners of the given object.
|
||||
|
@ -513,44 +256,12 @@ type GetEventListenersReturns struct {
|
|||
// returns:
|
||||
// listeners - Array of relevant listeners.
|
||||
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (listeners []*EventListener, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetEventListenersReturns
|
||||
err = h.Execute(ctxt, cdp.CommandDOMDebuggerGetEventListeners, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Listeners, nil
|
||||
}
|
||||
|
|
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).
|
||||
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event 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).
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables storage tracking, prevents storage events from
|
||||
|
@ -70,33 +43,7 @@ func Disable() *DisableParams {
|
|||
// Do executes DOMStorage.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageDisable, nil, nil)
|
||||
}
|
||||
|
||||
// ClearParams [no description].
|
||||
|
@ -117,39 +64,7 @@ func Clear(storageID *StorageID) *ClearParams {
|
|||
// Do executes DOMStorage.clear against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageClear, p, nil)
|
||||
}
|
||||
|
||||
// GetDOMStorageItemsParams [no description].
|
||||
|
@ -178,46 +93,14 @@ type GetDOMStorageItemsReturns struct {
|
|||
// returns:
|
||||
// entries
|
||||
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entries []Item, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetDOMStorageItemsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandDOMStorageGetDOMStorageItems, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Entries, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, p, nil)
|
||||
}
|
||||
|
||||
// RemoveDOMStorageItemParams [no description].
|
||||
|
@ -300,37 +151,5 @@ func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageIte
|
|||
// Do executes DOMStorage.removeDOMStorageItem against the provided context and
|
||||
// target handler.
|
||||
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageRemoveDOMStorageItem, p, nil)
|
||||
}
|
||||
|
|
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) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *MessageError) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *BackendNode) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -698,10 +698,12 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *Messa
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "code":
|
||||
out.Code = int64(in.Int64())
|
||||
case "message":
|
||||
out.Message = string(in.String())
|
||||
case "nodeType":
|
||||
(out.NodeType).UnmarshalEasyJSON(in)
|
||||
case "nodeName":
|
||||
out.NodeName = string(in.String())
|
||||
case "backendNodeId":
|
||||
(out.BackendNodeID).UnmarshalEasyJSON(in)
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -712,174 +714,61 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(in *jlexer.Lexer, out *Messa
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(out *jwriter.Writer, in MessageError) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(out *jwriter.Writer, in BackendNode) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Code != 0 {
|
||||
if in.NodeType != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"code\":")
|
||||
out.Int64(int64(in.Code))
|
||||
out.RawString("\"nodeType\":")
|
||||
(in.NodeType).MarshalEasyJSON(out)
|
||||
}
|
||||
if in.Message != "" {
|
||||
if in.NodeName != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"message\":")
|
||||
out.String(string(in.Message))
|
||||
out.RawString("\"nodeName\":")
|
||||
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('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v MessageError) MarshalJSON() ([]byte, error) {
|
||||
func (v BackendNode) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v MessageError) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *MessageError) UnmarshalJSON(data []byte) error {
|
||||
func (v *BackendNode) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *MessageError) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp2(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(in *jlexer.Lexer, out *Message) {
|
||||
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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(in *jlexer.Lexer, out *Frame) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -922,7 +811,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Frame
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Frame) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(out *jwriter.Writer, in Frame) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -988,27 +877,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v Frame) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v Frame) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *Frame) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1027,12 +916,24 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *Backe
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "nodeType":
|
||||
(out.NodeType).UnmarshalEasyJSON(in)
|
||||
case "nodeName":
|
||||
out.NodeName = string(in.String())
|
||||
case "backendNodeId":
|
||||
(out.BackendNodeID).UnmarshalEasyJSON(in)
|
||||
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()
|
||||
}
|
||||
|
@ -1043,57 +944,156 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(in *jlexer.Lexer, out *Backe
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in BackendNode) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Message) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.NodeType != 0 {
|
||||
if in.ID != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"nodeType\":")
|
||||
(in.NodeType).MarshalEasyJSON(out)
|
||||
out.RawString("\"id\":")
|
||||
out.Int64(int64(in.ID))
|
||||
}
|
||||
if in.NodeName != "" {
|
||||
if in.Method != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"nodeName\":")
|
||||
out.String(string(in.NodeName))
|
||||
out.RawString("\"method\":")
|
||||
(in.Method).MarshalEasyJSON(out)
|
||||
}
|
||||
if in.BackendNodeID != 0 {
|
||||
if (in.Params).IsDefined() {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"backendNodeId\":")
|
||||
out.Int64(int64(in.BackendNodeID))
|
||||
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 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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v MessageError) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *BackendNode) UnmarshalJSON(data []byte) error {
|
||||
func (v *MessageError) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *MessageError) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdp5(l, v)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, p, nil)
|
||||
}
|
||||
|
||||
// ClearDeviceMetricsOverrideParams clears the overriden device metrics.
|
||||
|
@ -144,33 +111,7 @@ func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
|
|||
// Do executes Emulation.clearDeviceMetricsOverride against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationClearDeviceMetricsOverride, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationForceViewport, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationResetViewport, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationResetPageScaleFactor, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetPageScaleFactor, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetVisibleSize, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetScriptExecutionDisabled, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, p, nil)
|
||||
}
|
||||
|
||||
// ClearGeolocationOverrideParams clears the overriden Geolocation Position
|
||||
|
@ -573,33 +302,7 @@ func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
|
|||
// Do executes Emulation.clearGeolocationOverride against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, p, nil)
|
||||
}
|
||||
|
||||
// CanEmulateParams tells whether emulation is supported.
|
||||
|
@ -789,40 +396,14 @@ type CanEmulateReturns struct {
|
|||
// returns:
|
||||
// result - True if emulation is supported.
|
||||
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandEmulationCanEmulate, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res CanEmulateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandEmulationCanEmulate, nil, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return false, cdp.ErrUnknownResult
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetVirtualTimePolicy, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetDefaultBackgroundColorOverride, p, nil)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/runtime"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
|
@ -25,33 +24,7 @@ func Enable() *EnableParams {
|
|||
// Do executes HeapProfiler.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
|
@ -65,33 +38,7 @@ func Disable() *DisableParams {
|
|||
// Do executes HeapProfiler.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerDisable, nil, nil)
|
||||
}
|
||||
|
||||
// StartTrackingHeapObjectsParams [no description].
|
||||
|
@ -115,39 +62,7 @@ func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bo
|
|||
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
|
||||
// target handler.
|
||||
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerStartTrackingHeapObjects, p, nil)
|
||||
}
|
||||
|
||||
// StopTrackingHeapObjectsParams [no description].
|
||||
|
@ -172,39 +87,7 @@ func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *
|
|||
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
|
||||
// target handler.
|
||||
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerStopTrackingHeapObjects, p, nil)
|
||||
}
|
||||
|
||||
// TakeHeapSnapshotParams [no description].
|
||||
|
@ -229,39 +112,7 @@ func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHea
|
|||
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
|
||||
// target handler.
|
||||
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, p, nil)
|
||||
}
|
||||
|
||||
// CollectGarbageParams [no description].
|
||||
|
@ -275,33 +126,7 @@ func CollectGarbage() *CollectGarbageParams {
|
|||
// Do executes HeapProfiler.collectGarbage against the provided context and
|
||||
// target handler.
|
||||
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerCollectGarbage, nil, nil)
|
||||
}
|
||||
|
||||
// GetObjectByHeapObjectIDParams [no description].
|
||||
|
@ -338,46 +163,14 @@ type GetObjectByHeapObjectIDReturns struct {
|
|||
// returns:
|
||||
// result - Evaluation result.
|
||||
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetObjectByHeapObjectIDReturns
|
||||
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetObjectByHeapObjectID, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerAddInspectedHeapObject, p, nil)
|
||||
}
|
||||
|
||||
// GetHeapObjectIDParams [no description].
|
||||
|
@ -461,46 +222,14 @@ type GetHeapObjectIDReturns struct {
|
|||
// returns:
|
||||
// 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) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetHeapObjectIDReturns
|
||||
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetHeapObjectID, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.HeapSnapshotObjectID, nil
|
||||
}
|
||||
|
||||
// StartSamplingParams [no description].
|
||||
|
@ -525,39 +254,7 @@ func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *Sta
|
|||
// Do executes HeapProfiler.startSampling against the provided context and
|
||||
// target handler.
|
||||
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerStartSampling, p, nil)
|
||||
}
|
||||
|
||||
// StopSamplingParams [no description].
|
||||
|
@ -579,38 +276,12 @@ type StopSamplingReturns struct {
|
|||
// returns:
|
||||
// profile - Recorded sampling heap profile.
|
||||
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res StopSamplingReturns
|
||||
err = h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, nil, &res)
|
||||
if err != nil {
|
||||
return nil, 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"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams enables events from backend.
|
||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
|||
// Do executes IndexedDB.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandIndexedDBEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables events from backend.
|
||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
|||
// Do executes IndexedDB.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandIndexedDBDisable, nil, nil)
|
||||
}
|
||||
|
||||
// RequestDatabaseNamesParams requests database names for given security
|
||||
|
@ -120,46 +67,14 @@ type RequestDatabaseNamesReturns struct {
|
|||
// returns:
|
||||
// databaseNames - Database names for origin.
|
||||
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RequestDatabaseNamesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.DatabaseNames, nil
|
||||
}
|
||||
|
||||
// RequestDatabaseParams requests database with given name in given frame.
|
||||
|
@ -191,46 +106,14 @@ type RequestDatabaseReturns struct {
|
|||
// returns:
|
||||
// databaseWithObjectStores - Database with an array of object stores.
|
||||
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RequestDatabaseReturns
|
||||
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.DatabaseWithObjectStores, nil
|
||||
}
|
||||
|
||||
// RequestDataParams requests data from object store or index.
|
||||
|
@ -283,46 +166,14 @@ type RequestDataReturns struct {
|
|||
// objectStoreDataEntries - Array of object store data entries.
|
||||
// hasMore - If true, there are more entries to fetch in the given range.
|
||||
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RequestDataReturns
|
||||
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestData, p, &res)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.ObjectStoreDataEntries, res.HasMore, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, p, nil)
|
||||
}
|
||||
|
||||
// DeleteDatabaseParams deletes a database.
|
||||
|
@ -405,37 +224,5 @@ func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseP
|
|||
// Do executes IndexedDB.deleteDatabase against the provided context and
|
||||
// target handler.
|
||||
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, p, nil)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputDispatchKeyEvent, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputDispatchMouseEvent, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputDispatchTouchEvent, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputEmulateTouchFromMouseEvent, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputSynthesizePinchGesture, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputSynthesizeScrollGesture, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInputSynthesizeTapGesture, p, nil)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, out *EventTargetCrashed) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, out *DisableParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -46,7 +46,125 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, ou
|
|||
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('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -56,27 +174,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(out *jwriter.Writer,
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventTargetCrashed) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventTargetCrashed) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventTargetCrashed) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -107,7 +225,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(in *jlexer.Lexer, o
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer, in EventDetached) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(out *jwriter.Writer, in EventDetached) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -124,142 +242,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v EventDetached) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *EventDetached) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *EventDetached) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(l, v)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams enables inspector domain notifications.
|
||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
|||
// Do executes Inspector.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInspectorEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables inspector domain notifications.
|
||||
|
@ -64,31 +37,5 @@ func Disable() *DisableParams {
|
|||
// Do executes Inspector.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandInspectorDisable, nil, nil)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,74 @@ var (
|
|||
_ 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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -50,7 +117,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *Read
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ReadReturns) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadReturns) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -76,27 +143,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in Rea
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ReadReturns) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ReadReturns) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -131,7 +198,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *Rea
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in ReadParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -162,91 +229,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in Re
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *CloseParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *ReadParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v)
|
||||
}
|
||||
|
|
75
cdp/io/io.go
75
cdp/io/io.go
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// ReadParams read a chunk of the stream.
|
||||
|
@ -59,46 +58,14 @@ type ReadReturns struct {
|
|||
// data - Data that were read.
|
||||
// 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) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res ReadReturns
|
||||
err = h.Execute(ctxt, cdp.CommandIORead, p, &res)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Data, res.EOF, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandIOClose, p, nil)
|
||||
}
|
||||
|
|
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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLayerTreeEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables compositing tree inspection.
|
||||
|
@ -65,33 +39,7 @@ func Disable() *DisableParams {
|
|||
// Do executes LayerTree.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLayerTreeDisable, nil, nil)
|
||||
}
|
||||
|
||||
// CompositingReasonsParams provides the reasons why the given layer was
|
||||
|
@ -122,46 +70,14 @@ type CompositingReasonsReturns struct {
|
|||
// returns:
|
||||
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
|
||||
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (compositingReasons []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res CompositingReasonsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeCompositingReasons, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.CompositingReasons, nil
|
||||
}
|
||||
|
||||
// MakeSnapshotParams returns the layer snapshot identifier.
|
||||
|
@ -190,46 +106,14 @@ type MakeSnapshotReturns struct {
|
|||
// returns:
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res MakeSnapshotReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeMakeSnapshot, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.SnapshotID, nil
|
||||
}
|
||||
|
||||
// LoadSnapshotParams returns the snapshot identifier.
|
||||
|
@ -258,46 +142,14 @@ type LoadSnapshotReturns struct {
|
|||
// returns:
|
||||
// snapshotID - The id of the snapshot.
|
||||
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res LoadSnapshotReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeLoadSnapshot, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.SnapshotID, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, p, nil)
|
||||
}
|
||||
|
||||
// ProfileSnapshotParams [no description].
|
||||
|
@ -401,46 +221,14 @@ type ProfileSnapshotReturns struct {
|
|||
// returns:
|
||||
// timings - The array of paint profiles, one per run.
|
||||
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings []PaintProfile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res ProfileSnapshotReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeProfileSnapshot, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Timings, nil
|
||||
}
|
||||
|
||||
// ReplaySnapshotParams replays the layer snapshot and returns the resulting
|
||||
|
@ -494,46 +282,14 @@ type ReplaySnapshotReturns struct {
|
|||
// returns:
|
||||
// dataURL - A data: URL for resulting image.
|
||||
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.Handler) (dataURL string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res ReplaySnapshotReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeReplaySnapshot, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.DataURL, nil
|
||||
}
|
||||
|
||||
// SnapshotCommandLogParams replays the layer snapshot and returns canvas
|
||||
|
@ -563,44 +319,12 @@ type SnapshotCommandLogReturns struct {
|
|||
// returns:
|
||||
// commandLog - The array of canvas function calls.
|
||||
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.Handler) (commandLog []easyjson.RawMessage, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res SnapshotCommandLogReturns
|
||||
err = h.Execute(ctxt, cdp.CommandLayerTreeSnapshotCommandLog, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.CommandLog, nil
|
||||
}
|
||||
|
|
|
@ -19,86 +19,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(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 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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(in *jlexer.Lexer, out *StopViolationsReportParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -127,7 +48,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(in *jlexer.Lexer, out *St
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in StopViolationsReportParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(out *jwriter.Writer, in StopViolationsReportParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -137,27 +58,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in S
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v StopViolationsReportParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v StopViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *StopViolationsReportParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -213,7 +134,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(in *jlexer.Lexer, out *St
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in StartViolationsReportParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in StartViolationsReportParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -244,27 +165,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in S
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v StartViolationsReportParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v StartViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *StartViolationsReportParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -283,16 +204,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *Ev
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "entry":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.Entry = nil
|
||||
} else {
|
||||
if out.Entry == nil {
|
||||
out.Entry = new(Entry)
|
||||
}
|
||||
(*out.Entry).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -303,49 +214,234 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *Ev
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in EventEntryAdded) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in ClearParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Entry != nil {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"entry\":")
|
||||
if in.Entry == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.Entry).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
||||
func (v 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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -400,7 +496,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *En
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in Entry) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(out *jwriter.Writer, in Entry) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -485,146 +581,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in E
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v Entry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *Entry) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *ClearParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *EventEntryAdded) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -643,6 +621,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *Cl
|
|||
continue
|
||||
}
|
||||
switch key {
|
||||
case "entry":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.Entry = nil
|
||||
} else {
|
||||
if out.Entry == nil {
|
||||
out.Entry = new(Entry)
|
||||
}
|
||||
(*out.Entry).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -653,33 +641,45 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *Cl
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(out *jwriter.Writer, in ClearParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(out *jwriter.Writer, in EventEntryAdded) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Entry != nil {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"entry\":")
|
||||
if in.Entry == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.Entry).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ClearParams) MarshalJSON() ([]byte, error) {
|
||||
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ClearParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ClearParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ClearParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(l, v)
|
||||
}
|
||||
|
|
147
cdp/log/log.go
147
cdp/log/log.go
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLogEnable, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLogDisable, nil, nil)
|
||||
}
|
||||
|
||||
// ClearParams clears the log.
|
||||
|
@ -110,33 +57,7 @@ func Clear() *ClearParams {
|
|||
// Do executes Log.clear against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLogClear, nil, nil)
|
||||
}
|
||||
|
||||
// StartViolationsReportParams start violation reporting.
|
||||
|
@ -157,39 +78,7 @@ func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportPar
|
|||
// Do executes Log.startViolationsReport against the provided context and
|
||||
// target handler.
|
||||
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLogStartViolationsReport, p, nil)
|
||||
}
|
||||
|
||||
// StopViolationsReportParams stop violation reporting.
|
||||
|
@ -203,31 +92,5 @@ func StopViolationsReport() *StopViolationsReportParams {
|
|||
// Do executes Log.stopViolationsReport against the provided context and
|
||||
// target handler.
|
||||
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandLogStopViolationsReport, nil, nil)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// GetDOMCountersParams [no description].
|
||||
|
@ -36,40 +35,14 @@ type GetDOMCountersReturns struct {
|
|||
// nodes
|
||||
// jsEventListeners
|
||||
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
|
||||
ch := h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetDOMCountersReturns
|
||||
err = h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, nil, &res)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
|
||||
return 0, 0, 0, cdp.ErrUnknownResult
|
||||
return res.Documents, res.Nodes, res.JsEventListeners, nil
|
||||
}
|
||||
|
||||
// SetPressureNotificationsSuppressedParams enable/disable suppressing memory
|
||||
|
@ -92,39 +65,7 @@ func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificatio
|
|||
// Do executes Memory.setPressureNotificationsSuppressed against the provided context and
|
||||
// target handler.
|
||||
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, p, nil)
|
||||
}
|
||||
|
||||
// SimulatePressureNotificationParams simulate a memory pressure notification
|
||||
|
@ -147,37 +88,5 @@ func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotifica
|
|||
// Do executes Memory.simulatePressureNotification against the provided context and
|
||||
// target handler.
|
||||
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, p, nil)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,6 @@ import (
|
|||
"encoding/base64"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkEnable, p, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables network tracking, prevents network events from
|
||||
|
@ -98,33 +65,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Network.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkDisable, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetUserAgentOverride, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetExtraHTTPHeaders, p, nil)
|
||||
}
|
||||
|
||||
// GetResponseBodyParams returns content served for the given request.
|
||||
|
@ -263,57 +140,24 @@ type GetResponseBodyReturns struct {
|
|||
// returns:
|
||||
// body - Response body.
|
||||
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetResponseBodyReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, easyjson.RawMessage(buf))
|
||||
|
||||
// read response
|
||||
select {
|
||||
case res := <-ch:
|
||||
if res == nil {
|
||||
return nil, cdp.ErrChannelClosed
|
||||
// decode
|
||||
var dec []byte
|
||||
if res.Base64encoded {
|
||||
dec, err = base64.StdEncoding.DecodeString(res.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch v := res.(type) {
|
||||
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()
|
||||
} else {
|
||||
dec = []byte(res.Body)
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return dec, nil
|
||||
}
|
||||
|
||||
// AddBlockedURLParams blocks specific URL from loading.
|
||||
|
@ -334,39 +178,7 @@ func AddBlockedURL(url string) *AddBlockedURLParams {
|
|||
// Do executes Network.addBlockedURL against the provided context and
|
||||
// target handler.
|
||||
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkAddBlockedURL, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkRemoveBlockedURL, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkReplayXHR, p, nil)
|
||||
}
|
||||
|
||||
// SetMonitoringXHREnabledParams toggles monitoring of XMLHttpRequest. If
|
||||
|
@ -501,39 +249,7 @@ func SetMonitoringXHREnabled(enabled bool) *SetMonitoringXHREnabledParams {
|
|||
// Do executes Network.setMonitoringXHREnabled against the provided context and
|
||||
// target handler.
|
||||
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetMonitoringXHREnabled, p, nil)
|
||||
}
|
||||
|
||||
// CanClearBrowserCacheParams tells whether clearing browser cache is
|
||||
|
@ -556,40 +272,14 @@ type CanClearBrowserCacheReturns struct {
|
|||
// returns:
|
||||
// result - True if browser cache can be cleared.
|
||||
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCache, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res CanClearBrowserCacheReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCache, nil, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return false, cdp.ErrUnknownResult
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// ClearBrowserCacheParams clears browser cache.
|
||||
|
@ -603,33 +293,7 @@ func ClearBrowserCache() *ClearBrowserCacheParams {
|
|||
// Do executes Network.clearBrowserCache against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCache, nil, nil)
|
||||
}
|
||||
|
||||
// CanClearBrowserCookiesParams tells whether clearing browser cookies is
|
||||
|
@ -653,40 +317,14 @@ type CanClearBrowserCookiesReturns struct {
|
|||
// returns:
|
||||
// result - True if browser cookies can be cleared.
|
||||
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCookies, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res CanClearBrowserCookiesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkCanClearBrowserCookies, nil, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return false, cdp.ErrUnknownResult
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// ClearBrowserCookiesParams clears browser cookies.
|
||||
|
@ -700,33 +338,7 @@ func ClearBrowserCookies() *ClearBrowserCookiesParams {
|
|||
// Do executes Network.clearBrowserCookies against the provided context and
|
||||
// target handler.
|
||||
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCookies, nil, nil)
|
||||
}
|
||||
|
||||
// GetCookiesParams returns all browser cookies for the current URL.
|
||||
|
@ -762,46 +374,14 @@ type GetCookiesReturns struct {
|
|||
// returns:
|
||||
// cookies - Array of cookie objects.
|
||||
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetCookiesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkGetCookies, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Cookies, nil
|
||||
}
|
||||
|
||||
// GetAllCookiesParams returns all browser cookies. Depending on the backend
|
||||
|
@ -825,40 +405,14 @@ type GetAllCookiesReturns struct {
|
|||
// returns:
|
||||
// cookies - Array of cookie objects.
|
||||
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetAllCookiesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return res.Cookies, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkDeleteCookie, p, nil)
|
||||
}
|
||||
|
||||
// SetCookieParams sets a cookie with the given cookie data; may overwrite
|
||||
|
@ -994,46 +516,14 @@ type SetCookieReturns struct {
|
|||
// returns:
|
||||
// success - True if successfully set cookie.
|
||||
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res SetCookieReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkSetCookie, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// CanEmulateNetworkConditionsParams tells whether emulation of network
|
||||
|
@ -1057,40 +547,14 @@ type CanEmulateNetworkConditionsReturns struct {
|
|||
// returns:
|
||||
// result - True if emulation of network conditions is supported.
|
||||
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandNetworkCanEmulateNetworkConditions, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res CanEmulateNetworkConditionsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkCanEmulateNetworkConditions, nil, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return false, cdp.ErrUnknownResult
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkEmulateNetworkConditions, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetCacheDisabled, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetBypassServiceWorker, p, nil)
|
||||
}
|
||||
|
||||
// SetDataSizeLimitsForTestParams for testing.
|
||||
|
@ -1293,39 +661,7 @@ func SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) *SetDat
|
|||
// Do executes Network.setDataSizeLimitsForTest against the provided context and
|
||||
// target handler.
|
||||
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetDataSizeLimitsForTest, p, nil)
|
||||
}
|
||||
|
||||
// GetCertificateParams returns the DER-encoded certificate.
|
||||
|
@ -1354,44 +690,12 @@ type GetCertificateReturns struct {
|
|||
// returns:
|
||||
// tableNames
|
||||
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetCertificateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandNetworkGetCertificate, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.TableNames, nil
|
||||
}
|
||||
|
|
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"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
|||
// Do executes Profiler.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandProfilerEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Profiler.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandProfilerDisable, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandProfilerSetSamplingInterval, p, nil)
|
||||
}
|
||||
|
||||
// StartParams [no description].
|
||||
|
@ -159,33 +74,7 @@ func Start() *StartParams {
|
|||
// Do executes Profiler.start against the provided context and
|
||||
// target handler.
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandProfilerStart, nil, nil)
|
||||
}
|
||||
|
||||
// StopParams [no description].
|
||||
|
@ -207,38 +96,12 @@ type StopReturns struct {
|
|||
// returns:
|
||||
// profile - Recorded profile.
|
||||
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandProfilerStop, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res StopReturns
|
||||
err = h.Execute(ctxt, cdp.CommandProfilerStop, nil, &res)
|
||||
if err != nil {
|
||||
return nil, 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) {
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -182,7 +316,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering2(in *jlexer.Lexer, o
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer, in SetShowPaintRectsParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(out *jwriter.Writer, in SetShowPaintRectsParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -197,158 +331,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering2(out *jwriter.Writer
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v SetShowDebugBordersParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v SetShowPaintRectsParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRendering4(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *SetShowDebugBordersParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *SetShowPaintRectsParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *SetShowDebugBordersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *SetShowPaintRectsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRendering4(l, v)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRenderingSetShowPaintRects, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRenderingSetShowDebugBorders, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRenderingSetShowFPSCounter, p, nil)
|
||||
}
|
||||
|
||||
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
|
||||
|
@ -195,39 +98,7 @@ func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams
|
|||
// Do executes Rendering.setShowScrollBottleneckRects against the provided context and
|
||||
// target handler.
|
||||
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRenderingSetShowScrollBottleneckRects, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRenderingSetShowViewportSizeOnResize, p, nil)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EvaluateParams evaluates expression on global object.
|
||||
|
@ -112,46 +111,14 @@ type EvaluateReturns struct {
|
|||
// result - Evaluation result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res EvaluateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeEvaluate, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
// exceptionDetails - Exception details if stack strace is available.
|
||||
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res AwaitPromiseReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeAwaitPromise, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// CallFunctionOnParams calls function with given declaration on the given
|
||||
|
@ -319,46 +254,14 @@ type CallFunctionOnReturns struct {
|
|||
// result - Call result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res CallFunctionOnReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeCallFunctionOn, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// 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).
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.Handler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetPropertiesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeGetProperties, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, res.InternalProperties, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeReleaseObject, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeReleaseObjectGroup, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeRunIfWaitingForDebugger, nil, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables reporting of execution contexts creation.
|
||||
|
@ -663,33 +418,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Runtime.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeDisable, nil, nil)
|
||||
}
|
||||
|
||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||
|
@ -704,33 +433,7 @@ func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
|||
// Do executes Runtime.discardConsoleEntries against the provided context and
|
||||
// target handler.
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, nil, nil)
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabledParams [no description].
|
||||
|
@ -751,39 +454,7 @@ func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnab
|
|||
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
|
||||
// target handler.
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, p, nil)
|
||||
}
|
||||
|
||||
// CompileScriptParams compiles expression.
|
||||
|
@ -829,46 +500,14 @@ type CompileScriptReturns struct {
|
|||
// scriptID - Id of the script.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res CompileScriptReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeCompileScript, p, &res)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.ScriptID, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// RunScriptParams runs script with given id in a given context.
|
||||
|
@ -955,44 +594,12 @@ type RunScriptReturns struct {
|
|||
// result - Run result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res RunScriptReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeRunScript, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// GetDomainsParams returns supported domains.
|
||||
|
@ -34,38 +33,12 @@ type GetDomainsReturns struct {
|
|||
// returns:
|
||||
// domains - List of supported domains.
|
||||
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.Handler) (domains []*Domain, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandSchemaGetDomains, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetDomainsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandSchemaGetDomains, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return res.Domains, nil
|
||||
}
|
||||
|
|
|
@ -17,106 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(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 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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out *ShowCertificateViewerParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -145,7 +46,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, in ShowCertificateViewerParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -155,27 +56,145 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(out *jwriter.Writer,
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ShowCertificateViewerParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ShowCertificateViewerParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ShowCertificateViewerParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(in *jlexer.Lexer, out *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}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -216,7 +235,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer, in InsecureContentStatus) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in InsecureContentStatus) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -274,27 +293,126 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer,
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v InsecureContentStatus) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v InsecureContentStatus) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *InsecureContentStatus) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -366,7 +484,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, ou
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in EventSecurityStateChanged) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer, in EventSecurityStateChanged) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -434,142 +552,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer,
|
|||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
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{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v EventSecurityStateChanged) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
||||
func (v *EventSecurityStateChanged) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *EventSecurityStateChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(l, v)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams enables tracking security state changes.
|
||||
|
@ -26,33 +25,7 @@ func Enable() *EnableParams {
|
|||
// Do executes Security.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandSecurityEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables tracking security state changes.
|
||||
|
@ -66,33 +39,7 @@ func Disable() *DisableParams {
|
|||
// Do executes Security.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandSecurityDisable, nil, nil)
|
||||
}
|
||||
|
||||
// ShowCertificateViewerParams displays native dialog with the certificate
|
||||
|
@ -107,31 +54,5 @@ func ShowCertificateViewer() *ShowCertificateViewerParams {
|
|||
// Do executes Security.showCertificateViewer against the provided context and
|
||||
// target handler.
|
||||
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandSecurityShowCertificateViewer, nil, nil)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
|
@ -24,33 +23,7 @@ func Enable() *EnableParams {
|
|||
// Do executes ServiceWorker.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
|
@ -64,33 +37,7 @@ func Disable() *DisableParams {
|
|||
// Do executes ServiceWorker.disable against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDisable, nil, nil)
|
||||
}
|
||||
|
||||
// UnregisterParams [no description].
|
||||
|
@ -111,39 +58,7 @@ func Unregister(scopeURL string) *UnregisterParams {
|
|||
// Do executes ServiceWorker.unregister against the provided context and
|
||||
// target handler.
|
||||
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, p, nil)
|
||||
}
|
||||
|
||||
// UpdateRegistrationParams [no description].
|
||||
|
@ -164,39 +79,7 @@ func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
|||
// Do executes ServiceWorker.updateRegistration against the provided context and
|
||||
// target handler.
|
||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, p, nil)
|
||||
}
|
||||
|
||||
// StartWorkerParams [no description].
|
||||
|
@ -217,39 +100,7 @@ func StartWorker(scopeURL string) *StartWorkerParams {
|
|||
// Do executes ServiceWorker.startWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, p, nil)
|
||||
}
|
||||
|
||||
// SkipWaitingParams [no description].
|
||||
|
@ -270,39 +121,7 @@ func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
|||
// Do executes ServiceWorker.skipWaiting against the provided context and
|
||||
// target handler.
|
||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, p, nil)
|
||||
}
|
||||
|
||||
// StopWorkerParams [no description].
|
||||
|
@ -323,39 +142,7 @@ func StopWorker(versionID string) *StopWorkerParams {
|
|||
// Do executes ServiceWorker.stopWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, p, nil)
|
||||
}
|
||||
|
||||
// InspectWorkerParams [no description].
|
||||
|
@ -376,39 +163,7 @@ func InspectWorker(versionID string) *InspectWorkerParams {
|
|||
// Do executes ServiceWorker.inspectWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerInspectWorker, p, nil)
|
||||
}
|
||||
|
||||
// SetForceUpdateOnPageLoadParams [no description].
|
||||
|
@ -429,39 +184,7 @@ func SetForceUpdateOnPageLoad(forceUpdateOnPageLoad bool) *SetForceUpdateOnPageL
|
|||
// Do executes ServiceWorker.setForceUpdateOnPageLoad against the provided context and
|
||||
// target handler.
|
||||
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerSetForceUpdateOnPageLoad, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, p, nil)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, p, nil)
|
||||
}
|
||||
|
|
|
@ -17,167 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(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 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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(in *jlexer.Lexer, out *GPUInfo) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -256,7 +96,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Writer, in GPUInfo) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(out *jwriter.Writer, in GPUInfo) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -324,27 +164,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GPUInfo) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GPUInfo) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *GPUInfo) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo2(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
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()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -381,7 +221,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Writer, in GPUDevice) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(out *jwriter.Writer, in GPUDevice) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -423,23 +263,183 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v GPUDevice) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v GPUDevice) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo1(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
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}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *GPUDevice) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *GetInfoParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSysteminfo3(l, v)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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.
|
||||
// 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) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetInfoReturns
|
||||
err = h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, nil, &res)
|
||||
if err != nil {
|
||||
return nil, "", "", 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"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, p, nil)
|
||||
}
|
||||
|
||||
// SetAttachToFramesParams [no description].
|
||||
|
@ -150,39 +85,7 @@ func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
|||
// Do executes Target.setAttachToFrames against the provided context and
|
||||
// target handler.
|
||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil)
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, p, nil)
|
||||
}
|
||||
|
||||
// GetTargetInfoParams returns information about a target.
|
||||
|
@ -323,46 +162,14 @@ type GetTargetInfoReturns struct {
|
|||
// returns:
|
||||
// targetInfo
|
||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res GetTargetInfoReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.TargetInfo, nil
|
||||
}
|
||||
|
||||
// ActivateTargetParams activates (focuses) the target.
|
||||
|
@ -383,39 +190,7 @@ func ActivateTarget(targetID ID) *ActivateTargetParams {
|
|||
// Do executes Target.activateTarget against the provided context and
|
||||
// target handler.
|
||||
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetActivateTarget, p, nil)
|
||||
}
|
||||
|
||||
// CloseTargetParams closes the target. If the target is a page that gets
|
||||
|
@ -446,46 +221,14 @@ type CloseTargetReturns struct {
|
|||
// returns:
|
||||
// success
|
||||
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res CloseTargetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetCloseTarget, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// AttachToTargetParams attaches to the target with given id.
|
||||
|
@ -514,46 +257,14 @@ type AttachToTargetReturns struct {
|
|||
// returns:
|
||||
// success - Whether attach succeeded.
|
||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res AttachToTargetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, p, nil)
|
||||
}
|
||||
|
||||
// CreateBrowserContextParams creates a new empty BrowserContext. Similar to
|
||||
|
@ -630,40 +309,14 @@ type CreateBrowserContextReturns struct {
|
|||
// returns:
|
||||
// browserContextID - The id of the context created.
|
||||
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (browserContextID BrowserContextID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetCreateBrowserContext, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res CreateBrowserContextReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetCreateBrowserContext, nil, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return "", cdp.ErrUnknownResult
|
||||
return res.BrowserContextID, nil
|
||||
}
|
||||
|
||||
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
||||
|
@ -694,46 +347,14 @@ type DisposeBrowserContextReturns struct {
|
|||
// returns:
|
||||
// success
|
||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res DisposeBrowserContextReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// CreateTargetParams creates a new page.
|
||||
|
@ -784,46 +405,14 @@ type CreateTargetReturns struct {
|
|||
// returns:
|
||||
// targetID - The id of the page opened.
|
||||
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.Handler) (targetID ID, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
// execute
|
||||
var res CreateTargetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetCreateTarget, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// execute
|
||||
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
|
||||
return res.TargetID, nil
|
||||
}
|
||||
|
||||
// GetTargetsParams retrieves a list of available targets.
|
||||
|
@ -845,38 +434,12 @@ type GetTargetsReturns struct {
|
|||
// returns:
|
||||
// targetInfos - The list of targets.
|
||||
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.Handler) (targetInfos []*Info, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandTargetGetTargets, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetTargetsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetGetTargets, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return res.TargetInfos, nil
|
||||
}
|
||||
|
|
|
@ -17,74 +17,7 @@ var (
|
|||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(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 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) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering(in *jlexer.Lexer, out *EventAccepted) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -117,7 +50,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(in *jlexer.Lexer, o
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer, in EventAccepted) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(out *jwriter.Writer, in EventAccepted) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -143,24 +76,91 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v EventAccepted) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v EventAccepted) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
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}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *EventAccepted) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *UnbindParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering1(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTethering2(in *jlexer.Lexer, out *BindParams) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// BindParams request browser port binding.
|
||||
|
@ -33,39 +32,7 @@ func Bind(port int64) *BindParams {
|
|||
// Do executes Tethering.bind against the provided context and
|
||||
// target handler.
|
||||
func (p *BindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTetheringBind, p, nil)
|
||||
}
|
||||
|
||||
// UnbindParams request browser port unbinding.
|
||||
|
@ -86,37 +53,5 @@ func Unbind(port int64) *UnbindParams {
|
|||
// Do executes Tethering.unbind against the provided context and
|
||||
// target handler.
|
||||
func (p *UnbindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTetheringUnbind, p, nil)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,6 @@ import (
|
|||
"context"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTracingStart, p, nil)
|
||||
}
|
||||
|
||||
// EndParams stop trace events collection.
|
||||
|
@ -96,33 +63,7 @@ func End() *EndParams {
|
|||
// Do executes Tracing.end against the provided context and
|
||||
// target handler.
|
||||
func (p *EndParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTracingEnd, nil, nil)
|
||||
}
|
||||
|
||||
// GetCategoriesParams gets supported tracing categories.
|
||||
|
@ -144,40 +85,14 @@ type GetCategoriesReturns struct {
|
|||
// returns:
|
||||
// categories - A list of supported tracing categories.
|
||||
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.Handler) (categories []string, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingGetCategories, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res GetCategoriesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTracingGetCategories, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, cdp.ErrUnknownResult
|
||||
return res.Categories, nil
|
||||
}
|
||||
|
||||
// RequestMemoryDumpParams request a global memory dump.
|
||||
|
@ -201,40 +116,14 @@ type RequestMemoryDumpReturns struct {
|
|||
// dumpGUID - GUID of the resulting global memory dump.
|
||||
// success - True iff the global memory dump succeeded.
|
||||
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.Handler) (dumpGUID string, success bool, err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}
|
||||
|
||||
// execute
|
||||
ch := h.Execute(ctxt, cdp.CommandTracingRequestMemoryDump, cdp.Empty)
|
||||
|
||||
// read response
|
||||
select {
|
||||
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()
|
||||
var res RequestMemoryDumpReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTracingRequestMemoryDump, nil, &res)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
return "", false, cdp.ErrUnknownResult
|
||||
return res.DumpGUID, res.Success, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
// target handler.
|
||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
if ctxt == 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
|
||||
return h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, p, nil)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ var defaultContext = context.Background()
|
|||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
pool, err = NewPool()
|
||||
pool, err = NewPool(PoolLog(log.Printf, log.Printf, log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -360,8 +360,8 @@ func (t *Type) EmptyRetList(d *Domain, domains []*Domain) string {
|
|||
return strings.TrimSuffix(s, ", ")
|
||||
}
|
||||
|
||||
// RetValueList returns the return value list for a command.
|
||||
func (t *Type) RetValueList(d *Domain, domains []*Domain) string {
|
||||
// RetNameList returns a <valname>.<name> list for a command's return list.
|
||||
func (t *Type) RetNameList(valname string, d *Domain, domains []*Domain) string {
|
||||
var s string
|
||||
b64ret := t.Base64EncodedRetParam()
|
||||
for _, p := range t.Returns {
|
||||
|
@ -369,7 +369,7 @@ func (t *Type) RetValueList(d *Domain, domains []*Domain) string {
|
|||
continue
|
||||
}
|
||||
|
||||
n := "r." + p.GoName(false)
|
||||
n := valname + "." + p.GoName(false)
|
||||
if b64ret != nil && b64ret.Name == p.Name {
|
||||
n = "dec"
|
||||
}
|
||||
|
|
|
@ -7174,12 +7174,6 @@
|
|||
"optional": true,
|
||||
"description": "Event original handler function value."
|
||||
},
|
||||
{
|
||||
"name": "removeFunction",
|
||||
"$ref": "Runtime.RemoteObject",
|
||||
"optional": true,
|
||||
"description": "Event listener remove function."
|
||||
},
|
||||
{
|
||||
"name": "backendNodeId",
|
||||
"$ref": "DOM.BackendNodeId",
|
||||
|
|
|
@ -86,7 +86,7 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
|
|||
retTypeList += ", "
|
||||
}
|
||||
|
||||
retValueList := c.RetValueList(d, domains)
|
||||
retValueList := c.RetNameList("res", d, domains)
|
||||
if retValueList != "" {
|
||||
retValueList += ", "
|
||||
}
|
||||
|
@ -102,63 +102,36 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
pval := "p"
|
||||
if hasEmptyParams {
|
||||
pval = "nil"
|
||||
}
|
||||
%}
|
||||
// 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 %}
|
||||
// {%s= p.String() %}{% endfor %}{% endif %}
|
||||
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.Handler) ({%s= retTypeList %}err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}{% if !hasEmptyParams %}
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.Handler) ({%s= retTypeList %}err error) {{% if hasEmptyRet %}
|
||||
return h.Execute(ctxt, cdp.{%s= c.CommandMethodType(d) %}, {%s= pval %}, nil){% else %}
|
||||
// execute
|
||||
var res {%s= c.CommandReturnsType() %}
|
||||
err = h.Execute(ctxt, cdp.{%s= c.CommandMethodType(d) %}, {%s= pval %}, &res)
|
||||
if err != nil {
|
||||
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()
|
||||
}
|
||||
|
||||
return {%s= emptyRet %}cdp.ErrUnknownResult
|
||||
{% if b64ret != nil %}
|
||||
// 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 %}
|
||||
|
|
|
@ -424,7 +424,7 @@ func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d
|
|||
retTypeList += ", "
|
||||
}
|
||||
|
||||
retValueList := c.RetValueList(d, domains)
|
||||
retValueList := c.RetNameList("res", d, domains)
|
||||
if 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(`
|
||||
// Do executes `)
|
||||
//line templates/domain.qtpl:106
|
||||
//line templates/domain.qtpl:111
|
||||
qw422016.N().S(c.ProtoName(d))
|
||||
//line templates/domain.qtpl:106
|
||||
//line templates/domain.qtpl:111
|
||||
qw422016.N().S(` against the provided context and
|
||||
// target handler.`)
|
||||
//line templates/domain.qtpl:107
|
||||
if len(c.Returns) > 0 {
|
||||
//line templates/domain.qtpl:107
|
||||
//line templates/domain.qtpl:112
|
||||
if !hasEmptyRet {
|
||||
//line templates/domain.qtpl:112
|
||||
qw422016.N().S(`
|
||||
//
|
||||
// returns:`)
|
||||
//line templates/domain.qtpl:109
|
||||
//line templates/domain.qtpl:114
|
||||
for _, p := range c.Returns {
|
||||
//line templates/domain.qtpl:109
|
||||
//line templates/domain.qtpl:114
|
||||
if p.Name == internal.Base64EncodedParamName {
|
||||
//line templates/domain.qtpl:109
|
||||
//line templates/domain.qtpl:114
|
||||
continue
|
||||
//line templates/domain.qtpl:109
|
||||
//line templates/domain.qtpl:114
|
||||
}
|
||||
//line templates/domain.qtpl:109
|
||||
//line templates/domain.qtpl:114
|
||||
qw422016.N().S(`
|
||||
// `)
|
||||
//line templates/domain.qtpl:110
|
||||
//line templates/domain.qtpl:115
|
||||
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(`
|
||||
func (p *`)
|
||||
//line templates/domain.qtpl:111
|
||||
//line templates/domain.qtpl:116
|
||||
qw422016.N().S(typ)
|
||||
//line templates/domain.qtpl:111
|
||||
//line templates/domain.qtpl:116
|
||||
qw422016.N().S(`) Do(ctxt context.Context, h cdp.Handler) (`)
|
||||
//line templates/domain.qtpl:111
|
||||
//line templates/domain.qtpl:116
|
||||
qw422016.N().S(retTypeList)
|
||||
//line templates/domain.qtpl:111
|
||||
qw422016.N().S(`err error) {
|
||||
if ctxt == nil {
|
||||
ctxt = context.Background()
|
||||
}`)
|
||||
//line templates/domain.qtpl:114
|
||||
if !hasEmptyParams {
|
||||
//line templates/domain.qtpl:114
|
||||
//line templates/domain.qtpl:116
|
||||
qw422016.N().S(`err error) {`)
|
||||
//line templates/domain.qtpl:116
|
||||
if hasEmptyRet {
|
||||
//line templates/domain.qtpl:116
|
||||
qw422016.N().S(`
|
||||
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(p)
|
||||
return h.Execute(ctxt, cdp.`)
|
||||
//line templates/domain.qtpl:117
|
||||
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 {
|
||||
return `)
|
||||
//line templates/domain.qtpl:119
|
||||
//line templates/domain.qtpl:122
|
||||
qw422016.N().S(emptyRet)
|
||||
//line templates/domain.qtpl:119
|
||||
//line templates/domain.qtpl:122
|
||||
qw422016.N().S(`err
|
||||
}`)
|
||||
//line templates/domain.qtpl:120
|
||||
}
|
||||
//line templates/domain.qtpl:120
|
||||
qw422016.N().S(`
|
||||
|
||||
// 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
|
||||
`)
|
||||
//line templates/domain.qtpl:124
|
||||
if b64ret != nil {
|
||||
//line templates/domain.qtpl:139
|
||||
//line templates/domain.qtpl:124
|
||||
qw422016.N().S(`
|
||||
|
||||
// decode
|
||||
var dec []byte`)
|
||||
//line templates/domain.qtpl:142
|
||||
// decode
|
||||
var dec []byte`)
|
||||
//line templates/domain.qtpl:126
|
||||
if b64cond {
|
||||
//line templates/domain.qtpl:142
|
||||
//line templates/domain.qtpl:126
|
||||
qw422016.N().S(`
|
||||
if r.Base64encoded {`)
|
||||
//line templates/domain.qtpl:143
|
||||
if res.Base64encoded {`)
|
||||
//line templates/domain.qtpl:127
|
||||
}
|
||||
//line templates/domain.qtpl:143
|
||||
//line templates/domain.qtpl:127
|
||||
qw422016.N().S(`
|
||||
dec, err = base64.StdEncoding.DecodeString(r.`)
|
||||
//line templates/domain.qtpl:144
|
||||
dec, err = base64.StdEncoding.DecodeString(res.`)
|
||||
//line templates/domain.qtpl:128
|
||||
qw422016.N().S(b64ret.GoName(false))
|
||||
//line templates/domain.qtpl:144
|
||||
//line templates/domain.qtpl:128
|
||||
qw422016.N().S(`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}`)
|
||||
//line templates/domain.qtpl:147
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}`)
|
||||
//line templates/domain.qtpl:131
|
||||
if b64cond {
|
||||
//line templates/domain.qtpl:147
|
||||
//line templates/domain.qtpl:131
|
||||
qw422016.N().S(`
|
||||
} else {
|
||||
dec = []byte(r.`)
|
||||
//line templates/domain.qtpl:149
|
||||
} else {
|
||||
dec = []byte(res.`)
|
||||
//line templates/domain.qtpl:133
|
||||
qw422016.N().S(b64ret.GoName(false))
|
||||
//line templates/domain.qtpl:149
|
||||
//line templates/domain.qtpl:133
|
||||
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(`
|
||||
`)
|
||||
//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 `)
|
||||
//line templates/domain.qtpl:162
|
||||
qw422016.N().S(emptyRet)
|
||||
//line templates/domain.qtpl:162
|
||||
qw422016.N().S(`cdp.ErrUnknownResult
|
||||
//line templates/domain.qtpl:135
|
||||
qw422016.N().S(retValueList)
|
||||
//line templates/domain.qtpl:135
|
||||
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) {
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
StreamCommandDoFuncTemplate(qw422016, c, d, domains)
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
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 {
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
WriteCommandDoFuncTemplate(qb422016, c, d, domains)
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/domain.qtpl:164
|
||||
//line templates/domain.qtpl:137
|
||||
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
|
||||
// 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
|
||||
// specified.
|
||||
|
@ -240,9 +240,6 @@ type Handler interface {
|
|||
// Release releases a channel returned from Listen.
|
||||
Release(<-chan interface{})
|
||||
}
|
||||
|
||||
// Empty is an empty JSON object message.
|
||||
var Empty = easyjson.RawMessage(`{}`)
|
||||
{% endfunc %}
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// specified.
|
||||
|
@ -501,52 +501,41 @@ type Handler interface {
|
|||
// Release releases a channel returned from Listen.
|
||||
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) {
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
StreamExtraCDPTypes(qw422016)
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
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 {
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
WriteExtraCDPTypes(qb422016)
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
return qs422016
|
||||
//line templates/extra.qtpl:246
|
||||
//line templates/extra.qtpl:243
|
||||
}
|
||||
|
||||
// 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) {
|
||||
//line templates/extra.qtpl:249
|
||||
//line templates/extra.qtpl:246
|
||||
qw422016.N().S(`
|
||||
type empty struct{}
|
||||
var emptyVal = &empty{}
|
||||
|
@ -555,66 +544,66 @@ var emptyVal = &empty{}
|
|||
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
||||
var v easyjson.Unmarshaler
|
||||
switch msg.Method {`)
|
||||
//line templates/extra.qtpl:256
|
||||
//line templates/extra.qtpl:253
|
||||
for _, d := range domains {
|
||||
//line templates/extra.qtpl:256
|
||||
//line templates/extra.qtpl:253
|
||||
for _, c := range d.Commands {
|
||||
//line templates/extra.qtpl:256
|
||||
//line templates/extra.qtpl:253
|
||||
qw422016.N().S(`
|
||||
case cdp.`)
|
||||
//line templates/extra.qtpl:257
|
||||
//line templates/extra.qtpl:254
|
||||
qw422016.N().S(c.CommandMethodType(d))
|
||||
//line templates/extra.qtpl:257
|
||||
//line templates/extra.qtpl:254
|
||||
qw422016.N().S(`:`)
|
||||
//line templates/extra.qtpl:257
|
||||
//line templates/extra.qtpl:254
|
||||
if len(c.Returns) == 0 {
|
||||
//line templates/extra.qtpl:257
|
||||
//line templates/extra.qtpl:254
|
||||
qw422016.N().S(`
|
||||
return emptyVal, nil`)
|
||||
//line templates/extra.qtpl:258
|
||||
//line templates/extra.qtpl:255
|
||||
} else {
|
||||
//line templates/extra.qtpl:258
|
||||
//line templates/extra.qtpl:255
|
||||
qw422016.N().S(`
|
||||
v = new(`)
|
||||
//line templates/extra.qtpl:259
|
||||
//line templates/extra.qtpl:256
|
||||
qw422016.N().S(d.PackageRefName())
|
||||
//line templates/extra.qtpl:259
|
||||
//line templates/extra.qtpl:256
|
||||
qw422016.N().S(`.`)
|
||||
//line templates/extra.qtpl:259
|
||||
//line templates/extra.qtpl:256
|
||||
qw422016.N().S(c.CommandReturnsType())
|
||||
//line templates/extra.qtpl:259
|
||||
//line templates/extra.qtpl:256
|
||||
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(`
|
||||
`)
|
||||
//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
|
||||
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(`}
|
||||
|
||||
var buf easyjson.RawMessage
|
||||
|
@ -637,69 +626,69 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
|||
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) {
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
StreamExtraUtilTemplate(qw422016, domains)
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
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 {
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
WriteExtraUtilTemplate(qb422016, domains)
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/extra.qtpl:284
|
||||
//line templates/extra.qtpl:281
|
||||
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) {
|
||||
//line templates/extra.qtpl:286
|
||||
//line templates/extra.qtpl:283
|
||||
qw422016.N().S(`
|
||||
// Domain returns the Chrome Debugging Protocol domain of the event or command.
|
||||
func (t MethodType) Domain() string {
|
||||
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) {
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
StreamExtraMethodTypeDomainDecoder(qw422016)
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
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 {
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
WriteExtraMethodTypeDomainDecoder(qb422016)
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
return qs422016
|
||||
//line templates/extra.qtpl:291
|
||||
//line templates/extra.qtpl:288
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
cdp "github.com/knq/chromedp"
|
||||
cdptypes "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/client"
|
||||
cdp "github.com/knq/cdp"
|
||||
cdptypes "github.com/knq/cdp/cdp"
|
||||
"github.com/knq/cdp/client"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -22,13 +22,13 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// 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(),
|
||||
))*/
|
||||
|
||||
// create edge instance
|
||||
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 {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// 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 {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func main() {
|
|||
defer cancel()
|
||||
|
||||
// create chrome instance
|
||||
c, err := cdp.New(ctxt)
|
||||
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
123
handler.go
123
handler.go
|
@ -50,7 +50,7 @@ type TargetHandler struct {
|
|||
lastm sync.Mutex
|
||||
|
||||
// res is the id->result channel map.
|
||||
res map[int64]chan interface{}
|
||||
res map[int64]chan easyjson.RawMessage
|
||||
resrw sync.RWMutex
|
||||
|
||||
// logging funcs
|
||||
|
@ -87,7 +87,7 @@ func (h *TargetHandler) Run(ctxt context.Context) error {
|
|||
h.qcmd = make(chan *cdp.Message)
|
||||
h.qres = 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.pageWaitGroup = new(sync.WaitGroup)
|
||||
h.domWaitGroup = new(sync.WaitGroup)
|
||||
|
@ -182,19 +182,19 @@ func (h *TargetHandler) run(ctxt context.Context) {
|
|||
case ev := <-h.qevents:
|
||||
err = h.processEvent(ctxt, ev)
|
||||
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:
|
||||
err = h.processResult(res)
|
||||
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:
|
||||
err = h.processCommand(cmd)
|
||||
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():
|
||||
|
@ -295,31 +295,27 @@ func (h *TargetHandler) documentUpdated(ctxt context.Context) {
|
|||
|
||||
// processResult processes an incoming command result.
|
||||
func (h *TargetHandler) processResult(msg *cdp.Message) error {
|
||||
h.resrw.Lock()
|
||||
defer h.resrw.Unlock()
|
||||
h.resrw.RLock()
|
||||
defer h.resrw.RUnlock()
|
||||
|
||||
res, ok := h.res[msg.ID]
|
||||
ch, ok := h.res[msg.ID]
|
||||
if !ok {
|
||||
err := fmt.Errorf("expected result to be present for message id %d", msg.ID)
|
||||
h.errorf(err.Error())
|
||||
return err
|
||||
return fmt.Errorf("id %d not present in res map", msg.ID)
|
||||
}
|
||||
defer close(ch)
|
||||
|
||||
if msg.Error != nil {
|
||||
res <- msg.Error
|
||||
} else {
|
||||
res <- msg.Result
|
||||
return msg.Error
|
||||
}
|
||||
|
||||
delete(h.res, msg.ID)
|
||||
ch <- msg.Result
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// processCommand writes a command to the client connection.
|
||||
func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
|
||||
// FIXME: there are two possible error conditions here, check and
|
||||
// do some kind of logging ...
|
||||
// marshal
|
||||
buf, err := easyjson.Marshal(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -327,61 +323,70 @@ func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
|
|||
|
||||
h.debugf("<- %s", string(buf))
|
||||
|
||||
// write
|
||||
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
|
||||
// provided context and the raw JSON encoded params.
|
||||
//
|
||||
// Returns a result channel that will receive AT MOST ONE result. A result is
|
||||
// either the command's result value (as a raw JSON encoded value), or any
|
||||
// error encountered during operation. After the result (or an error) is passed
|
||||
// to the returned channel, the channel will be closed.
|
||||
//
|
||||
// Note: the returned channel will be closed after the result is read. If the
|
||||
// passed context finishes prior to receiving the command result, then
|
||||
// ctxt.Err() will be sent to the channel.
|
||||
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,
|
||||
// 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 {
|
||||
var paramsBuf easyjson.RawMessage
|
||||
if params == nil {
|
||||
paramsBuf = emptyObj
|
||||
} else {
|
||||
var err error
|
||||
paramsBuf, err = easyjson.Marshal(params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
case v := <-res:
|
||||
if v != nil {
|
||||
ch <- v
|
||||
} else {
|
||||
ch <- cdp.ErrChannelClosed
|
||||
case msg := <-ch:
|
||||
if res != nil {
|
||||
errch <- easyjson.Unmarshal(msg, res)
|
||||
}
|
||||
|
||||
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.
|
||||
|
|
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:]...)
|
||||
}
|
||||
|
||||
// isCouldNotComputeBoxModelError unwraps the err as a MessagError and
|
||||
// determines if it is a compute box model error.
|
||||
// isCouldNotComputeBoxModelError unwraps err as a MessageError and determines
|
||||
// if it is a compute box model error.
|
||||
func isCouldNotComputeBoxModelError(err error) bool {
|
||||
e, ok := err.(*cdp.MessageError)
|
||||
return ok && e.Code == -32000 && e.Message == "Could not compute box model."
|
||||
|
|
Loading…
Reference in New Issue
Block a user