From 7fbfef7cf1c7ff083551f311f388ca173988854e Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Sun, 2 Jul 2017 18:44:34 +0700 Subject: [PATCH] Adding synthesized "HAR" domain to protocol generation * Added "HAR" domain * Fixed issue with omitempty on domain types --- cdp/accessibility/easyjson.go | 92 +- cdp/accessibility/types.go | 18 +- cdp/animation/easyjson.go | 330 +-- cdp/animation/events.go | 6 +- cdp/animation/types.go | 48 +- cdp/applicationcache/easyjson.go | 206 +- cdp/applicationcache/events.go | 8 +- cdp/applicationcache/types.go | 22 +- cdp/cachestorage/easyjson.go | 72 +- cdp/cachestorage/types.go | 12 +- cdp/cdp.go | 48 +- cdp/css/easyjson.go | 1008 ++++---- cdp/css/events.go | 6 +- cdp/css/types.go | 124 +- cdp/database/easyjson.go | 92 +- cdp/database/events.go | 2 +- cdp/database/types.go | 12 +- cdp/debugger/easyjson.go | 504 ++-- cdp/debugger/events.go | 40 +- cdp/debugger/types.go | 30 +- cdp/dom/easyjson.go | 704 +++-- cdp/dom/events.go | 54 +- cdp/dom/types.go | 26 +- cdp/domdebugger/easyjson.go | 84 +- cdp/domdebugger/types.go | 14 +- cdp/domsnapshot/easyjson.go | 142 +- cdp/domsnapshot/types.go | 18 +- cdp/domstorage/easyjson.go | 176 +- cdp/domstorage/events.go | 20 +- cdp/domstorage/types.go | 4 +- cdp/easyjson.go | 228 +- cdp/emulation/easyjson.go | 24 +- cdp/emulation/types.go | 4 +- cdp/har/easyjson.go | 2261 +++++++++++++++++ cdp/har/har.go | 9 + cdp/har/types.go | 168 ++ cdp/heapprofiler/easyjson.go | 188 +- cdp/heapprofiler/events.go | 12 +- cdp/heapprofiler/types.go | 8 +- cdp/indexeddb/easyjson.go | 308 +-- cdp/indexeddb/types.go | 40 +- cdp/input/easyjson.go | 36 +- cdp/input/types.go | 6 +- cdp/inspector/easyjson.go | 12 +- cdp/inspector/events.go | 2 +- cdp/layertree/easyjson.go | 184 +- cdp/layertree/events.go | 4 +- cdp/layertree/types.go | 24 +- cdp/log/easyjson.go | 100 +- cdp/log/events.go | 2 +- cdp/log/types.go | 12 +- cdp/network/easyjson.go | 1952 ++++++-------- cdp/network/events.go | 114 +- cdp/network/types.go | 148 +- cdp/overlay/easyjson.go | 24 +- cdp/overlay/events.go | 4 +- cdp/page/easyjson.go | 702 +++-- cdp/page/events.go | 46 +- cdp/page/types.go | 64 +- cdp/profiler/easyjson.go | 362 ++- cdp/profiler/events.go | 12 +- cdp/profiler/types.go | 32 +- cdp/runtime/easyjson.go | 606 ++--- cdp/runtime/events.go | 28 +- cdp/runtime/types.go | 72 +- cdp/schema/easyjson.go | 24 +- cdp/schema/types.go | 4 +- cdp/security/easyjson.go | 250 +- cdp/security/events.go | 16 +- cdp/security/types.go | 22 +- cdp/serviceworker/easyjson.go | 264 +- cdp/serviceworker/events.go | 6 +- cdp/serviceworker/types.go | 28 +- cdp/storage/easyjson.go | 24 +- cdp/storage/types.go | 4 +- cdp/systeminfo/easyjson.go | 116 +- cdp/systeminfo/types.go | 12 +- cdp/target/easyjson.go | 204 +- cdp/target/events.go | 16 +- cdp/target/types.go | 14 +- cdp/tethering/easyjson.go | 24 +- cdp/tethering/events.go | 4 +- cdp/tracing/easyjson.go | 30 +- cdp/tracing/events.go | 2 +- cmd/chromedp-gen/fixup/fixup.go | 5 + .../{domain-gen.go => gen-domain.go} | 0 cmd/chromedp-gen/gen-har-proto.go | 261 ++ cmd/chromedp-gen/gen/gen.go | 4 +- cmd/chromedp-gen/har.json | 640 +++++ cmd/chromedp-gen/internal/domain.go | 3 + cmd/chromedp-gen/main.go | 2 +- cmd/chromedp-gen/protocol.json | 632 +++++ cmd/chromedp-gen/update.sh | 4 +- 93 files changed, 8553 insertions(+), 5782 deletions(-) create mode 100644 cdp/har/easyjson.go create mode 100644 cdp/har/har.go create mode 100644 cdp/har/types.go rename cmd/chromedp-gen/{domain-gen.go => gen-domain.go} (100%) create mode 100644 cmd/chromedp-gen/gen-har-proto.go create mode 100644 cmd/chromedp-gen/har.json diff --git a/cdp/accessibility/easyjson.go b/cdp/accessibility/easyjson.go index 89a1b1a..d567cd6 100644 --- a/cdp/accessibility/easyjson.go +++ b/cdp/accessibility/easyjson.go @@ -282,14 +282,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility2(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Value != nil { if !first { out.RawByte(',') @@ -491,14 +489,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility3(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if (in.Value).IsDefined() { if !first { out.RawByte(',') @@ -618,14 +614,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility4(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.BackendDOMNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendDOMNodeId\":") - out.Int64(int64(in.BackendDOMNodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"backendDOMNodeId\":") + out.Int64(int64(in.BackendDOMNodeID)) if in.Idref != "" { if !first { out.RawByte(',') @@ -713,25 +707,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility5(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - if in.Value == nil { - out.RawString("null") - } else { - (*in.Value).MarshalEasyJSON(out) - } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) } out.RawByte('}') } @@ -923,22 +913,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAccessibility6(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.NodeID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.String(string(in.NodeID)) + if !first { + out.RawByte(',') } - if in.Ignored { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ignored\":") - out.Bool(bool(in.Ignored)) + first = false + out.RawString("\"nodeId\":") + out.String(string(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"ignored\":") + out.Bool(bool(in.Ignored)) if len(in.IgnoredReasons) != 0 { if !first { out.RawByte(',') diff --git a/cdp/accessibility/types.go b/cdp/accessibility/types.go index 5d65e66..bb2453d 100644 --- a/cdp/accessibility/types.go +++ b/cdp/accessibility/types.go @@ -223,7 +223,7 @@ func (t *AXValueNativeSourceType) UnmarshalJSON(buf []byte) error { // AXValueSource a single source for a computed AX property. type AXValueSource struct { - Type AXValueSourceType `json:"type,omitempty"` // What type of source this is. + Type AXValueSourceType `json:"type"` // What type of source this is. Value *AXValue `json:"value,omitempty"` // The value of this property source. Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any. AttributeValue *AXValue `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any. @@ -236,20 +236,20 @@ type AXValueSource struct { // AXRelatedNode [no description]. type AXRelatedNode struct { - BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId,omitempty"` // The BackendNodeId of the related DOM node. - Idref string `json:"idref,omitempty"` // The IDRef value provided, if any. - Text string `json:"text,omitempty"` // The text alternative of this node in the current context. + BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId"` // The BackendNodeId of the related DOM node. + Idref string `json:"idref,omitempty"` // The IDRef value provided, if any. + Text string `json:"text,omitempty"` // The text alternative of this node in the current context. } // AXProperty [no description]. type AXProperty struct { - Name string `json:"name,omitempty"` // The name of this property. - Value *AXValue `json:"value,omitempty"` // The value of this property. + Name string `json:"name"` // The name of this property. + Value *AXValue `json:"value"` // The value of this property. } // AXValue a single computed AX property. type AXValue struct { - Type AXValueType `json:"type,omitempty"` // The type of this value. + Type AXValueType `json:"type"` // The type of this value. Value easyjson.RawMessage `json:"value,omitempty"` // The computed value of this property. RelatedNodes []*AXRelatedNode `json:"relatedNodes,omitempty"` // One or more related nodes, if applicable. Sources []*AXValueSource `json:"sources,omitempty"` // The sources which contributed to the computation of this property. @@ -543,8 +543,8 @@ func (t *AXRelationshipAttributes) UnmarshalJSON(buf []byte) error { // AXNode a node in the accessibility tree. type AXNode struct { - NodeID AXNodeID `json:"nodeId,omitempty"` // Unique identifier for this node. - Ignored bool `json:"ignored,omitempty"` // Whether this node is ignored for accessibility + NodeID AXNodeID `json:"nodeId"` // Unique identifier for this node. + Ignored bool `json:"ignored"` // Whether this node is ignored for accessibility IgnoredReasons []*AXProperty `json:"ignoredReasons,omitempty"` // Collection of reasons why this node is hidden. Role *AXValue `json:"role,omitempty"` // This Node's role, whether explicit or implicit. Name *AXValue `json:"name,omitempty"` // The accessible name for this Node. diff --git a/cdp/animation/easyjson.go b/cdp/animation/easyjson.go index 22ee6d7..c052fa0 100644 --- a/cdp/animation/easyjson.go +++ b/cdp/animation/easyjson.go @@ -703,28 +703,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation7(out *jwriter.Writer out.RawString("\"name\":") out.String(string(in.Name)) } - if len(in.Keyframes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyframes\":") - if in.Keyframes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v11, v12 := range in.Keyframes { - if v11 > 0 { - out.RawByte(',') - } - if v12 == nil { - out.RawString("null") - } else { - (*v12).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"keyframes\":") + if in.Keyframes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v11, v12 := range in.Keyframes { + if v11 > 0 { + out.RawByte(',') + } + if v12 == nil { + out.RawString("null") + } else { + (*v12).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -789,22 +787,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation8(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Offset != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offset\":") - out.String(string(in.Offset)) + if !first { + out.RawByte(',') } - if in.Easing != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"easing\":") - out.String(string(in.Easing)) + first = false + out.RawString("\"offset\":") + out.String(string(in.Offset)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"easing\":") + out.String(string(in.Easing)) out.RawByte('}') } @@ -1138,17 +1132,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation13(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Animation != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"animation\":") - if in.Animation == nil { - out.RawString("null") - } else { - (*in.Animation).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"animation\":") + if in.Animation == nil { + out.RawString("null") + } else { + (*in.Animation).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1211,14 +1203,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation14(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) out.RawByte('}') } @@ -1280,14 +1270,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation15(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) out.RawByte('}') } @@ -1434,70 +1422,54 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Delay != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"delay\":") - out.Float64(float64(in.Delay)) + if !first { + out.RawByte(',') } - if in.EndDelay != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endDelay\":") - out.Float64(float64(in.EndDelay)) + first = false + out.RawString("\"delay\":") + out.Float64(float64(in.Delay)) + if !first { + out.RawByte(',') } - if in.IterationStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"iterationStart\":") - out.Float64(float64(in.IterationStart)) + first = false + out.RawString("\"endDelay\":") + out.Float64(float64(in.EndDelay)) + if !first { + out.RawByte(',') } - if in.Iterations != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"iterations\":") - out.Float64(float64(in.Iterations)) + first = false + out.RawString("\"iterationStart\":") + out.Float64(float64(in.IterationStart)) + if !first { + out.RawByte(',') } - if in.Duration != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"duration\":") - out.Float64(float64(in.Duration)) + first = false + out.RawString("\"iterations\":") + out.Float64(float64(in.Iterations)) + if !first { + out.RawByte(',') } - if in.Direction != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"direction\":") - out.String(string(in.Direction)) + first = false + out.RawString("\"duration\":") + out.Float64(float64(in.Duration)) + if !first { + out.RawByte(',') } - if in.Fill != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"fill\":") - out.String(string(in.Fill)) + first = false + out.RawString("\"direction\":") + out.String(string(in.Direction)) + if !first { + out.RawByte(',') } - if in.BackendNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendNodeId\":") - out.Int64(int64(in.BackendNodeID)) + first = false + out.RawString("\"fill\":") + out.String(string(in.Fill)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"backendNodeId\":") + out.Int64(int64(in.BackendNodeID)) if in.KeyframesRule != nil { if !first { out.RawByte(',') @@ -1510,14 +1482,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation17(out *jwriter.Write (*in.KeyframesRule).MarshalEasyJSON(out) } } - if in.Easing != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"easing\":") - out.String(string(in.Easing)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"easing\":") + out.String(string(in.Easing)) out.RawByte('}') } @@ -1664,82 +1634,64 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAnimation19(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.PausedState { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pausedState\":") - out.Bool(bool(in.PausedState)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.PlayState != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"playState\":") - out.String(string(in.PlayState)) + first = false + out.RawString("\"pausedState\":") + out.Bool(bool(in.PausedState)) + if !first { + out.RawByte(',') } - if in.PlaybackRate != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"playbackRate\":") - out.Float64(float64(in.PlaybackRate)) + first = false + out.RawString("\"playState\":") + out.String(string(in.PlayState)) + if !first { + out.RawByte(',') } - if in.StartTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startTime\":") - out.Float64(float64(in.StartTime)) + first = false + out.RawString("\"playbackRate\":") + out.Float64(float64(in.PlaybackRate)) + if !first { + out.RawByte(',') } - if in.CurrentTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"currentTime\":") - out.Float64(float64(in.CurrentTime)) + first = false + out.RawString("\"startTime\":") + out.Float64(float64(in.StartTime)) + if !first { + out.RawByte(',') } - if in.Source != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"source\":") - if in.Source == nil { - out.RawString("null") - } else { - (*in.Source).MarshalEasyJSON(out) - } + first = false + out.RawString("\"currentTime\":") + out.Float64(float64(in.CurrentTime)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"source\":") + if in.Source == nil { + out.RawString("null") + } else { + (*in.Source).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.CSSID != "" { if !first { out.RawByte(',') diff --git a/cdp/animation/events.go b/cdp/animation/events.go index eb036c5..92ac4c5 100644 --- a/cdp/animation/events.go +++ b/cdp/animation/events.go @@ -8,17 +8,17 @@ import ( // EventAnimationCreated event for each animation that has been created. type EventAnimationCreated struct { - ID string `json:"id,omitempty"` // Id of the animation that was created. + ID string `json:"id"` // Id of the animation that was created. } // EventAnimationStarted event for animation that has been started. type EventAnimationStarted struct { - Animation *Animation `json:"animation,omitempty"` // Animation that was started. + Animation *Animation `json:"animation"` // Animation that was started. } // EventAnimationCanceled event for when an animation has been cancelled. type EventAnimationCanceled struct { - ID string `json:"id,omitempty"` // Id of the animation that was cancelled. + ID string `json:"id"` // Id of the animation that was cancelled. } // EventTypes all event types in the domain. diff --git a/cdp/animation/types.go b/cdp/animation/types.go index d08bc30..4a47184 100644 --- a/cdp/animation/types.go +++ b/cdp/animation/types.go @@ -13,42 +13,42 @@ import ( // Animation animation instance. type Animation struct { - ID string `json:"id,omitempty"` // Animation's id. - Name string `json:"name,omitempty"` // Animation's name. - PausedState bool `json:"pausedState,omitempty"` // Animation's internal paused state. - PlayState string `json:"playState,omitempty"` // Animation's play state. - PlaybackRate float64 `json:"playbackRate,omitempty"` // Animation's playback rate. - StartTime float64 `json:"startTime,omitempty"` // Animation's start time. - CurrentTime float64 `json:"currentTime,omitempty"` // Animation's current time. - Source *Effect `json:"source,omitempty"` // Animation's source animation node. - Type Type `json:"type,omitempty"` // Animation type of Animation. - CSSID string `json:"cssId,omitempty"` // A unique ID for Animation representing the sources that triggered this CSS animation/transition. + ID string `json:"id"` // Animation's id. + Name string `json:"name"` // Animation's name. + PausedState bool `json:"pausedState"` // Animation's internal paused state. + PlayState string `json:"playState"` // Animation's play state. + PlaybackRate float64 `json:"playbackRate"` // Animation's playback rate. + StartTime float64 `json:"startTime"` // Animation's start time. + CurrentTime float64 `json:"currentTime"` // Animation's current time. + Source *Effect `json:"source"` // Animation's source animation node. + Type Type `json:"type"` // Animation type of Animation. + CSSID string `json:"cssId,omitempty"` // A unique ID for Animation representing the sources that triggered this CSS animation/transition. } // Effect animationEffect instance. type Effect struct { - Delay float64 `json:"delay,omitempty"` // AnimationEffect's delay. - EndDelay float64 `json:"endDelay,omitempty"` // AnimationEffect's end delay. - IterationStart float64 `json:"iterationStart,omitempty"` // AnimationEffect's iteration start. - Iterations float64 `json:"iterations,omitempty"` // AnimationEffect's iterations. - Duration float64 `json:"duration,omitempty"` // AnimationEffect's iteration duration. - Direction string `json:"direction,omitempty"` // AnimationEffect's playback direction. - Fill string `json:"fill,omitempty"` // AnimationEffect's fill mode. - BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // AnimationEffect's target node. - KeyframesRule *KeyframesRule `json:"keyframesRule,omitempty"` // AnimationEffect's keyframes. - Easing string `json:"easing,omitempty"` // AnimationEffect's timing function. + Delay float64 `json:"delay"` // AnimationEffect's delay. + EndDelay float64 `json:"endDelay"` // AnimationEffect's end delay. + IterationStart float64 `json:"iterationStart"` // AnimationEffect's iteration start. + Iterations float64 `json:"iterations"` // AnimationEffect's iterations. + Duration float64 `json:"duration"` // AnimationEffect's iteration duration. + Direction string `json:"direction"` // AnimationEffect's playback direction. + Fill string `json:"fill"` // AnimationEffect's fill mode. + BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // AnimationEffect's target node. + KeyframesRule *KeyframesRule `json:"keyframesRule,omitempty"` // AnimationEffect's keyframes. + Easing string `json:"easing"` // AnimationEffect's timing function. } // KeyframesRule keyframes Rule. type KeyframesRule struct { - Name string `json:"name,omitempty"` // CSS keyframed animation's name. - Keyframes []*KeyframeStyle `json:"keyframes,omitempty"` // List of animation keyframes. + Name string `json:"name,omitempty"` // CSS keyframed animation's name. + Keyframes []*KeyframeStyle `json:"keyframes"` // List of animation keyframes. } // KeyframeStyle keyframe Style. type KeyframeStyle struct { - Offset string `json:"offset,omitempty"` // Keyframe's time offset. - Easing string `json:"easing,omitempty"` // AnimationEffect's timing function. + Offset string `json:"offset"` // Keyframe's time offset. + Easing string `json:"easing"` // AnimationEffect's timing function. } // Type animation type of Animation. diff --git a/cdp/applicationcache/easyjson.go b/cdp/applicationcache/easyjson.go index 8396742..9e5291e 100644 --- a/cdp/applicationcache/easyjson.go +++ b/cdp/applicationcache/easyjson.go @@ -56,30 +56,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache(out *jwriter. out.RawByte('{') first := true _ = first - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Size != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"size\":") - out.Int64(int64(in.Size)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - out.String(string(in.Type)) + first = false + out.RawString("\"size\":") + out.Int64(int64(in.Size)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + out.String(string(in.Type)) out.RawByte('}') } @@ -601,30 +595,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache7(out *jwriter out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.ManifestURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"manifestURL\":") - out.String(string(in.ManifestURL)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.Status != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - out.Int64(int64(in.Status)) + first = false + out.RawString("\"manifestURL\":") + out.String(string(in.ManifestURL)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"status\":") + out.Int64(int64(in.Status)) out.RawByte('}') } @@ -686,14 +674,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache8(out *jwriter out.RawByte('{') first := true _ = first - if in.IsNowOnline { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isNowOnline\":") - out.Bool(bool(in.IsNowOnline)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"isNowOnline\":") + out.Bool(bool(in.IsNowOnline)) out.RawByte('}') } @@ -759,30 +745,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache9(out *jwriter out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.ManifestURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"manifestURL\":") - out.String(string(in.ManifestURL)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.Status != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - out.Int64(int64(in.Status)) + first = false + out.RawString("\"manifestURL\":") + out.String(string(in.ManifestURL)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"status\":") + out.Int64(int64(in.Status)) out.RawByte('}') } @@ -940,60 +920,50 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpApplicationcache11(out *jwrite out.RawByte('{') first := true _ = first - if in.ManifestURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"manifestURL\":") - out.String(string(in.ManifestURL)) + if !first { + out.RawByte(',') } - if in.Size != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"size\":") - out.Float64(float64(in.Size)) + first = false + out.RawString("\"manifestURL\":") + out.String(string(in.ManifestURL)) + if !first { + out.RawByte(',') } - if in.CreationTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"creationTime\":") - out.Float64(float64(in.CreationTime)) + first = false + out.RawString("\"size\":") + out.Float64(float64(in.Size)) + if !first { + out.RawByte(',') } - if in.UpdateTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"updateTime\":") - out.Float64(float64(in.UpdateTime)) + first = false + out.RawString("\"creationTime\":") + out.Float64(float64(in.CreationTime)) + if !first { + out.RawByte(',') } - if len(in.Resources) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"resources\":") - if in.Resources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.Resources { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - (*v6).MarshalEasyJSON(out) - } + first = false + out.RawString("\"updateTime\":") + out.Float64(float64(in.UpdateTime)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"resources\":") + if in.Resources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Resources { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } diff --git a/cdp/applicationcache/events.go b/cdp/applicationcache/events.go index 7196d6a..e0d69dd 100644 --- a/cdp/applicationcache/events.go +++ b/cdp/applicationcache/events.go @@ -8,14 +8,14 @@ import ( // EventApplicationCacheStatusUpdated [no description]. type EventApplicationCacheStatusUpdated struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Identifier of the frame containing document whose application cache updated status. - ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL. - Status int64 `json:"status,omitempty"` // Updated application cache status. + FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache updated status. + ManifestURL string `json:"manifestURL"` // Manifest URL. + Status int64 `json:"status"` // Updated application cache status. } // EventNetworkStateUpdated [no description]. type EventNetworkStateUpdated struct { - IsNowOnline bool `json:"isNowOnline,omitempty"` + IsNowOnline bool `json:"isNowOnline"` } // EventTypes all event types in the domain. diff --git a/cdp/applicationcache/types.go b/cdp/applicationcache/types.go index 76b182d..c9fb75b 100644 --- a/cdp/applicationcache/types.go +++ b/cdp/applicationcache/types.go @@ -8,23 +8,23 @@ import ( // Resource detailed application cache resource information. type Resource struct { - URL string `json:"url,omitempty"` // Resource url. - Size int64 `json:"size,omitempty"` // Resource size. - Type string `json:"type,omitempty"` // Resource type. + URL string `json:"url"` // Resource url. + Size int64 `json:"size"` // Resource size. + Type string `json:"type"` // Resource type. } // ApplicationCache detailed application cache information. type ApplicationCache struct { - ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL. - Size float64 `json:"size,omitempty"` // Application cache size. - CreationTime float64 `json:"creationTime,omitempty"` // Application cache creation time. - UpdateTime float64 `json:"updateTime,omitempty"` // Application cache update time. - Resources []*Resource `json:"resources,omitempty"` // Application cache resources. + ManifestURL string `json:"manifestURL"` // Manifest URL. + Size float64 `json:"size"` // Application cache size. + CreationTime float64 `json:"creationTime"` // Application cache creation time. + UpdateTime float64 `json:"updateTime"` // Application cache update time. + Resources []*Resource `json:"resources"` // Application cache resources. } // FrameWithManifest frame identifier - manifest URL pair. type FrameWithManifest struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier. - ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL. - Status int64 `json:"status,omitempty"` // Application cache status. + FrameID cdp.FrameID `json:"frameId"` // Frame identifier. + ManifestURL string `json:"manifestURL"` // Manifest URL. + Status int64 `json:"status"` // Application cache status. } diff --git a/cdp/cachestorage/easyjson.go b/cdp/cachestorage/easyjson.go index aefb527..b42370f 100644 --- a/cdp/cachestorage/easyjson.go +++ b/cdp/cachestorage/easyjson.go @@ -584,30 +584,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.Request != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"request\":") - out.String(string(in.Request)) + if !first { + out.RawByte(',') } - if in.Response != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - out.String(string(in.Response)) + first = false + out.RawString("\"request\":") + out.String(string(in.Request)) + if !first { + out.RawByte(',') } - if in.ResponseTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"responseTime\":") - out.Float64(float64(in.ResponseTime)) + first = false + out.RawString("\"response\":") + out.String(string(in.Response)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"responseTime\":") + out.Float64(float64(in.ResponseTime)) out.RawByte('}') } @@ -673,30 +667,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.CacheID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"cacheId\":") - out.String(string(in.CacheID)) + if !first { + out.RawByte(',') } - if in.SecurityOrigin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityOrigin\":") - out.String(string(in.SecurityOrigin)) + first = false + out.RawString("\"cacheId\":") + out.String(string(in.CacheID)) + if !first { + out.RawByte(',') } - if in.CacheName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"cacheName\":") - out.String(string(in.CacheName)) + first = false + out.RawString("\"securityOrigin\":") + out.String(string(in.SecurityOrigin)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"cacheName\":") + out.String(string(in.CacheName)) out.RawByte('}') } diff --git a/cdp/cachestorage/types.go b/cdp/cachestorage/types.go index 6257c69..d57c6ed 100644 --- a/cdp/cachestorage/types.go +++ b/cdp/cachestorage/types.go @@ -12,14 +12,14 @@ func (t CacheID) String() string { // DataEntry data entry. type DataEntry struct { - Request string `json:"request,omitempty"` // Request url spec. - Response string `json:"response,omitempty"` // Response status text. - ResponseTime float64 `json:"responseTime,omitempty"` // Number of seconds since epoch. + Request string `json:"request"` // Request url spec. + Response string `json:"response"` // Response status text. + ResponseTime float64 `json:"responseTime"` // Number of seconds since epoch. } // Cache cache identifier. type Cache struct { - CacheID CacheID `json:"cacheId,omitempty"` // An opaque unique id of the cache. - SecurityOrigin string `json:"securityOrigin,omitempty"` // Security origin of the cache. - CacheName string `json:"cacheName,omitempty"` // The name of the cache. + CacheID CacheID `json:"cacheId"` // An opaque unique id of the cache. + SecurityOrigin string `json:"securityOrigin"` // Security origin of the cache. + CacheName string `json:"cacheName"` // The name of the cache. } diff --git a/cdp/cdp.go b/cdp/cdp.go index dd2dbbd..7499246 100644 --- a/cdp/cdp.go +++ b/cdp/cdp.go @@ -18,8 +18,8 @@ import ( // MessageError message error type. type MessageError struct { - Code int64 `json:"code,omitempty"` // Error code. - Message string `json:"message,omitempty"` // Error message. + Code int64 `json:"code"` // Error code. + Message string `json:"message"` // Error message. } // Error satisfies error interface. @@ -1443,16 +1443,16 @@ func (t *FrameID) UnmarshalJSON(buf []byte) error { // Frame information about the Frame on the page. type Frame struct { - ID FrameID `json:"id,omitempty"` // Frame unique identifier. - ParentID FrameID `json:"parentId,omitempty"` // Parent frame identifier. - LoaderID LoaderID `json:"loaderId,omitempty"` // Identifier of the loader associated with this frame. - Name string `json:"name,omitempty"` // Frame's name as specified in the tag. - URL string `json:"url,omitempty"` // Frame document's URL. - SecurityOrigin string `json:"securityOrigin,omitempty"` // Frame document's security origin. - MimeType string `json:"mimeType,omitempty"` // Frame document's mimeType as determined by the browser. - State FrameState `json:"-"` // Frame state. - Root *Node `json:"-"` // Frame document root. - Nodes map[NodeID]*Node `json:"-"` // Frame nodes. + ID FrameID `json:"id"` // Frame unique identifier. + ParentID FrameID `json:"parentId,omitempty"` // Parent frame identifier. + LoaderID LoaderID `json:"loaderId"` // Identifier of the loader associated with this frame. + Name string `json:"name,omitempty"` // Frame's name as specified in the tag. + URL string `json:"url"` // Frame document's URL. + SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin. + MimeType string `json:"mimeType"` // Frame document's mimeType as determined by the browser. + State FrameState `json:"-"` // Frame state. + Root *Node `json:"-"` // Frame document root. + Nodes map[NodeID]*Node `json:"-"` // Frame nodes. sync.RWMutex `json:"-"` // Read write mutex. } @@ -1591,9 +1591,9 @@ func (t *BackendNodeID) UnmarshalJSON(buf []byte) error { // BackendNode backend node with a friendly name. type BackendNode struct { - NodeType NodeType `json:"nodeType,omitempty"` // Node's nodeType. - NodeName string `json:"nodeName,omitempty"` // Node's nodeName. - BackendNodeID BackendNodeID `json:"backendNodeId,omitempty"` + NodeType NodeType `json:"nodeType"` // Node's nodeType. + NodeName string `json:"nodeName"` // Node's nodeName. + BackendNodeID BackendNodeID `json:"backendNodeId"` } // PseudoType pseudo element type. @@ -1725,13 +1725,13 @@ func (t *ShadowRootType) UnmarshalJSON(buf []byte) error { // Node dOM interaction is implemented in terms of mirror objects that // represent the actual DOM nodes. DOMNode is a base node mirror type. type Node struct { - NodeID NodeID `json:"nodeId,omitempty"` // Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client. + NodeID NodeID `json:"nodeId"` // Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client. ParentID NodeID `json:"parentId,omitempty"` // The id of the parent node if any. - BackendNodeID BackendNodeID `json:"backendNodeId,omitempty"` // The BackendNodeId for this node. - NodeType NodeType `json:"nodeType,omitempty"` // Node's nodeType. - NodeName string `json:"nodeName,omitempty"` // Node's nodeName. - LocalName string `json:"localName,omitempty"` // Node's localName. - NodeValue string `json:"nodeValue,omitempty"` // Node's nodeValue. + BackendNodeID BackendNodeID `json:"backendNodeId"` // The BackendNodeId for this node. + NodeType NodeType `json:"nodeType"` // Node's nodeType. + NodeName string `json:"nodeName"` // Node's nodeName. + LocalName string `json:"localName"` // Node's localName. + NodeValue string `json:"nodeValue"` // Node's nodeValue. ChildNodeCount int64 `json:"childNodeCount,omitempty"` // Child count for Container nodes. Children []*Node `json:"children,omitempty"` // Child nodes of this node when requested with children. Attributes []string `json:"attributes,omitempty"` // Attributes of the Element node in the form of flat array [name1, value1, name2, value2]. @@ -1875,9 +1875,9 @@ const EmptyNodeID = NodeID(0) // RGBA a structure holding an RGBA color. type RGBA struct { - R int64 `json:"r,omitempty"` // The red component, in the [0-255] range. - G int64 `json:"g,omitempty"` // The green component, in the [0-255] range. - B int64 `json:"b,omitempty"` // The blue component, in the [0-255] range. + R int64 `json:"r"` // The red component, in the [0-255] range. + G int64 `json:"g"` // The green component, in the [0-255] range. + B int64 `json:"b"` // The blue component, in the [0-255] range. A float64 `json:"a,omitempty"` // The alpha component, in the [0-1] range (default: 1). } diff --git a/cdp/css/easyjson.go b/cdp/css/easyjson.go index a6db9c2..738fd95 100644 --- a/cdp/css/easyjson.go +++ b/cdp/css/easyjson.go @@ -63,14 +63,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss(out *jwriter.Writer, in Va out.RawByte('{') first := true _ = first - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) if in.Range != nil { if !first { out.RawByte(',') @@ -340,30 +338,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss3(out *jwriter.Writer, in S out.RawByte('{') first := true _ = first - if in.StyleSheetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"styleSheetId\":") - out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + first = false + out.RawString("\"styleSheetId\":") + out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.SourceURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sourceURL\":") - out.String(string(in.SourceURL)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"sourceURL\":") + out.String(string(in.SourceURL)) if in.SourceMapURL != "" { if !first { out.RawByte(',') @@ -372,22 +364,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss3(out *jwriter.Writer, in S out.RawString("\"sourceMapURL\":") out.String(string(in.SourceMapURL)) } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - (in.Origin).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Title != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"title\":") - out.String(string(in.Title)) + first = false + out.RawString("\"origin\":") + (in.Origin).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"title\":") + out.String(string(in.Title)) if in.OwnerNode != 0 { if !first { out.RawByte(',') @@ -396,14 +384,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss3(out *jwriter.Writer, in S out.RawString("\"ownerNode\":") out.Int64(int64(in.OwnerNode)) } - if in.Disabled { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"disabled\":") - out.Bool(bool(in.Disabled)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"disabled\":") + out.Bool(bool(in.Disabled)) if in.HasSourceURL { if !first { out.RawByte(',') @@ -412,38 +398,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss3(out *jwriter.Writer, in S out.RawString("\"hasSourceURL\":") out.Bool(bool(in.HasSourceURL)) } - if in.IsInline { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isInline\":") - out.Bool(bool(in.IsInline)) + if !first { + out.RawByte(',') } - if in.StartLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startLine\":") - out.Float64(float64(in.StartLine)) + first = false + out.RawString("\"isInline\":") + out.Bool(bool(in.IsInline)) + if !first { + out.RawByte(',') } - if in.StartColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startColumn\":") - out.Float64(float64(in.StartColumn)) + first = false + out.RawString("\"startLine\":") + out.Float64(float64(in.StartLine)) + if !first { + out.RawByte(',') } - if in.Length != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"length\":") - out.Float64(float64(in.Length)) + first = false + out.RawString("\"startColumn\":") + out.Float64(float64(in.StartColumn)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"length\":") + out.Float64(float64(in.Length)) out.RawByte('}') } @@ -517,34 +495,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss4(out *jwriter.Writer, in S out.RawByte('{') first := true _ = first - if in.StyleSheetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"styleSheetId\":") - out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.Range != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"range\":") - if in.Range == nil { - out.RawString("null") - } else { - (*in.Range).MarshalEasyJSON(out) - } + first = false + out.RawString("\"styleSheetId\":") + out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + first = false + out.RawString("\"range\":") + if in.Range == nil { + out.RawString("null") + } else { + (*in.Range).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) out.RawByte('}') } @@ -688,51 +660,47 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss5(out *jwriter.Writer, in S out.RawString("\"styleSheetId\":") out.String(string(in.StyleSheetID)) } - if len(in.CSSProperties) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"cssProperties\":") - if in.CSSProperties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v6, v7 := range in.CSSProperties { - if v6 > 0 { - out.RawByte(',') - } - if v7 == nil { - out.RawString("null") - } else { - (*v7).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } + if !first { + out.RawByte(',') } - if len(in.ShorthandEntries) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"shorthandEntries\":") - if in.ShorthandEntries == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.ShorthandEntries { - if v8 > 0 { - out.RawByte(',') - } - if v9 == nil { - out.RawString("null") - } else { - (*v9).MarshalEasyJSON(out) - } + first = false + out.RawString("\"cssProperties\":") + if in.CSSProperties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v6, v7 := range in.CSSProperties { + if v6 > 0 { + out.RawByte(',') + } + if v7 == nil { + out.RawString("null") + } else { + (*v7).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"shorthandEntries\":") + if in.ShorthandEntries == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.ShorthandEntries { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + (*v9).MarshalEasyJSON(out) + } + } + out.RawByte(']') } if in.CSSText != "" { if !first { @@ -1052,38 +1020,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss9(out *jwriter.Writer, in S out.RawByte('{') first := true _ = first - if in.StartLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startLine\":") - out.Int64(int64(in.StartLine)) + if !first { + out.RawByte(',') } - if in.StartColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startColumn\":") - out.Int64(int64(in.StartColumn)) + first = false + out.RawString("\"startLine\":") + out.Int64(int64(in.StartLine)) + if !first { + out.RawByte(',') } - if in.EndLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endLine\":") - out.Int64(int64(in.EndLine)) + first = false + out.RawString("\"startColumn\":") + out.Int64(int64(in.StartColumn)) + if !first { + out.RawByte(',') } - if in.EndColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endColumn\":") - out.Int64(int64(in.EndColumn)) + first = false + out.RawString("\"endLine\":") + out.Int64(int64(in.EndLine)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"endColumn\":") + out.Int64(int64(in.EndColumn)) out.RawByte('}') } @@ -1149,22 +1109,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss10(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) if in.Important { if !first { out.RawByte(',') @@ -2244,37 +2200,33 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss22(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if len(in.Selectors) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"selectors\":") - if in.Selectors == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v20, v21 := range in.Selectors { - if v20 > 0 { - out.RawByte(',') - } - if v21 == nil { - out.RawString("null") - } else { - (*v21).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"selectors\":") + if in.Selectors == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v20, v21 := range in.Selectors { + if v20 > 0 { + out.RawByte(',') + } + if v21 == nil { + out.RawString("null") + } else { + (*v21).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) out.RawByte('}') } @@ -2342,38 +2294,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss23(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.StyleSheetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"styleSheetId\":") - out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.StartOffset != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startOffset\":") - out.Float64(float64(in.StartOffset)) + first = false + out.RawString("\"styleSheetId\":") + out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } - if in.EndOffset != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endOffset\":") - out.Float64(float64(in.EndOffset)) + first = false + out.RawString("\"startOffset\":") + out.Float64(float64(in.StartOffset)) + if !first { + out.RawByte(',') } - if in.Used { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"used\":") - out.Bool(bool(in.Used)) + first = false + out.RawString("\"endOffset\":") + out.Float64(float64(in.EndOffset)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"used\":") + out.Bool(bool(in.Used)) out.RawByte('}') } @@ -2466,36 +2410,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss24(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Rule != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"rule\":") - if in.Rule == nil { - out.RawString("null") - } else { - (*in.Rule).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if len(in.MatchingSelectors) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"matchingSelectors\":") - if in.MatchingSelectors == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v23, v24 := range in.MatchingSelectors { - if v23 > 0 { - out.RawByte(',') - } - out.Int64(int64(v24)) + first = false + out.RawString("\"rule\":") + if in.Rule == nil { + out.RawString("null") + } else { + (*in.Rule).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"matchingSelectors\":") + if in.MatchingSelectors == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v23, v24 := range in.MatchingSelectors { + if v23 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Int64(int64(v24)) } + out.RawByte(']') } out.RawByte('}') } @@ -2619,37 +2559,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss25(out *jwriter.Writer, in out.RawString("\"styleSheetId\":") out.String(string(in.StyleSheetID)) } - if in.SelectorList != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"selectorList\":") - if in.SelectorList == nil { - out.RawString("null") - } else { - (*in.SelectorList).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - (in.Origin).MarshalEasyJSON(out) + first = false + out.RawString("\"selectorList\":") + if in.SelectorList == nil { + out.RawString("null") + } else { + (*in.SelectorList).MarshalEasyJSON(out) } - if in.Style != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"style\":") - if in.Style == nil { - out.RawString("null") - } else { - (*in.Style).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"origin\":") + (in.Origin).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"style\":") + if in.Style == nil { + out.RawString("null") + } else { + (*in.Style).MarshalEasyJSON(out) } if len(in.Media) != 0 { if !first { @@ -2766,36 +2700,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss26(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.PseudoType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pseudoType\":") - (in.PseudoType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if len(in.Matches) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"matches\":") - if in.Matches == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v29, v30 := range in.Matches { - if v29 > 0 { - out.RawByte(',') - } - if v30 == nil { - out.RawString("null") - } else { - (*v30).MarshalEasyJSON(out) - } + first = false + out.RawString("\"pseudoType\":") + (in.PseudoType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"matches\":") + if in.Matches == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v29, v30 := range in.Matches { + if v29 > 0 { + out.RawByte(',') + } + if v30 == nil { + out.RawString("null") + } else { + (*v30).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -2880,22 +2810,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss27(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) if in.Important { if !first { out.RawByte(',') @@ -3013,30 +2939,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss28(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FamilyName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"familyName\":") - out.String(string(in.FamilyName)) + if !first { + out.RawByte(',') } - if in.IsCustomFont { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isCustomFont\":") - out.Bool(bool(in.IsCustomFont)) + first = false + out.RawString("\"familyName\":") + out.String(string(in.FamilyName)) + if !first { + out.RawByte(',') } - if in.GlyphCount != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"glyphCount\":") - out.Float64(float64(in.GlyphCount)) + first = false + out.RawString("\"isCustomFont\":") + out.Bool(bool(in.IsCustomFont)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"glyphCount\":") + out.Float64(float64(in.GlyphCount)) out.RawByte('}') } @@ -3114,30 +3034,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss29(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Value != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.Float64(float64(in.Value)) + if !first { + out.RawByte(',') } - if in.Unit != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"unit\":") - out.String(string(in.Unit)) + first = false + out.RawString("\"value\":") + out.Float64(float64(in.Value)) + if !first { + out.RawByte(',') } - if in.Feature != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"feature\":") - out.String(string(in.Feature)) + first = false + out.RawString("\"unit\":") + out.String(string(in.Unit)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"feature\":") + out.String(string(in.Feature)) if in.ValueRange != nil { if !first { out.RawByte(',') @@ -3250,37 +3164,33 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss30(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if len(in.Expressions) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"expressions\":") - if in.Expressions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v32, v33 := range in.Expressions { - if v32 > 0 { - out.RawByte(',') - } - if v33 == nil { - out.RawString("null") - } else { - (*v33).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"expressions\":") + if in.Expressions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v32, v33 := range in.Expressions { + if v32 > 0 { + out.RawByte(',') + } + if v33 == nil { + out.RawString("null") + } else { + (*v33).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.Active { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"active\":") - out.Bool(bool(in.Active)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"active\":") + out.Bool(bool(in.Active)) out.RawByte('}') } @@ -3389,22 +3299,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss31(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + if !first { + out.RawByte(',') } - if in.Source != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"source\":") - (in.Source).MarshalEasyJSON(out) + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"source\":") + (in.Source).MarshalEasyJSON(out) if in.SourceURL != "" { if !first { out.RawByte(',') @@ -3556,40 +3462,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss32(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.AnimationName != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"animationName\":") - if in.AnimationName == nil { - out.RawString("null") - } else { - (*in.AnimationName).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if len(in.Keyframes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyframes\":") - if in.Keyframes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v38, v39 := range in.Keyframes { - if v38 > 0 { - out.RawByte(',') - } - if v39 == nil { - out.RawString("null") - } else { - (*v39).MarshalEasyJSON(out) - } + first = false + out.RawString("\"animationName\":") + if in.AnimationName == nil { + out.RawString("null") + } else { + (*in.AnimationName).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"keyframes\":") + if in.Keyframes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v38, v39 := range in.Keyframes { + if v38 > 0 { + out.RawByte(',') + } + if v39 == nil { + out.RawString("null") + } else { + (*v39).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -3682,37 +3584,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss33(out *jwriter.Writer, in out.RawString("\"styleSheetId\":") out.String(string(in.StyleSheetID)) } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - (in.Origin).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.KeyText != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyText\":") - if in.KeyText == nil { - out.RawString("null") - } else { - (*in.KeyText).MarshalEasyJSON(out) - } + first = false + out.RawString("\"origin\":") + (in.Origin).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Style != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"style\":") - if in.Style == nil { - out.RawString("null") - } else { - (*in.Style).MarshalEasyJSON(out) - } + first = false + out.RawString("\"keyText\":") + if in.KeyText == nil { + out.RawString("null") + } else { + (*in.KeyText).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"style\":") + if in.Style == nil { + out.RawString("null") + } else { + (*in.Style).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3787,34 +3683,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss34(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.BoundingBox != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"boundingBox\":") - if in.BoundingBox == nil { - out.RawString("null") - } else { - (*in.BoundingBox).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.StartCharacterIndex != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startCharacterIndex\":") - out.Int64(int64(in.StartCharacterIndex)) + first = false + out.RawString("\"boundingBox\":") + if in.BoundingBox == nil { + out.RawString("null") + } else { + (*in.BoundingBox).MarshalEasyJSON(out) } - if in.NumCharacters != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"numCharacters\":") - out.Int64(int64(in.NumCharacters)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"startCharacterIndex\":") + out.Int64(int64(in.StartCharacterIndex)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"numCharacters\":") + out.Int64(int64(in.NumCharacters)) out.RawByte('}') } @@ -3927,28 +3817,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss35(out *jwriter.Writer, in (*in.InlineStyle).MarshalEasyJSON(out) } } - if len(in.MatchedCSSRules) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"matchedCSSRules\":") - if in.MatchedCSSRules == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v41, v42 := range in.MatchedCSSRules { - if v41 > 0 { - out.RawByte(',') - } - if v42 == nil { - out.RawString("null") - } else { - (*v42).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"matchedCSSRules\":") + if in.MatchedCSSRules == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v41, v42 := range in.MatchedCSSRules { + if v41 > 0 { + out.RawByte(',') + } + if v42 == nil { + out.RawString("null") + } else { + (*v42).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -5510,14 +5398,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss51(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.StyleSheetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"styleSheetId\":") - out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"styleSheetId\":") + out.String(string(in.StyleSheetID)) out.RawByte('}') } @@ -5579,14 +5465,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss52(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.StyleSheetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"styleSheetId\":") - out.String(string(in.StyleSheetID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"styleSheetId\":") + out.String(string(in.StyleSheetID)) out.RawByte('}') } @@ -5656,17 +5540,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss53(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Header != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"header\":") - if in.Header == nil { - out.RawString("null") - } else { - (*in.Header).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"header\":") + if in.Header == nil { + out.RawString("null") + } else { + (*in.Header).MarshalEasyJSON(out) } out.RawByte('}') } @@ -6103,22 +5985,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss60(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) out.RawByte('}') } diff --git a/cdp/css/events.go b/cdp/css/events.go index ca9fbc7..78819aa 100644 --- a/cdp/css/events.go +++ b/cdp/css/events.go @@ -17,19 +17,19 @@ type EventFontsUpdated struct{} // EventStyleSheetChanged fired whenever a stylesheet is changed as a result // of the client operation. type EventStyleSheetChanged struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` + StyleSheetID StyleSheetID `json:"styleSheetId"` } // EventStyleSheetAdded fired whenever an active document stylesheet is // added. type EventStyleSheetAdded struct { - Header *StyleSheetHeader `json:"header,omitempty"` // Added stylesheet metainfo. + Header *StyleSheetHeader `json:"header"` // Added stylesheet metainfo. } // EventStyleSheetRemoved fired whenever an active document stylesheet is // removed. type EventStyleSheetRemoved struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the removed stylesheet. + StyleSheetID StyleSheetID `json:"styleSheetId"` // Identifier of the removed stylesheet. } // EventTypes all event types in the domain. diff --git a/cdp/css/types.go b/cdp/css/types.go index c8159c7..75b64a2 100644 --- a/cdp/css/types.go +++ b/cdp/css/types.go @@ -73,103 +73,103 @@ func (t *StyleSheetOrigin) UnmarshalJSON(buf []byte) error { // PseudoElementMatches cSS rule collection for a single pseudo style. type PseudoElementMatches struct { - PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Pseudo element type. - Matches []*RuleMatch `json:"matches,omitempty"` // Matches of CSS rules applicable to the pseudo style. + PseudoType cdp.PseudoType `json:"pseudoType"` // Pseudo element type. + Matches []*RuleMatch `json:"matches"` // Matches of CSS rules applicable to the pseudo style. } // InheritedStyleEntry inherited CSS rule collection from ancestor node. type InheritedStyleEntry struct { - InlineStyle *Style `json:"inlineStyle,omitempty"` // The ancestor node's inline style, if any, in the style inheritance chain. - MatchedCSSRules []*RuleMatch `json:"matchedCSSRules,omitempty"` // Matches of CSS rules matching the ancestor node in the style inheritance chain. + InlineStyle *Style `json:"inlineStyle,omitempty"` // The ancestor node's inline style, if any, in the style inheritance chain. + MatchedCSSRules []*RuleMatch `json:"matchedCSSRules"` // Matches of CSS rules matching the ancestor node in the style inheritance chain. } // RuleMatch match data for a CSS rule. type RuleMatch struct { - Rule *Rule `json:"rule,omitempty"` // CSS rule in the match. - MatchingSelectors []int64 `json:"matchingSelectors,omitempty"` // Matching selector indices in the rule's selectorList selectors (0-based). + Rule *Rule `json:"rule"` // CSS rule in the match. + MatchingSelectors []int64 `json:"matchingSelectors"` // Matching selector indices in the rule's selectorList selectors (0-based). } // Value data for a simple selector (these are delimited by commas in a // selector list). type Value struct { - Text string `json:"text,omitempty"` // Value text. + Text string `json:"text"` // Value text. Range *SourceRange `json:"range,omitempty"` // Value range in the underlying resource (if available). } // SelectorList selector list data. type SelectorList struct { - Selectors []*Value `json:"selectors,omitempty"` // Selectors in the list. - Text string `json:"text,omitempty"` // Rule selector text. + Selectors []*Value `json:"selectors"` // Selectors in the list. + Text string `json:"text"` // Rule selector text. } // StyleSheetHeader cSS stylesheet metainformation. type StyleSheetHeader struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The stylesheet identifier. - FrameID cdp.FrameID `json:"frameId,omitempty"` // Owner frame identifier. - SourceURL string `json:"sourceURL,omitempty"` // Stylesheet resource URL. + StyleSheetID StyleSheetID `json:"styleSheetId"` // The stylesheet identifier. + FrameID cdp.FrameID `json:"frameId"` // Owner frame identifier. + SourceURL string `json:"sourceURL"` // Stylesheet resource URL. SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with the stylesheet (if any). - Origin StyleSheetOrigin `json:"origin,omitempty"` // Stylesheet origin. - Title string `json:"title,omitempty"` // Stylesheet title. + Origin StyleSheetOrigin `json:"origin"` // Stylesheet origin. + Title string `json:"title"` // Stylesheet title. OwnerNode cdp.BackendNodeID `json:"ownerNode,omitempty"` // The backend id for the owner node of the stylesheet. - Disabled bool `json:"disabled,omitempty"` // Denotes whether the stylesheet is disabled. + Disabled bool `json:"disabled"` // Denotes whether the stylesheet is disabled. HasSourceURL bool `json:"hasSourceURL,omitempty"` // Whether the sourceURL field value comes from the sourceURL comment. - IsInline bool `json:"isInline,omitempty"` // Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags. - StartLine float64 `json:"startLine,omitempty"` // Line offset of the stylesheet within the resource (zero based). - StartColumn float64 `json:"startColumn,omitempty"` // Column offset of the stylesheet within the resource (zero based). - Length float64 `json:"length,omitempty"` // Size of the content (in characters). + IsInline bool `json:"isInline"` // Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags. + StartLine float64 `json:"startLine"` // Line offset of the stylesheet within the resource (zero based). + StartColumn float64 `json:"startColumn"` // Column offset of the stylesheet within the resource (zero based). + Length float64 `json:"length"` // Size of the content (in characters). } // Rule cSS rule representation. type Rule struct { StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. - SelectorList *SelectorList `json:"selectorList,omitempty"` // Rule selector data. - Origin StyleSheetOrigin `json:"origin,omitempty"` // Parent stylesheet's origin. - Style *Style `json:"style,omitempty"` // Associated style declaration. + SelectorList *SelectorList `json:"selectorList"` // Rule selector data. + Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin. + Style *Style `json:"style"` // Associated style declaration. Media []*Media `json:"media,omitempty"` // Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards. } // RuleUsage cSS coverage information. type RuleUsage struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. - StartOffset float64 `json:"startOffset,omitempty"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet. - EndOffset float64 `json:"endOffset,omitempty"` // Offset of the end of the rule body from the beginning of the stylesheet. - Used bool `json:"used,omitempty"` // Indicates whether the rule was actually used by some element in the page. + StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. + StartOffset float64 `json:"startOffset"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet. + EndOffset float64 `json:"endOffset"` // Offset of the end of the rule body from the beginning of the stylesheet. + Used bool `json:"used"` // Indicates whether the rule was actually used by some element in the page. } // SourceRange text range within a resource. All numbers are zero-based. type SourceRange struct { - StartLine int64 `json:"startLine,omitempty"` // Start line of range. - StartColumn int64 `json:"startColumn,omitempty"` // Start column of range (inclusive). - EndLine int64 `json:"endLine,omitempty"` // End line of range - EndColumn int64 `json:"endColumn,omitempty"` // End column of range (exclusive). + StartLine int64 `json:"startLine"` // Start line of range. + StartColumn int64 `json:"startColumn"` // Start column of range (inclusive). + EndLine int64 `json:"endLine"` // End line of range + EndColumn int64 `json:"endColumn"` // End column of range (exclusive). } // ShorthandEntry [no description]. type ShorthandEntry struct { - Name string `json:"name,omitempty"` // Shorthand name. - Value string `json:"value,omitempty"` // Shorthand value. + Name string `json:"name"` // Shorthand name. + Value string `json:"value"` // Shorthand value. Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent). } // ComputedProperty [no description]. type ComputedProperty struct { - Name string `json:"name,omitempty"` // Computed style property name. - Value string `json:"value,omitempty"` // Computed style property value. + Name string `json:"name"` // Computed style property name. + Value string `json:"value"` // Computed style property value. } // Style cSS style representation. type Style struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. - CSSProperties []*Property `json:"cssProperties,omitempty"` // CSS properties in the style. - ShorthandEntries []*ShorthandEntry `json:"shorthandEntries,omitempty"` // Computed values for all shorthands found in the style. - CSSText string `json:"cssText,omitempty"` // Style declaration text (if available). - Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available). + StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. + CSSProperties []*Property `json:"cssProperties"` // CSS properties in the style. + ShorthandEntries []*ShorthandEntry `json:"shorthandEntries"` // Computed values for all shorthands found in the style. + CSSText string `json:"cssText,omitempty"` // Style declaration text (if available). + Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available). } // Property cSS property declaration data. type Property struct { - Name string `json:"name,omitempty"` // The property name. - Value string `json:"value,omitempty"` // The property value. + Name string `json:"name"` // The property name. + Value string `json:"value"` // The property value. Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent). Implicit bool `json:"implicit,omitempty"` // Whether the property is implicit (implies false if absent). Text string `json:"text,omitempty"` // The full property text as specified in the style. @@ -180,8 +180,8 @@ type Property struct { // Media cSS media rule descriptor. type Media struct { - Text string `json:"text,omitempty"` // Media query text. - Source MediaSource `json:"source,omitempty"` // Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline stylesheet's STYLE tag. + Text string `json:"text"` // Media query text. + Source MediaSource `json:"source"` // Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline stylesheet's STYLE tag. SourceURL string `json:"sourceURL,omitempty"` // URL of the document containing the media query description. Range *SourceRange `json:"range,omitempty"` // The associated rule (@media or @import) header range in the enclosing stylesheet (if available). StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the stylesheet containing this object (if exists). @@ -190,15 +190,15 @@ type Media struct { // MediaQuery media query descriptor. type MediaQuery struct { - Expressions []*MediaQueryExpression `json:"expressions,omitempty"` // Array of media query expressions. - Active bool `json:"active,omitempty"` // Whether the media query condition is satisfied. + Expressions []*MediaQueryExpression `json:"expressions"` // Array of media query expressions. + Active bool `json:"active"` // Whether the media query condition is satisfied. } // MediaQueryExpression media query expression descriptor. type MediaQueryExpression struct { - Value float64 `json:"value,omitempty"` // Media query expression value. - Unit string `json:"unit,omitempty"` // Media query expression units. - Feature string `json:"feature,omitempty"` // Media query expression feature. + Value float64 `json:"value"` // Media query expression value. + Unit string `json:"unit"` // Media query expression units. + Feature string `json:"feature"` // Media query expression feature. ValueRange *SourceRange `json:"valueRange,omitempty"` // The associated range of the value text in the enclosing stylesheet (if available). ComputedLength float64 `json:"computedLength,omitempty"` // Computed length of media query expression (if applicable). } @@ -206,39 +206,39 @@ type MediaQueryExpression struct { // PlatformFontUsage information about amount of glyphs that were rendered // with given font. type PlatformFontUsage struct { - FamilyName string `json:"familyName,omitempty"` // Font's family name reported by platform. - IsCustomFont bool `json:"isCustomFont,omitempty"` // Indicates if the font was downloaded or resolved locally. - GlyphCount float64 `json:"glyphCount,omitempty"` // Amount of glyphs that were rendered with this font. + FamilyName string `json:"familyName"` // Font's family name reported by platform. + IsCustomFont bool `json:"isCustomFont"` // Indicates if the font was downloaded or resolved locally. + GlyphCount float64 `json:"glyphCount"` // Amount of glyphs that were rendered with this font. } // KeyframesRule cSS keyframes rule representation. type KeyframesRule struct { - AnimationName *Value `json:"animationName,omitempty"` // Animation name. - Keyframes []*KeyframeRule `json:"keyframes,omitempty"` // List of keyframes. + AnimationName *Value `json:"animationName"` // Animation name. + Keyframes []*KeyframeRule `json:"keyframes"` // List of keyframes. } // KeyframeRule cSS keyframe rule representation. type KeyframeRule struct { StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. - Origin StyleSheetOrigin `json:"origin,omitempty"` // Parent stylesheet's origin. - KeyText *Value `json:"keyText,omitempty"` // Associated key text. - Style *Style `json:"style,omitempty"` // Associated style declaration. + Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin. + KeyText *Value `json:"keyText"` // Associated key text. + Style *Style `json:"style"` // Associated style declaration. } // StyleDeclarationEdit a descriptor of operation to mutate style declaration // text. type StyleDeclarationEdit struct { - StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier. - Range *SourceRange `json:"range,omitempty"` // The range of the style text in the enclosing stylesheet. - Text string `json:"text,omitempty"` // New style text. + StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier. + Range *SourceRange `json:"range"` // The range of the style text in the enclosing stylesheet. + Text string `json:"text"` // New style text. } // InlineTextBox details of post layout rendered text positions. The exact // layout should not be regarded as stable and may change between versions. type InlineTextBox struct { - BoundingBox *dom.Rect `json:"boundingBox,omitempty"` // The absolute position bounding box. - StartCharacterIndex int64 `json:"startCharacterIndex,omitempty"` // The starting index in characters, for this post layout textbox substring. - NumCharacters int64 `json:"numCharacters,omitempty"` // The number of characters in this post layout textbox substring. + BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box. + StartCharacterIndex int64 `json:"startCharacterIndex"` // The starting index in characters, for this post layout textbox substring. + NumCharacters int64 `json:"numCharacters"` // The number of characters in this post layout textbox substring. } // MediaSource source of the media query: "mediaRule" if specified by a diff --git a/cdp/database/easyjson.go b/cdp/database/easyjson.go index a99468b..29982f3 100644 --- a/cdp/database/easyjson.go +++ b/cdp/database/easyjson.go @@ -468,17 +468,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Database != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"database\":") - if in.Database == nil { - out.RawString("null") - } else { - (*in.Database).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"database\":") + if in.Database == nil { + out.RawString("null") + } else { + (*in.Database).MarshalEasyJSON(out) } out.RawByte('}') } @@ -543,22 +541,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Message != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"message\":") - out.String(string(in.Message)) + if !first { + out.RawByte(',') } - if in.Code != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"code\":") - out.Int64(int64(in.Code)) + first = false + out.RawString("\"message\":") + out.String(string(in.Message)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"code\":") + out.Int64(int64(in.Code)) out.RawByte('}') } @@ -744,38 +738,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Domain != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"domain\":") - out.String(string(in.Domain)) + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + first = false + out.RawString("\"domain\":") + out.String(string(in.Domain)) + if !first { + out.RawByte(',') } - if in.Version != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"version\":") - out.String(string(in.Version)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"version\":") + out.String(string(in.Version)) out.RawByte('}') } diff --git a/cdp/database/events.go b/cdp/database/events.go index c9bd7f3..2d6e373 100644 --- a/cdp/database/events.go +++ b/cdp/database/events.go @@ -8,7 +8,7 @@ import ( // EventAddDatabase [no description]. type EventAddDatabase struct { - Database *Database `json:"database,omitempty"` + Database *Database `json:"database"` } // EventTypes all event types in the domain. diff --git a/cdp/database/types.go b/cdp/database/types.go index 81eee5b..cae87a6 100644 --- a/cdp/database/types.go +++ b/cdp/database/types.go @@ -12,14 +12,14 @@ func (t ID) String() string { // Database database object. type Database struct { - ID ID `json:"id,omitempty"` // Database ID. - Domain string `json:"domain,omitempty"` // Database domain. - Name string `json:"name,omitempty"` // Database name. - Version string `json:"version,omitempty"` // Database version. + ID ID `json:"id"` // Database ID. + Domain string `json:"domain"` // Database domain. + Name string `json:"name"` // Database name. + Version string `json:"version"` // Database version. } // Error database error. type Error struct { - Message string `json:"message,omitempty"` // Error message. - Code int64 `json:"code,omitempty"` // Error code. + Message string `json:"message"` // Error message. + Code int64 `json:"code"` // Error code. } diff --git a/cdp/debugger/easyjson.go b/cdp/debugger/easyjson.go index bb4586a..c295319 100644 --- a/cdp/debugger/easyjson.go +++ b/cdp/debugger/easyjson.go @@ -1483,22 +1483,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger16(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Float64(float64(in.LineNumber)) + if !first { + out.RawByte(',') } - if in.LineContent != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineContent\":") - out.String(string(in.LineContent)) + first = false + out.RawString("\"lineNumber\":") + out.Float64(float64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"lineContent\":") + out.String(string(in.LineContent)) out.RawByte('}') } @@ -1770,22 +1766,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger19(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } - if in.ColumnNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"columnNumber\":") - out.Int64(int64(in.ColumnNumber)) + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"columnNumber\":") + out.Int64(int64(in.ColumnNumber)) out.RawByte('}') } @@ -1879,25 +1871,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger20(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Object != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"object\":") - if in.Object == nil { - out.RawString("null") - } else { - (*in.Object).MarshalEasyJSON(out) - } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"object\":") + if in.Object == nil { + out.RawString("null") + } else { + (*in.Object).MarshalEasyJSON(out) } if in.Name != "" { if !first { @@ -2442,22 +2430,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger27(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) if in.ColumnNumber != 0 { if !first { out.RawByte(',') @@ -2923,70 +2907,54 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger32(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.StartLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startLine\":") - out.Int64(int64(in.StartLine)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.StartColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startColumn\":") - out.Int64(int64(in.StartColumn)) + first = false + out.RawString("\"startLine\":") + out.Int64(int64(in.StartLine)) + if !first { + out.RawByte(',') } - if in.EndLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endLine\":") - out.Int64(int64(in.EndLine)) + first = false + out.RawString("\"startColumn\":") + out.Int64(int64(in.StartColumn)) + if !first { + out.RawByte(',') } - if in.EndColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endColumn\":") - out.Int64(int64(in.EndColumn)) + first = false + out.RawString("\"endLine\":") + out.Int64(int64(in.EndLine)) + if !first { + out.RawByte(',') } - if in.ExecutionContextID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"executionContextId\":") - out.Int64(int64(in.ExecutionContextID)) + first = false + out.RawString("\"endColumn\":") + out.Int64(int64(in.EndColumn)) + if !first { + out.RawByte(',') } - if in.Hash != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hash\":") - out.String(string(in.Hash)) + first = false + out.RawString("\"executionContextId\":") + out.Int64(int64(in.ExecutionContextID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"hash\":") + out.String(string(in.Hash)) if (in.ExecutionContextAuxData).IsDefined() { if !first { out.RawByte(',') @@ -3142,70 +3110,54 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger33(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.StartLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startLine\":") - out.Int64(int64(in.StartLine)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.StartColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startColumn\":") - out.Int64(int64(in.StartColumn)) + first = false + out.RawString("\"startLine\":") + out.Int64(int64(in.StartLine)) + if !first { + out.RawByte(',') } - if in.EndLine != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endLine\":") - out.Int64(int64(in.EndLine)) + first = false + out.RawString("\"startColumn\":") + out.Int64(int64(in.StartColumn)) + if !first { + out.RawByte(',') } - if in.EndColumn != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endColumn\":") - out.Int64(int64(in.EndColumn)) + first = false + out.RawString("\"endLine\":") + out.Int64(int64(in.EndLine)) + if !first { + out.RawByte(',') } - if in.ExecutionContextID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"executionContextId\":") - out.Int64(int64(in.ExecutionContextID)) + first = false + out.RawString("\"endColumn\":") + out.Int64(int64(in.EndColumn)) + if !first { + out.RawByte(',') } - if in.Hash != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hash\":") - out.String(string(in.Hash)) + first = false + out.RawString("\"executionContextId\":") + out.Int64(int64(in.ExecutionContextID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"hash\":") + out.String(string(in.Hash)) if (in.ExecutionContextAuxData).IsDefined() { if !first { out.RawByte(',') @@ -3444,37 +3396,33 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger35(out *jwriter.Writer out.RawByte('{') first := true _ = first - if len(in.CallFrames) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"callFrames\":") - if in.CallFrames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v24, v25 := range in.CallFrames { - if v24 > 0 { - out.RawByte(',') - } - if v25 == nil { - out.RawString("null") - } else { - (*v25).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"callFrames\":") + if in.CallFrames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v24, v25 := range in.CallFrames { + if v24 > 0 { + out.RawByte(',') + } + if v25 == nil { + out.RawString("null") + } else { + (*v25).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.Reason != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"reason\":") - (in.Reason).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"reason\":") + (in.Reason).MarshalEasyJSON(out) if (in.Data).IsDefined() { if !first { out.RawByte(',') @@ -3585,25 +3533,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger36(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.BreakpointID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"breakpointId\":") - out.String(string(in.BreakpointID)) + if !first { + out.RawByte(',') } - if in.Location != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"location\":") - if in.Location == nil { - out.RawString("null") - } else { - (*in.Location).MarshalEasyJSON(out) - } + first = false + out.RawString("\"breakpointId\":") + out.String(string(in.BreakpointID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"location\":") + if in.Location == nil { + out.RawString("null") + } else { + (*in.Location).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4184,22 +4128,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger42(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.CallFrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"callFrameId\":") - out.String(string(in.CallFrameID)) + if !first { + out.RawByte(',') } - if in.FunctionName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"functionName\":") - out.String(string(in.FunctionName)) + first = false + out.RawString("\"callFrameId\":") + out.String(string(in.CallFrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"functionName\":") + out.String(string(in.FunctionName)) if in.FunctionLocation != nil { if !first { out.RawByte(',') @@ -4212,52 +4152,46 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger42(out *jwriter.Writer (*in.FunctionLocation).MarshalEasyJSON(out) } } - if in.Location != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"location\":") - if in.Location == nil { - out.RawString("null") - } else { - (*in.Location).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if len(in.ScopeChain) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scopeChain\":") - if in.ScopeChain == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v29, v30 := range in.ScopeChain { - if v29 > 0 { - out.RawByte(',') - } - if v30 == nil { - out.RawString("null") - } else { - (*v30).MarshalEasyJSON(out) - } + first = false + out.RawString("\"location\":") + if in.Location == nil { + out.RawString("null") + } else { + (*in.Location).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"scopeChain\":") + if in.ScopeChain == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v29, v30 := range in.ScopeChain { + if v29 > 0 { + out.RawByte(',') + } + if v30 == nil { + out.RawString("null") + } else { + (*v30).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.This != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"this\":") - if in.This == nil { - out.RawString("null") - } else { - (*in.This).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"this\":") + if in.This == nil { + out.RawString("null") + } else { + (*in.This).MarshalEasyJSON(out) } if in.ReturnValue != nil { if !first { @@ -4338,22 +4272,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger43(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) if in.ColumnNumber != 0 { if !first { out.RawByte(',') diff --git a/cdp/debugger/events.go b/cdp/debugger/events.go index 169637b..8d8b0b9 100644 --- a/cdp/debugger/events.go +++ b/cdp/debugger/events.go @@ -11,14 +11,14 @@ import ( // EventScriptParsed fired when virtual machine parses script. This event is // also fired for all known and uncollected scripts upon enabling debugger. type EventScriptParsed struct { - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Identifier of the script parsed. - URL string `json:"url,omitempty"` // URL or name of the script parsed (if any). - StartLine int64 `json:"startLine,omitempty"` // Line offset of the script within the resource with given URL (for script tags). - StartColumn int64 `json:"startColumn,omitempty"` // Column offset of the script within the resource with given URL. - EndLine int64 `json:"endLine,omitempty"` // Last line of the script. - EndColumn int64 `json:"endColumn,omitempty"` // Length of the last line of the script. - ExecutionContextID runtime.ExecutionContextID `json:"executionContextId,omitempty"` // Specifies script creation context. - Hash string `json:"hash,omitempty"` // Content hash of the script. + ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed. + URL string `json:"url"` // URL or name of the script parsed (if any). + StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags). + StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL. + EndLine int64 `json:"endLine"` // Last line of the script. + EndColumn int64 `json:"endColumn"` // Length of the last line of the script. + ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context. + Hash string `json:"hash"` // Content hash of the script. ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"` IsLiveEdit bool `json:"isLiveEdit,omitempty"` // True, if this script is generated as a result of the live edit operation. SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any). @@ -31,14 +31,14 @@ type EventScriptParsed struct { // EventScriptFailedToParse fired when virtual machine fails to parse the // script. type EventScriptFailedToParse struct { - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Identifier of the script parsed. - URL string `json:"url,omitempty"` // URL or name of the script parsed (if any). - StartLine int64 `json:"startLine,omitempty"` // Line offset of the script within the resource with given URL (for script tags). - StartColumn int64 `json:"startColumn,omitempty"` // Column offset of the script within the resource with given URL. - EndLine int64 `json:"endLine,omitempty"` // Last line of the script. - EndColumn int64 `json:"endColumn,omitempty"` // Length of the last line of the script. - ExecutionContextID runtime.ExecutionContextID `json:"executionContextId,omitempty"` // Specifies script creation context. - Hash string `json:"hash,omitempty"` // Content hash of the script. + ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed. + URL string `json:"url"` // URL or name of the script parsed (if any). + StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags). + StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL. + EndLine int64 `json:"endLine"` // Last line of the script. + EndColumn int64 `json:"endColumn"` // Length of the last line of the script. + ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context. + Hash string `json:"hash"` // Content hash of the script. ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"` SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any). HasSourceURL bool `json:"hasSourceURL,omitempty"` // True, if this script has sourceURL. @@ -50,15 +50,15 @@ type EventScriptFailedToParse struct { // EventBreakpointResolved fired when breakpoint is resolved to an actual // script and location. type EventBreakpointResolved struct { - BreakpointID BreakpointID `json:"breakpointId,omitempty"` // Breakpoint unique identifier. - Location *Location `json:"location,omitempty"` // Actual breakpoint location. + BreakpointID BreakpointID `json:"breakpointId"` // Breakpoint unique identifier. + Location *Location `json:"location"` // Actual breakpoint location. } // EventPaused fired when the virtual machine stopped on breakpoint or // exception or any other stop criteria. type EventPaused struct { - CallFrames []*CallFrame `json:"callFrames,omitempty"` // Call stack the virtual machine stopped on. - Reason PausedReason `json:"reason,omitempty"` // Pause reason. + CallFrames []*CallFrame `json:"callFrames"` // Call stack the virtual machine stopped on. + Reason PausedReason `json:"reason"` // Pause reason. Data easyjson.RawMessage `json:"data,omitempty"` HitBreakpoints []string `json:"hitBreakpoints,omitempty"` // Hit breakpoints IDs AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any. diff --git a/cdp/debugger/types.go b/cdp/debugger/types.go index b8191a0..279f4b1 100644 --- a/cdp/debugger/types.go +++ b/cdp/debugger/types.go @@ -29,32 +29,32 @@ func (t CallFrameID) String() string { // Location location in the source code. type Location struct { - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Script identifier as reported in the Debugger.scriptParsed. - LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the script (0-based). + ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed. + LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based). ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based). } // ScriptPosition location in the source code. type ScriptPosition struct { - LineNumber int64 `json:"lineNumber,omitempty"` - ColumnNumber int64 `json:"columnNumber,omitempty"` + LineNumber int64 `json:"lineNumber"` + ColumnNumber int64 `json:"columnNumber"` } // CallFrame javaScript call frame. Array of call frames form the call stack. type CallFrame struct { - CallFrameID CallFrameID `json:"callFrameId,omitempty"` // Call frame identifier. This identifier is only valid while the virtual machine is paused. - FunctionName string `json:"functionName,omitempty"` // Name of the JavaScript function called on this call frame. + CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier. This identifier is only valid while the virtual machine is paused. + FunctionName string `json:"functionName"` // Name of the JavaScript function called on this call frame. FunctionLocation *Location `json:"functionLocation,omitempty"` // Location in the source code. - Location *Location `json:"location,omitempty"` // Location in the source code. - ScopeChain []*Scope `json:"scopeChain,omitempty"` // Scope chain for this call frame. - This *runtime.RemoteObject `json:"this,omitempty"` // this object for this call frame. + Location *Location `json:"location"` // Location in the source code. + ScopeChain []*Scope `json:"scopeChain"` // Scope chain for this call frame. + This *runtime.RemoteObject `json:"this"` // this object for this call frame. ReturnValue *runtime.RemoteObject `json:"returnValue,omitempty"` // The value being returned, if the function is at return point. } // Scope scope description. type Scope struct { - Type ScopeType `json:"type,omitempty"` // Scope type. - Object *runtime.RemoteObject `json:"object,omitempty"` // Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. + Type ScopeType `json:"type"` // Scope type. + Object *runtime.RemoteObject `json:"object"` // Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. Name string `json:"name,omitempty"` StartLocation *Location `json:"startLocation,omitempty"` // Location in the source code where scope starts EndLocation *Location `json:"endLocation,omitempty"` // Location in the source code where scope ends @@ -62,14 +62,14 @@ type Scope struct { // SearchMatch search match for resource. type SearchMatch struct { - LineNumber float64 `json:"lineNumber,omitempty"` // Line number in resource content. - LineContent string `json:"lineContent,omitempty"` // Line with match content. + LineNumber float64 `json:"lineNumber"` // Line number in resource content. + LineContent string `json:"lineContent"` // Line with match content. } // BreakLocation [no description]. type BreakLocation struct { - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Script identifier as reported in the Debugger.scriptParsed. - LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the script (0-based). + ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed. + LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based). ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based). Type BreakLocationType `json:"type,omitempty"` } diff --git a/cdp/dom/easyjson.go b/cdp/dom/easyjson.go index aaadeb4..aa6e642 100644 --- a/cdp/dom/easyjson.go +++ b/cdp/dom/easyjson.go @@ -180,62 +180,56 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom1(out *jwriter.Writer, in S out.RawByte('{') first := true _ = first - if len(in.Bounds) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"bounds\":") - if in.Bounds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v4, v5 := range in.Bounds { - if v4 > 0 { - out.RawByte(',') - } - out.Float64(float64(v5)) - } - out.RawByte(']') - } + if !first { + out.RawByte(',') } - if len(in.Shape) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"shape\":") - if in.Shape == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v6, v7 := range in.Shape { - if v6 > 0 { - out.RawByte(',') - } - (v7).MarshalEasyJSON(out) + first = false + out.RawString("\"bounds\":") + if in.Bounds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v4, v5 := range in.Bounds { + if v4 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Float64(float64(v5)) } + out.RawByte(']') } - if len(in.MarginShape) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"marginShape\":") - if in.MarginShape == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.MarginShape { - if v8 > 0 { - out.RawByte(',') - } - (v9).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"shape\":") + if in.Shape == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v6, v7 := range in.Shape { + if v6 > 0 { + out.RawByte(',') } - out.RawByte(']') + (v7).MarshalEasyJSON(out) } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"marginShape\":") + if in.MarginShape == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.MarginShape { + if v8 > 0 { + out.RawByte(',') + } + (v9).MarshalEasyJSON(out) + } + out.RawByte(']') } out.RawByte('}') } @@ -1522,38 +1516,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom18(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.X != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"x\":") - out.Float64(float64(in.X)) + if !first { + out.RawByte(',') } - if in.Y != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"y\":") - out.Float64(float64(in.Y)) + first = false + out.RawString("\"x\":") + out.Float64(float64(in.X)) + if !first { + out.RawByte(',') } - if in.Width != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"width\":") - out.Float64(float64(in.Width)) + first = false + out.RawString("\"y\":") + out.Float64(float64(in.Y)) + if !first { + out.RawByte(',') } - if in.Height != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"height\":") - out.Float64(float64(in.Height)) + first = false + out.RawString("\"width\":") + out.Float64(float64(in.Width)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"height\":") + out.Float64(float64(in.Height)) out.RawByte('}') } @@ -3995,25 +3981,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom49(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.HostID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hostId\":") - out.Int64(int64(in.HostID)) + if !first { + out.RawByte(',') } - if in.Root != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"root\":") - if in.Root == nil { - out.RawString("null") - } else { - (*in.Root).MarshalEasyJSON(out) - } + first = false + out.RawString("\"hostId\":") + out.Int64(int64(in.HostID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"root\":") + if in.Root == nil { + out.RawString("null") + } else { + (*in.Root).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4078,22 +4060,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom50(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.HostID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hostId\":") - out.Int64(int64(in.HostID)) + if !first { + out.RawByte(',') } - if in.RootID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"rootId\":") - out.Int64(int64(in.RootID)) + first = false + out.RawString("\"hostId\":") + out.Int64(int64(in.HostID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"rootId\":") + out.Int64(int64(in.RootID)) out.RawByte('}') } @@ -4186,36 +4164,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom51(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ParentID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentId\":") - out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') } - if len(in.Nodes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodes\":") - if in.Nodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v32, v33 := range in.Nodes { - if v32 > 0 { - out.RawByte(',') - } - if v33 == nil { - out.RawString("null") - } else { - (*v33).MarshalEasyJSON(out) - } + first = false + out.RawString("\"parentId\":") + out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodes\":") + if in.Nodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v32, v33 := range in.Nodes { + if v32 > 0 { + out.RawByte(',') + } + if v33 == nil { + out.RawString("null") + } else { + (*v33).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -4280,22 +4254,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom52(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ParentID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentId\":") - out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') } - if in.PseudoElementID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pseudoElementId\":") - out.Int64(int64(in.PseudoElementID)) + first = false + out.RawString("\"parentId\":") + out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"pseudoElementId\":") + out.Int64(int64(in.PseudoElementID)) out.RawByte('}') } @@ -4367,25 +4337,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom53(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ParentID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentId\":") - out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') } - if in.PseudoElement != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pseudoElement\":") - if in.PseudoElement == nil { - out.RawString("null") - } else { - (*in.PseudoElement).MarshalEasyJSON(out) - } + first = false + out.RawString("\"parentId\":") + out.Int64(int64(in.ParentID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"pseudoElement\":") + if in.PseudoElement == nil { + out.RawString("null") + } else { + (*in.PseudoElement).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4469,24 +4435,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom54(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if len(in.NodeIds) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeIds\":") - if in.NodeIds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v35, v36 := range in.NodeIds { - if v35 > 0 { - out.RawByte(',') - } - out.Int64(int64(v36)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodeIds\":") + if in.NodeIds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v35, v36 := range in.NodeIds { + if v35 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Int64(int64(v36)) } + out.RawByte(']') } out.RawByte('}') } @@ -4639,36 +4603,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom56(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.InsertionPointID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"insertionPointId\":") - out.Int64(int64(in.InsertionPointID)) + if !first { + out.RawByte(',') } - if len(in.DistributedNodes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"distributedNodes\":") - if in.DistributedNodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v38, v39 := range in.DistributedNodes { - if v38 > 0 { - out.RawByte(',') - } - if v39 == nil { - out.RawString("null") - } else { - (*v39).MarshalEasyJSON(out) - } + first = false + out.RawString("\"insertionPointId\":") + out.Int64(int64(in.InsertionPointID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"distributedNodes\":") + if in.DistributedNodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v38, v39 := range in.DistributedNodes { + if v38 > 0 { + out.RawByte(',') + } + if v39 == nil { + out.RawString("null") + } else { + (*v39).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -4733,22 +4693,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom57(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ParentNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentNodeId\":") - out.Int64(int64(in.ParentNodeID)) + if !first { + out.RawByte(',') } - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + first = false + out.RawString("\"parentNodeId\":") + out.Int64(int64(in.ParentNodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) out.RawByte('}') } @@ -4822,33 +4778,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom58(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ParentNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentNodeId\":") - out.Int64(int64(in.ParentNodeID)) + if !first { + out.RawByte(',') } - if in.PreviousNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"previousNodeId\":") - out.Int64(int64(in.PreviousNodeID)) + first = false + out.RawString("\"parentNodeId\":") + out.Int64(int64(in.ParentNodeID)) + if !first { + out.RawByte(',') } - if in.Node != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"node\":") - if in.Node == nil { - out.RawString("null") - } else { - (*in.Node).MarshalEasyJSON(out) - } + first = false + out.RawString("\"previousNodeId\":") + out.Int64(int64(in.PreviousNodeID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"node\":") + if in.Node == nil { + out.RawString("null") + } else { + (*in.Node).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4913,22 +4863,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom59(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } - if in.ChildNodeCount != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"childNodeCount\":") - out.Int64(int64(in.ChildNodeCount)) + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"childNodeCount\":") + out.Int64(int64(in.ChildNodeCount)) out.RawByte('}') } @@ -4992,22 +4938,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom60(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } - if in.CharacterData != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"characterData\":") - out.String(string(in.CharacterData)) + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"characterData\":") + out.String(string(in.CharacterData)) out.RawByte('}') } @@ -5071,22 +5013,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom61(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) out.RawByte('}') } @@ -5152,30 +5090,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom62(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) out.RawByte('}') } @@ -5848,98 +5780,86 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom70(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if len(in.Content) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"content\":") - if in.Content == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v47, v48 := range in.Content { - if v47 > 0 { - out.RawByte(',') - } - out.Float64(float64(v48)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"content\":") + if in.Content == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v47, v48 := range in.Content { + if v47 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Float64(float64(v48)) } + out.RawByte(']') } - if len(in.Padding) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"padding\":") - if in.Padding == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v49, v50 := range in.Padding { - if v49 > 0 { - out.RawByte(',') - } - out.Float64(float64(v50)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"padding\":") + if in.Padding == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v49, v50 := range in.Padding { + if v49 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Float64(float64(v50)) } + out.RawByte(']') } - if len(in.Border) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"border\":") - if in.Border == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v51, v52 := range in.Border { - if v51 > 0 { - out.RawByte(',') - } - out.Float64(float64(v52)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"border\":") + if in.Border == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v51, v52 := range in.Border { + if v51 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Float64(float64(v52)) } + out.RawByte(']') } - if len(in.Margin) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"margin\":") - if in.Margin == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v53, v54 := range in.Margin { - if v53 > 0 { - out.RawByte(',') - } - out.Float64(float64(v54)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"margin\":") + if in.Margin == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v53, v54 := range in.Margin { + if v53 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Float64(float64(v54)) } + out.RawByte(']') } - if in.Width != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"width\":") - out.Int64(int64(in.Width)) + if !first { + out.RawByte(',') } - if in.Height != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"height\":") - out.Int64(int64(in.Height)) + first = false + out.RawString("\"width\":") + out.Int64(int64(in.Width)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"height\":") + out.Int64(int64(in.Height)) if in.ShapeOutside != nil { if !first { out.RawByte(',') diff --git a/cdp/dom/events.go b/cdp/dom/events.go index 67b2056..9ca94fe 100644 --- a/cdp/dom/events.go +++ b/cdp/dom/events.go @@ -14,85 +14,85 @@ type EventDocumentUpdated struct{} // missing DOM structure. This happens upon most of the calls requesting node // ids. type EventSetChildNodes struct { - ParentID cdp.NodeID `json:"parentId,omitempty"` // Parent node id to populate with children. - Nodes []*cdp.Node `json:"nodes,omitempty"` // Child nodes array. + ParentID cdp.NodeID `json:"parentId"` // Parent node id to populate with children. + Nodes []*cdp.Node `json:"nodes"` // Child nodes array. } // EventAttributeModified fired when Element's attribute is modified. type EventAttributeModified struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed. - Name string `json:"name,omitempty"` // Attribute name. - Value string `json:"value,omitempty"` // Attribute value. + NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed. + Name string `json:"name"` // Attribute name. + Value string `json:"value"` // Attribute value. } // EventAttributeRemoved fired when Element's attribute is removed. type EventAttributeRemoved struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed. - Name string `json:"name,omitempty"` // A ttribute name. + NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed. + Name string `json:"name"` // A ttribute name. } // EventInlineStyleInvalidated fired when Element's inline style is modified // via a CSS property modification. type EventInlineStyleInvalidated struct { - NodeIds []cdp.NodeID `json:"nodeIds,omitempty"` // Ids of the nodes for which the inline styles have been invalidated. + NodeIds []cdp.NodeID `json:"nodeIds"` // Ids of the nodes for which the inline styles have been invalidated. } // EventCharacterDataModified mirrors DOMCharacterDataModified event. type EventCharacterDataModified struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed. - CharacterData string `json:"characterData,omitempty"` // New text value. + NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed. + CharacterData string `json:"characterData"` // New text value. } // EventChildNodeCountUpdated fired when Container's child node count has // changed. type EventChildNodeCountUpdated struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has changed. - ChildNodeCount int64 `json:"childNodeCount,omitempty"` // New node count. + NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed. + ChildNodeCount int64 `json:"childNodeCount"` // New node count. } // EventChildNodeInserted mirrors DOMNodeInserted event. type EventChildNodeInserted struct { - ParentNodeID cdp.NodeID `json:"parentNodeId,omitempty"` // Id of the node that has changed. - PreviousNodeID cdp.NodeID `json:"previousNodeId,omitempty"` // If of the previous siblint. - Node *cdp.Node `json:"node,omitempty"` // Inserted node data. + ParentNodeID cdp.NodeID `json:"parentNodeId"` // Id of the node that has changed. + PreviousNodeID cdp.NodeID `json:"previousNodeId"` // If of the previous siblint. + Node *cdp.Node `json:"node"` // Inserted node data. } // EventChildNodeRemoved mirrors DOMNodeRemoved event. type EventChildNodeRemoved struct { - ParentNodeID cdp.NodeID `json:"parentNodeId,omitempty"` // Parent id. - NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node that has been removed. + ParentNodeID cdp.NodeID `json:"parentNodeId"` // Parent id. + NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has been removed. } // EventShadowRootPushed called when shadow root is pushed into the element. type EventShadowRootPushed struct { - HostID cdp.NodeID `json:"hostId,omitempty"` // Host element id. - Root *cdp.Node `json:"root,omitempty"` // Shadow root. + HostID cdp.NodeID `json:"hostId"` // Host element id. + Root *cdp.Node `json:"root"` // Shadow root. } // EventShadowRootPopped called when shadow root is popped from the element. type EventShadowRootPopped struct { - HostID cdp.NodeID `json:"hostId,omitempty"` // Host element id. - RootID cdp.NodeID `json:"rootId,omitempty"` // Shadow root id. + HostID cdp.NodeID `json:"hostId"` // Host element id. + RootID cdp.NodeID `json:"rootId"` // Shadow root id. } // EventPseudoElementAdded called when a pseudo element is added to an // element. type EventPseudoElementAdded struct { - ParentID cdp.NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id. - PseudoElement *cdp.Node `json:"pseudoElement,omitempty"` // The added pseudo element. + ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id. + PseudoElement *cdp.Node `json:"pseudoElement"` // The added pseudo element. } // EventPseudoElementRemoved called when a pseudo element is removed from an // element. type EventPseudoElementRemoved struct { - ParentID cdp.NodeID `json:"parentId,omitempty"` // Pseudo element's parent element id. - PseudoElementID cdp.NodeID `json:"pseudoElementId,omitempty"` // The removed pseudo element id. + ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id. + PseudoElementID cdp.NodeID `json:"pseudoElementId"` // The removed pseudo element id. } // EventDistributedNodesUpdated called when distribution is changed. type EventDistributedNodesUpdated struct { - InsertionPointID cdp.NodeID `json:"insertionPointId,omitempty"` // Insertion point where distributed nodes were updated. - DistributedNodes []*cdp.BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point. + InsertionPointID cdp.NodeID `json:"insertionPointId"` // Insertion point where distributed nodes were updated. + DistributedNodes []*cdp.BackendNode `json:"distributedNodes"` // Distributed nodes for given insertion point. } // EventTypes all event types in the domain. diff --git a/cdp/dom/types.go b/cdp/dom/types.go index c694c06..5b90a92 100644 --- a/cdp/dom/types.go +++ b/cdp/dom/types.go @@ -10,26 +10,26 @@ type Quad []float64 // BoxModel box model. type BoxModel struct { - Content Quad `json:"content,omitempty"` // Content box - Padding Quad `json:"padding,omitempty"` // Padding box - Border Quad `json:"border,omitempty"` // Border box - Margin Quad `json:"margin,omitempty"` // Margin box - Width int64 `json:"width,omitempty"` // Node width - Height int64 `json:"height,omitempty"` // Node height + Content Quad `json:"content"` // Content box + Padding Quad `json:"padding"` // Padding box + Border Quad `json:"border"` // Border box + Margin Quad `json:"margin"` // Margin box + Width int64 `json:"width"` // Node width + Height int64 `json:"height"` // Node height ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates } // ShapeOutsideInfo cSS Shape Outside details. type ShapeOutsideInfo struct { - Bounds Quad `json:"bounds,omitempty"` // Shape bounds - Shape []easyjson.RawMessage `json:"shape,omitempty"` // Shape coordinate details - MarginShape []easyjson.RawMessage `json:"marginShape,omitempty"` // Margin shape bounds + Bounds Quad `json:"bounds"` // Shape bounds + Shape []easyjson.RawMessage `json:"shape"` // Shape coordinate details + MarginShape []easyjson.RawMessage `json:"marginShape"` // Margin shape bounds } // Rect rectangle. type Rect struct { - X float64 `json:"x,omitempty"` // X coordinate - Y float64 `json:"y,omitempty"` // Y coordinate - Width float64 `json:"width,omitempty"` // Rectangle width - Height float64 `json:"height,omitempty"` // Rectangle height + X float64 `json:"x"` // X coordinate + Y float64 `json:"y"` // Y coordinate + Width float64 `json:"width"` // Rectangle width + Height float64 `json:"height"` // Rectangle height } diff --git a/cdp/domdebugger/easyjson.go b/cdp/domdebugger/easyjson.go index bd947de..6aaafa4 100644 --- a/cdp/domdebugger/easyjson.go +++ b/cdp/domdebugger/easyjson.go @@ -859,62 +859,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomdebugger10(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - out.String(string(in.Type)) + if !first { + out.RawByte(',') } - if in.UseCapture { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"useCapture\":") - out.Bool(bool(in.UseCapture)) + first = false + out.RawString("\"type\":") + out.String(string(in.Type)) + if !first { + out.RawByte(',') } - if in.Passive { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"passive\":") - out.Bool(bool(in.Passive)) + first = false + out.RawString("\"useCapture\":") + out.Bool(bool(in.UseCapture)) + if !first { + out.RawByte(',') } - if in.Once { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"once\":") - out.Bool(bool(in.Once)) + first = false + out.RawString("\"passive\":") + out.Bool(bool(in.Passive)) + if !first { + out.RawByte(',') } - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + first = false + out.RawString("\"once\":") + out.Bool(bool(in.Once)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.ColumnNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"columnNumber\":") - out.Int64(int64(in.ColumnNumber)) + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"columnNumber\":") + out.Int64(int64(in.ColumnNumber)) if in.Handler != nil { if !first { out.RawByte(',') diff --git a/cdp/domdebugger/types.go b/cdp/domdebugger/types.go index d83fc77..9663add 100644 --- a/cdp/domdebugger/types.go +++ b/cdp/domdebugger/types.go @@ -59,13 +59,13 @@ func (t *DOMBreakpointType) UnmarshalJSON(buf []byte) error { // EventListener object event listener. type EventListener struct { - Type string `json:"type,omitempty"` // EventListener's type. - UseCapture bool `json:"useCapture,omitempty"` // EventListener's useCapture. - Passive bool `json:"passive,omitempty"` // EventListener's passive flag. - Once bool `json:"once,omitempty"` // EventListener's once flag. - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Script id of the handler code. - LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the script (0-based). - ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based). + Type string `json:"type"` // EventListener's type. + UseCapture bool `json:"useCapture"` // EventListener's useCapture. + Passive bool `json:"passive"` // EventListener's passive flag. + Once bool `json:"once"` // EventListener's once flag. + ScriptID runtime.ScriptID `json:"scriptId"` // Script id of the handler code. + LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based). + ColumnNumber int64 `json:"columnNumber"` // 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. BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any). diff --git a/cdp/domsnapshot/easyjson.go b/cdp/domsnapshot/easyjson.go index 88bfedd..0e1de15 100644 --- a/cdp/domsnapshot/easyjson.go +++ b/cdp/domsnapshot/easyjson.go @@ -56,22 +56,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) out.RawByte('}') } @@ -178,25 +174,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot1(out *jwriter.Writ out.RawByte('{') first := true _ = first - if in.DomNodeIndex != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"domNodeIndex\":") - out.Int64(int64(in.DomNodeIndex)) + if !first { + out.RawByte(',') } - if in.BoundingBox != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"boundingBox\":") - if in.BoundingBox == nil { - out.RawString("null") - } else { - (*in.BoundingBox).MarshalEasyJSON(out) - } + first = false + out.RawString("\"domNodeIndex\":") + out.Int64(int64(in.DomNodeIndex)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"boundingBox\":") + if in.BoundingBox == nil { + out.RawString("null") + } else { + (*in.BoundingBox).MarshalEasyJSON(out) } if in.LayoutText != "" { if !first { @@ -725,38 +717,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(out *jwriter.Writ out.RawByte('{') first := true _ = first - if in.NodeType != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeType\":") - (in.NodeType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.NodeName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeName\":") - out.String(string(in.NodeName)) + first = false + out.RawString("\"nodeType\":") + (in.NodeType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.NodeValue != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeValue\":") - out.String(string(in.NodeValue)) + first = false + out.RawString("\"nodeName\":") + out.String(string(in.NodeName)) + if !first { + out.RawByte(',') } - if in.BackendNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendNodeId\":") - out.Int64(int64(in.BackendNodeID)) + first = false + out.RawString("\"nodeValue\":") + out.String(string(in.NodeValue)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"backendNodeId\":") + out.Int64(int64(in.BackendNodeID)) if len(in.ChildNodeIndexes) != 0 { if !first { out.RawByte(',') @@ -1004,28 +988,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(out *jwriter.Writ out.RawByte('{') first := true _ = first - if len(in.Properties) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"properties\":") - if in.Properties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v26, v27 := range in.Properties { - if v26 > 0 { - out.RawByte(',') - } - if v27 == nil { - out.RawString("null") - } else { - (*v27).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"properties\":") + if in.Properties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v26, v27 := range in.Properties { + if v26 > 0 { + out.RawByte(',') + } + if v27 == nil { + out.RawString("null") + } else { + (*v27).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } diff --git a/cdp/domsnapshot/types.go b/cdp/domsnapshot/types.go index 3e19759..1f56152 100644 --- a/cdp/domsnapshot/types.go +++ b/cdp/domsnapshot/types.go @@ -10,10 +10,10 @@ import ( // DOMNode a Node in the DOM tree. type DOMNode struct { - NodeType cdp.NodeType `json:"nodeType,omitempty"` // Node's nodeType. - NodeName string `json:"nodeName,omitempty"` // Node's nodeName. - NodeValue string `json:"nodeValue,omitempty"` // Node's nodeValue. - BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node's id, corresponds to DOM.Node.backendNodeId. + NodeType cdp.NodeType `json:"nodeType"` // Node's nodeType. + NodeName string `json:"nodeName"` // Node's nodeName. + NodeValue string `json:"nodeValue"` // Node's nodeValue. + BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Node's id, corresponds to DOM.Node.backendNodeId. ChildNodeIndexes []int64 `json:"childNodeIndexes,omitempty"` // The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if any. Attributes []*NameValue `json:"attributes,omitempty"` // Attributes of an Element node. PseudoElementIndexes []int64 `json:"pseudoElementIndexes,omitempty"` // Indexes of pseudo elements associated with this node in the domNodes array returned by getSnapshot, if any. @@ -33,8 +33,8 @@ type DOMNode struct { // LayoutTreeNode details of an element in the DOM tree with a LayoutObject. type LayoutTreeNode struct { - DomNodeIndex int64 `json:"domNodeIndex,omitempty"` // The index of the related DOM node in the domNodes array returned by getSnapshot. - BoundingBox *dom.Rect `json:"boundingBox,omitempty"` // The absolute position bounding box. + DomNodeIndex int64 `json:"domNodeIndex"` // The index of the related DOM node in the domNodes array returned by getSnapshot. + BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box. LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText, if any. InlineTextNodes []*css.InlineTextBox `json:"inlineTextNodes,omitempty"` // The post-layout inline text nodes, if any. StyleIndex int64 `json:"styleIndex,omitempty"` // Index into the computedStyles array returned by getSnapshot. @@ -43,11 +43,11 @@ type LayoutTreeNode struct { // ComputedStyle a subset of the full ComputedStyle as defined by the request // whitelist. type ComputedStyle struct { - Properties []*NameValue `json:"properties,omitempty"` // Name/value pairs of computed style properties. + Properties []*NameValue `json:"properties"` // Name/value pairs of computed style properties. } // NameValue a name/value pair. type NameValue struct { - Name string `json:"name,omitempty"` // Attribute/property name. - Value string `json:"value,omitempty"` // Attribute/property value. + Name string `json:"name"` // Attribute/property name. + Value string `json:"value"` // Attribute/property value. } diff --git a/cdp/domstorage/easyjson.go b/cdp/domstorage/easyjson.go index cdd7ddf..f9d2dd8 100644 --- a/cdp/domstorage/easyjson.go +++ b/cdp/domstorage/easyjson.go @@ -54,22 +54,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomstorage(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.SecurityOrigin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityOrigin\":") - out.String(string(in.SecurityOrigin)) + if !first { + out.RawByte(',') } - if in.IsLocalStorage { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isLocalStorage\":") - out.Bool(bool(in.IsLocalStorage)) + first = false + out.RawString("\"securityOrigin\":") + out.String(string(in.SecurityOrigin)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"isLocalStorage\":") + out.Bool(bool(in.IsLocalStorage)) out.RawByte('}') } @@ -533,17 +529,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomstorage5(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.StorageID != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"storageId\":") - if in.StorageID == nil { - out.RawString("null") - } else { - (*in.StorageID).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"storageId\":") + if in.StorageID == nil { + out.RawString("null") + } else { + (*in.StorageID).MarshalEasyJSON(out) } out.RawByte('}') } @@ -620,42 +614,34 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomstorage6(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.StorageID != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"storageId\":") - if in.StorageID == nil { - out.RawString("null") - } else { - (*in.StorageID).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Key != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"key\":") - out.String(string(in.Key)) + first = false + out.RawString("\"storageId\":") + if in.StorageID == nil { + out.RawString("null") + } else { + (*in.StorageID).MarshalEasyJSON(out) } - if in.OldValue != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"oldValue\":") - out.String(string(in.OldValue)) + if !first { + out.RawByte(',') } - if in.NewValue != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"newValue\":") - out.String(string(in.NewValue)) + first = false + out.RawString("\"key\":") + out.String(string(in.Key)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"oldValue\":") + out.String(string(in.OldValue)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"newValue\":") + out.String(string(in.NewValue)) out.RawByte('}') } @@ -727,26 +713,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomstorage7(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.StorageID != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"storageId\":") - if in.StorageID == nil { - out.RawString("null") - } else { - (*in.StorageID).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Key != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"key\":") - out.String(string(in.Key)) + first = false + out.RawString("\"storageId\":") + if in.StorageID == nil { + out.RawString("null") + } else { + (*in.StorageID).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"key\":") + out.String(string(in.Key)) out.RawByte('}') } @@ -820,34 +802,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomstorage8(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.StorageID != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"storageId\":") - if in.StorageID == nil { - out.RawString("null") - } else { - (*in.StorageID).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Key != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"key\":") - out.String(string(in.Key)) + first = false + out.RawString("\"storageId\":") + if in.StorageID == nil { + out.RawString("null") + } else { + (*in.StorageID).MarshalEasyJSON(out) } - if in.NewValue != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"newValue\":") - out.String(string(in.NewValue)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"key\":") + out.String(string(in.Key)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"newValue\":") + out.String(string(in.NewValue)) out.RawByte('}') } diff --git a/cdp/domstorage/events.go b/cdp/domstorage/events.go index a75340e..16dfd17 100644 --- a/cdp/domstorage/events.go +++ b/cdp/domstorage/events.go @@ -8,28 +8,28 @@ import ( // EventDomStorageItemsCleared [no description]. type EventDomStorageItemsCleared struct { - StorageID *StorageID `json:"storageId,omitempty"` + StorageID *StorageID `json:"storageId"` } // EventDomStorageItemRemoved [no description]. type EventDomStorageItemRemoved struct { - StorageID *StorageID `json:"storageId,omitempty"` - Key string `json:"key,omitempty"` + StorageID *StorageID `json:"storageId"` + Key string `json:"key"` } // EventDomStorageItemAdded [no description]. type EventDomStorageItemAdded struct { - StorageID *StorageID `json:"storageId,omitempty"` - Key string `json:"key,omitempty"` - NewValue string `json:"newValue,omitempty"` + StorageID *StorageID `json:"storageId"` + Key string `json:"key"` + NewValue string `json:"newValue"` } // EventDomStorageItemUpdated [no description]. type EventDomStorageItemUpdated struct { - StorageID *StorageID `json:"storageId,omitempty"` - Key string `json:"key,omitempty"` - OldValue string `json:"oldValue,omitempty"` - NewValue string `json:"newValue,omitempty"` + StorageID *StorageID `json:"storageId"` + Key string `json:"key"` + OldValue string `json:"oldValue"` + NewValue string `json:"newValue"` } // EventTypes all event types in the domain. diff --git a/cdp/domstorage/types.go b/cdp/domstorage/types.go index 5da8550..abb109f 100644 --- a/cdp/domstorage/types.go +++ b/cdp/domstorage/types.go @@ -4,8 +4,8 @@ package domstorage // StorageID dOM Storage identifier. type StorageID struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // Security origin for the storage. - IsLocalStorage bool `json:"isLocalStorage,omitempty"` // Whether the storage is local storage (not session storage). + SecurityOrigin string `json:"securityOrigin"` // Security origin for the storage. + IsLocalStorage bool `json:"isLocalStorage"` // Whether the storage is local storage (not session storage). } // Item dOM Storage item. diff --git a/cdp/easyjson.go b/cdp/easyjson.go index 2a245e9..c8a346f 100644 --- a/cdp/easyjson.go +++ b/cdp/easyjson.go @@ -58,30 +58,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp(out *jwriter.Writer, in RGBA) out.RawByte('{') first := true _ = first - if in.R != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"r\":") - out.Int64(int64(in.R)) + if !first { + out.RawByte(',') } - if in.G != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"g\":") - out.Int64(int64(in.G)) + first = false + out.RawString("\"r\":") + out.Int64(int64(in.R)) + if !first { + out.RawByte(',') } - if in.B != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"b\":") - out.Int64(int64(in.B)) + first = false + out.RawString("\"g\":") + out.Int64(int64(in.G)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"b\":") + out.Int64(int64(in.B)) if in.A != 0 { if !first { out.RawByte(',') @@ -366,14 +360,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp1(out *jwriter.Writer, in Node out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) if in.ParentID != 0 { if !first { out.RawByte(',') @@ -382,46 +374,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp1(out *jwriter.Writer, in Node out.RawString("\"parentId\":") out.Int64(int64(in.ParentID)) } - if in.BackendNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendNodeId\":") - out.Int64(int64(in.BackendNodeID)) + if !first { + out.RawByte(',') } - if in.NodeType != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeType\":") - (in.NodeType).MarshalEasyJSON(out) + first = false + out.RawString("\"backendNodeId\":") + out.Int64(int64(in.BackendNodeID)) + if !first { + out.RawByte(',') } - if in.NodeName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeName\":") - out.String(string(in.NodeName)) + first = false + out.RawString("\"nodeType\":") + (in.NodeType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.LocalName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"localName\":") - out.String(string(in.LocalName)) + first = false + out.RawString("\"nodeName\":") + out.String(string(in.NodeName)) + if !first { + out.RawByte(',') } - if in.NodeValue != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeValue\":") - out.String(string(in.NodeValue)) + first = false + out.RawString("\"localName\":") + out.String(string(in.LocalName)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"nodeValue\":") + out.String(string(in.NodeValue)) if in.ChildNodeCount != 0 { if !first { out.RawByte(',') @@ -736,22 +718,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp2(out *jwriter.Writer, in Mess out.RawByte('{') first := true _ = first - if in.Code != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"code\":") - out.Int64(int64(in.Code)) + if !first { + out.RawByte(',') } - if in.Message != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"message\":") - out.String(string(in.Message)) + first = false + out.RawString("\"code\":") + out.Int64(int64(in.Code)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"message\":") + out.String(string(in.Message)) out.RawByte('}') } @@ -946,14 +924,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) if in.ParentID != "" { if !first { out.RawByte(',') @@ -962,14 +938,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram out.RawString("\"parentId\":") out.String(string(in.ParentID)) } - if in.LoaderID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"loaderId\":") - out.String(string(in.LoaderID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"loaderId\":") + out.String(string(in.LoaderID)) if in.Name != "" { if !first { out.RawByte(',') @@ -978,30 +952,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram out.RawString("\"name\":") out.String(string(in.Name)) } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.SecurityOrigin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityOrigin\":") - out.String(string(in.SecurityOrigin)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.MimeType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"mimeType\":") - out.String(string(in.MimeType)) + first = false + out.RawString("\"securityOrigin\":") + out.String(string(in.SecurityOrigin)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"mimeType\":") + out.String(string(in.MimeType)) out.RawByte('}') } @@ -1067,30 +1035,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp5(out *jwriter.Writer, in Back out.RawByte('{') first := true _ = first - if in.NodeType != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeType\":") - (in.NodeType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.NodeName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeName\":") - out.String(string(in.NodeName)) + first = false + out.RawString("\"nodeType\":") + (in.NodeType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.BackendNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendNodeId\":") - out.Int64(int64(in.BackendNodeID)) + first = false + out.RawString("\"nodeName\":") + out.String(string(in.NodeName)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"backendNodeId\":") + out.Int64(int64(in.BackendNodeID)) out.RawByte('}') } diff --git a/cdp/emulation/easyjson.go b/cdp/emulation/easyjson.go index 5a218d8..da58c77 100644 --- a/cdp/emulation/easyjson.go +++ b/cdp/emulation/easyjson.go @@ -893,22 +893,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Angle != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"angle\":") - out.Int64(int64(in.Angle)) + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"angle\":") + out.Int64(int64(in.Angle)) out.RawByte('}') } diff --git a/cdp/emulation/types.go b/cdp/emulation/types.go index 3ccf818..ad06c1f 100644 --- a/cdp/emulation/types.go +++ b/cdp/emulation/types.go @@ -12,8 +12,8 @@ import ( // ScreenOrientation screen orientation. type ScreenOrientation struct { - Type OrientationType `json:"type,omitempty"` // Orientation type. - Angle int64 `json:"angle,omitempty"` // Orientation angle. + Type OrientationType `json:"type"` // Orientation type. + Angle int64 `json:"angle"` // Orientation angle. } // VirtualTimePolicy advance: If the scheduler runs out of immediate work, diff --git a/cdp/har/easyjson.go b/cdp/har/easyjson.go new file mode 100644 index 0000000..d76c959 --- /dev/null +++ b/cdp/har/easyjson.go @@ -0,0 +1,2261 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package har + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar(in *jlexer.Lexer, out *Timings) { + 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 "blocked": + out.Blocked = float64(in.Float64()) + case "dns": + out.DNS = float64(in.Float64()) + case "connect": + out.Connect = float64(in.Float64()) + case "send": + out.Send = float64(in.Float64()) + case "wait": + out.Wait = float64(in.Float64()) + case "receive": + out.Receive = float64(in.Float64()) + case "ssl": + out.Ssl = float64(in.Float64()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar(out *jwriter.Writer, in Timings) { + out.RawByte('{') + first := true + _ = first + if in.Blocked != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"blocked\":") + out.Float64(float64(in.Blocked)) + } + if in.DNS != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"dns\":") + out.Float64(float64(in.DNS)) + } + if in.Connect != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"connect\":") + out.Float64(float64(in.Connect)) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"send\":") + out.Float64(float64(in.Send)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"wait\":") + out.Float64(float64(in.Wait)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"receive\":") + out.Float64(float64(in.Receive)) + if in.Ssl != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"ssl\":") + out.Float64(float64(in.Ssl)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Timings) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Timings) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Timings) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Timings) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar1(in *jlexer.Lexer, out *Response) { + 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 "status": + out.Status = int64(in.Int64()) + case "statusText": + out.StatusText = string(in.String()) + case "httpVersion": + out.HTTPVersion = string(in.String()) + case "cookies": + if in.IsNull() { + in.Skip() + out.Cookies = nil + } else { + in.Delim('[') + if out.Cookies == nil { + if !in.IsDelim(']') { + out.Cookies = make([]*Cookie, 0, 8) + } else { + out.Cookies = []*Cookie{} + } + } else { + out.Cookies = (out.Cookies)[:0] + } + for !in.IsDelim(']') { + var v1 *Cookie + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Cookie) + } + (*v1).UnmarshalEasyJSON(in) + } + out.Cookies = append(out.Cookies, v1) + in.WantComma() + } + in.Delim(']') + } + case "headers": + if in.IsNull() { + in.Skip() + out.Headers = nil + } else { + in.Delim('[') + if out.Headers == nil { + if !in.IsDelim(']') { + out.Headers = make([]*NameValuePair, 0, 8) + } else { + out.Headers = []*NameValuePair{} + } + } else { + out.Headers = (out.Headers)[:0] + } + for !in.IsDelim(']') { + var v2 *NameValuePair + if in.IsNull() { + in.Skip() + v2 = nil + } else { + if v2 == nil { + v2 = new(NameValuePair) + } + (*v2).UnmarshalEasyJSON(in) + } + out.Headers = append(out.Headers, v2) + in.WantComma() + } + in.Delim(']') + } + case "content": + if in.IsNull() { + in.Skip() + out.Content = nil + } else { + if out.Content == nil { + out.Content = new(Content) + } + (*out.Content).UnmarshalEasyJSON(in) + } + case "redirectURL": + out.RedirectURL = string(in.String()) + case "headersSize": + out.HeadersSize = int64(in.Int64()) + case "bodySize": + out.BodySize = int64(in.Int64()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar1(out *jwriter.Writer, in Response) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"status\":") + out.Int64(int64(in.Status)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"statusText\":") + out.String(string(in.StatusText)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"httpVersion\":") + out.String(string(in.HTTPVersion)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"cookies\":") + if in.Cookies == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.Cookies { + if v3 > 0 { + out.RawByte(',') + } + if v4 == nil { + out.RawString("null") + } else { + (*v4).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Headers { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"content\":") + if in.Content == nil { + out.RawString("null") + } else { + (*in.Content).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"redirectURL\":") + out.String(string(in.RedirectURL)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headersSize\":") + out.Int64(int64(in.HeadersSize)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"bodySize\":") + out.Int64(int64(in.BodySize)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Response) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Response) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Response) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar1(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar2(in *jlexer.Lexer, out *Request) { + 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 "method": + out.Method = string(in.String()) + case "url": + out.URL = string(in.String()) + case "httpVersion": + out.HTTPVersion = string(in.String()) + case "cookies": + if in.IsNull() { + in.Skip() + out.Cookies = nil + } else { + in.Delim('[') + if out.Cookies == nil { + if !in.IsDelim(']') { + out.Cookies = make([]*Cookie, 0, 8) + } else { + out.Cookies = []*Cookie{} + } + } else { + out.Cookies = (out.Cookies)[:0] + } + for !in.IsDelim(']') { + var v7 *Cookie + if in.IsNull() { + in.Skip() + v7 = nil + } else { + if v7 == nil { + v7 = new(Cookie) + } + (*v7).UnmarshalEasyJSON(in) + } + out.Cookies = append(out.Cookies, v7) + in.WantComma() + } + in.Delim(']') + } + case "headers": + if in.IsNull() { + in.Skip() + out.Headers = nil + } else { + in.Delim('[') + if out.Headers == nil { + if !in.IsDelim(']') { + out.Headers = make([]*NameValuePair, 0, 8) + } else { + out.Headers = []*NameValuePair{} + } + } else { + out.Headers = (out.Headers)[:0] + } + for !in.IsDelim(']') { + var v8 *NameValuePair + if in.IsNull() { + in.Skip() + v8 = nil + } else { + if v8 == nil { + v8 = new(NameValuePair) + } + (*v8).UnmarshalEasyJSON(in) + } + out.Headers = append(out.Headers, v8) + in.WantComma() + } + in.Delim(']') + } + case "queryString": + if in.IsNull() { + in.Skip() + out.QueryString = nil + } else { + in.Delim('[') + if out.QueryString == nil { + if !in.IsDelim(']') { + out.QueryString = make([]*NameValuePair, 0, 8) + } else { + out.QueryString = []*NameValuePair{} + } + } else { + out.QueryString = (out.QueryString)[:0] + } + for !in.IsDelim(']') { + var v9 *NameValuePair + if in.IsNull() { + in.Skip() + v9 = nil + } else { + if v9 == nil { + v9 = new(NameValuePair) + } + (*v9).UnmarshalEasyJSON(in) + } + out.QueryString = append(out.QueryString, v9) + in.WantComma() + } + in.Delim(']') + } + case "postData": + if in.IsNull() { + in.Skip() + out.PostData = nil + } else { + if out.PostData == nil { + out.PostData = new(PostData) + } + (*out.PostData).UnmarshalEasyJSON(in) + } + case "headersSize": + out.HeadersSize = int64(in.Int64()) + case "bodySize": + out.BodySize = int64(in.Int64()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar2(out *jwriter.Writer, in Request) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"method\":") + out.String(string(in.Method)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"httpVersion\":") + out.String(string(in.HTTPVersion)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"cookies\":") + if in.Cookies == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v10, v11 := range in.Cookies { + if v10 > 0 { + out.RawByte(',') + } + if v11 == nil { + out.RawString("null") + } else { + (*v11).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v12, v13 := range in.Headers { + if v12 > 0 { + out.RawByte(',') + } + if v13 == nil { + out.RawString("null") + } else { + (*v13).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"queryString\":") + if in.QueryString == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v14, v15 := range in.QueryString { + if v14 > 0 { + out.RawByte(',') + } + if v15 == nil { + out.RawString("null") + } else { + (*v15).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if in.PostData != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"postData\":") + if in.PostData == nil { + out.RawString("null") + } else { + (*in.PostData).MarshalEasyJSON(out) + } + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headersSize\":") + out.Int64(int64(in.HeadersSize)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"bodySize\":") + out.Int64(int64(in.BodySize)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Request) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar2(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Request) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar2(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Request) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar2(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Request) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar2(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar3(in *jlexer.Lexer, out *PostData) { + 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 "mimeType": + out.MimeType = string(in.String()) + case "params": + if in.IsNull() { + in.Skip() + out.Params = nil + } else { + in.Delim('[') + if out.Params == nil { + if !in.IsDelim(']') { + out.Params = make([]*Param, 0, 8) + } else { + out.Params = []*Param{} + } + } else { + out.Params = (out.Params)[:0] + } + for !in.IsDelim(']') { + var v16 *Param + if in.IsNull() { + in.Skip() + v16 = nil + } else { + if v16 == nil { + v16 = new(Param) + } + (*v16).UnmarshalEasyJSON(in) + } + out.Params = append(out.Params, v16) + in.WantComma() + } + in.Delim(']') + } + case "text": + out.Text = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar3(out *jwriter.Writer, in PostData) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"mimeType\":") + out.String(string(in.MimeType)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"params\":") + if in.Params == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v17, v18 := range in.Params { + if v17 > 0 { + out.RawByte(',') + } + if v18 == nil { + out.RawString("null") + } else { + (*v18).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v PostData) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v PostData) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *PostData) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *PostData) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar3(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar4(in *jlexer.Lexer, out *Param) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "fileName": + out.FileName = string(in.String()) + case "contentType": + out.ContentType = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar4(out *jwriter.Writer, in Param) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if in.Value != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) + } + if in.FileName != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"fileName\":") + out.String(string(in.FileName)) + } + if in.ContentType != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"contentType\":") + out.String(string(in.ContentType)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Param) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Param) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Param) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Param) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar4(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar5(in *jlexer.Lexer, out *PageTimings) { + 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 "onContentLoad": + out.OnContentLoad = float64(in.Float64()) + case "onLoad": + out.OnLoad = float64(in.Float64()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar5(out *jwriter.Writer, in PageTimings) { + out.RawByte('{') + first := true + _ = first + if in.OnContentLoad != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"onContentLoad\":") + out.Float64(float64(in.OnContentLoad)) + } + if in.OnLoad != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"onLoad\":") + out.Float64(float64(in.OnLoad)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v PageTimings) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar5(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v PageTimings) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar5(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *PageTimings) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar5(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *PageTimings) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar5(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar6(in *jlexer.Lexer, out *Page) { + 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 "startedDateTime": + out.StartedDateTime = string(in.String()) + case "id": + out.ID = string(in.String()) + case "title": + out.Title = string(in.String()) + case "pageTimings": + if in.IsNull() { + in.Skip() + out.PageTimings = nil + } else { + if out.PageTimings == nil { + out.PageTimings = new(PageTimings) + } + (*out.PageTimings).UnmarshalEasyJSON(in) + } + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar6(out *jwriter.Writer, in Page) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"startedDateTime\":") + out.String(string(in.StartedDateTime)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"title\":") + out.String(string(in.Title)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"pageTimings\":") + if in.PageTimings == nil { + out.RawString("null") + } else { + (*in.PageTimings).MarshalEasyJSON(out) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Page) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar6(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Page) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar6(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Page) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar6(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Page) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar6(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar7(in *jlexer.Lexer, out *NameValuePair) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar7(out *jwriter.Writer, in NameValuePair) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v NameValuePair) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar7(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v NameValuePair) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar7(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *NameValuePair) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar7(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *NameValuePair) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar7(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar8(in *jlexer.Lexer, out *Log) { + 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 "version": + out.Version = string(in.String()) + case "creator": + if in.IsNull() { + in.Skip() + out.Creator = nil + } else { + if out.Creator == nil { + out.Creator = new(Creator) + } + (*out.Creator).UnmarshalEasyJSON(in) + } + case "browser": + if in.IsNull() { + in.Skip() + out.Browser = nil + } else { + if out.Browser == nil { + out.Browser = new(Creator) + } + (*out.Browser).UnmarshalEasyJSON(in) + } + case "pages": + if in.IsNull() { + in.Skip() + out.Pages = nil + } else { + in.Delim('[') + if out.Pages == nil { + if !in.IsDelim(']') { + out.Pages = make([]*Page, 0, 8) + } else { + out.Pages = []*Page{} + } + } else { + out.Pages = (out.Pages)[:0] + } + for !in.IsDelim(']') { + var v19 *Page + if in.IsNull() { + in.Skip() + v19 = nil + } else { + if v19 == nil { + v19 = new(Page) + } + (*v19).UnmarshalEasyJSON(in) + } + out.Pages = append(out.Pages, v19) + in.WantComma() + } + in.Delim(']') + } + case "entries": + if in.IsNull() { + in.Skip() + out.Entries = nil + } else { + in.Delim('[') + if out.Entries == nil { + if !in.IsDelim(']') { + out.Entries = make([]*Entry, 0, 8) + } else { + out.Entries = []*Entry{} + } + } else { + out.Entries = (out.Entries)[:0] + } + for !in.IsDelim(']') { + var v20 *Entry + if in.IsNull() { + in.Skip() + v20 = nil + } else { + if v20 == nil { + v20 = new(Entry) + } + (*v20).UnmarshalEasyJSON(in) + } + out.Entries = append(out.Entries, v20) + in.WantComma() + } + in.Delim(']') + } + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar8(out *jwriter.Writer, in Log) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"version\":") + out.String(string(in.Version)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"creator\":") + if in.Creator == nil { + out.RawString("null") + } else { + (*in.Creator).MarshalEasyJSON(out) + } + if in.Browser != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"browser\":") + if in.Browser == nil { + out.RawString("null") + } else { + (*in.Browser).MarshalEasyJSON(out) + } + } + if len(in.Pages) != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"pages\":") + if in.Pages == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v21, v22 := range in.Pages { + if v21 > 0 { + out.RawByte(',') + } + if v22 == nil { + out.RawString("null") + } else { + (*v22).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"entries\":") + if in.Entries == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v23, v24 := range in.Entries { + if v23 > 0 { + out.RawByte(',') + } + if v24 == nil { + out.RawString("null") + } else { + (*v24).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Log) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar8(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Log) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar8(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Log) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar8(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Log) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar8(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar9(in *jlexer.Lexer, out *HAR) { + 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 "log": + if in.IsNull() { + in.Skip() + out.Log = nil + } else { + if out.Log == nil { + out.Log = new(Log) + } + (*out.Log).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar9(out *jwriter.Writer, in HAR) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"log\":") + if in.Log == nil { + out.RawString("null") + } else { + (*in.Log).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v HAR) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar9(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v HAR) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar9(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *HAR) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar9(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *HAR) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar9(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar10(in *jlexer.Lexer, out *Entry) { + 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 "pageref": + out.Pageref = string(in.String()) + case "startedDateTime": + out.StartedDateTime = string(in.String()) + case "time": + out.Time = float64(in.Float64()) + case "request": + if in.IsNull() { + in.Skip() + out.Request = nil + } else { + if out.Request == nil { + out.Request = new(Request) + } + (*out.Request).UnmarshalEasyJSON(in) + } + case "response": + if in.IsNull() { + in.Skip() + out.Response = nil + } else { + if out.Response == nil { + out.Response = new(Response) + } + (*out.Response).UnmarshalEasyJSON(in) + } + case "cache": + if in.IsNull() { + in.Skip() + out.Cache = nil + } else { + if out.Cache == nil { + out.Cache = new(Cache) + } + (*out.Cache).UnmarshalEasyJSON(in) + } + case "timings": + if in.IsNull() { + in.Skip() + out.Timings = nil + } else { + if out.Timings == nil { + out.Timings = new(Timings) + } + (*out.Timings).UnmarshalEasyJSON(in) + } + case "serverIPAddress": + out.ServerIPAddress = string(in.String()) + case "connection": + out.Connection = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar10(out *jwriter.Writer, in Entry) { + out.RawByte('{') + first := true + _ = first + if in.Pageref != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"pageref\":") + out.String(string(in.Pageref)) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"startedDateTime\":") + out.String(string(in.StartedDateTime)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"time\":") + out.Float64(float64(in.Time)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"request\":") + if in.Request == nil { + out.RawString("null") + } else { + (*in.Request).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"response\":") + if in.Response == nil { + out.RawString("null") + } else { + (*in.Response).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"cache\":") + if in.Cache == nil { + out.RawString("null") + } else { + (*in.Cache).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timings\":") + if in.Timings == nil { + out.RawString("null") + } else { + (*in.Timings).MarshalEasyJSON(out) + } + if in.ServerIPAddress != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"serverIPAddress\":") + out.String(string(in.ServerIPAddress)) + } + if in.Connection != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"connection\":") + out.String(string(in.Connection)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Entry) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar10(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Entry) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar10(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Entry) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar10(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar10(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar11(in *jlexer.Lexer, out *Creator) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "version": + out.Version = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar11(out *jwriter.Writer, in Creator) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"version\":") + out.String(string(in.Version)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Creator) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar11(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Creator) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar11(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Creator) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar11(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Creator) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar11(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar12(in *jlexer.Lexer, out *Cookie) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "path": + out.Path = string(in.String()) + case "domain": + out.Domain = string(in.String()) + case "expires": + out.Expires = string(in.String()) + case "httpOnly": + out.HTTPOnly = bool(in.Bool()) + case "secure": + out.Secure = bool(in.Bool()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar12(out *jwriter.Writer, in Cookie) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) + if in.Path != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"path\":") + out.String(string(in.Path)) + } + if in.Domain != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"domain\":") + out.String(string(in.Domain)) + } + if in.Expires != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"expires\":") + out.String(string(in.Expires)) + } + if in.HTTPOnly { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"httpOnly\":") + out.Bool(bool(in.HTTPOnly)) + } + if in.Secure { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"secure\":") + out.Bool(bool(in.Secure)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Cookie) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar12(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Cookie) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar12(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Cookie) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar12(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Cookie) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar12(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar13(in *jlexer.Lexer, out *Content) { + 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 "size": + out.Size = int64(in.Int64()) + case "compression": + out.Compression = int64(in.Int64()) + case "mimeType": + out.MimeType = string(in.String()) + case "text": + out.Text = string(in.String()) + case "encoding": + out.Encoding = string(in.String()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar13(out *jwriter.Writer, in Content) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"size\":") + out.Int64(int64(in.Size)) + if in.Compression != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"compression\":") + out.Int64(int64(in.Compression)) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"mimeType\":") + out.String(string(in.MimeType)) + if in.Text != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + } + if in.Encoding != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"encoding\":") + out.String(string(in.Encoding)) + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Content) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar13(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Content) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar13(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Content) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar13(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Content) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar13(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar14(in *jlexer.Lexer, out *CacheData) { + 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 "expires": + out.Expires = string(in.String()) + case "lastAccess": + out.LastAccess = string(in.String()) + case "eTag": + out.ETag = string(in.String()) + case "hitCount": + out.HitCount = int64(in.Int64()) + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar14(out *jwriter.Writer, in CacheData) { + out.RawByte('{') + first := true + _ = first + if in.Expires != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"expires\":") + out.String(string(in.Expires)) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"lastAccess\":") + out.String(string(in.LastAccess)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"eTag\":") + out.String(string(in.ETag)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"hitCount\":") + out.Int64(int64(in.HitCount)) + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CacheData) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar14(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CacheData) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar14(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CacheData) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar14(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CacheData) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar14(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar15(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 "beforeRequest": + if in.IsNull() { + in.Skip() + out.BeforeRequest = nil + } else { + if out.BeforeRequest == nil { + out.BeforeRequest = new(CacheData) + } + (*out.BeforeRequest).UnmarshalEasyJSON(in) + } + case "afterRequest": + if in.IsNull() { + in.Skip() + out.AfterRequest = nil + } else { + if out.AfterRequest == nil { + out.AfterRequest = new(CacheData) + } + (*out.AfterRequest).UnmarshalEasyJSON(in) + } + case "comment": + out.Comment = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar15(out *jwriter.Writer, in Cache) { + out.RawByte('{') + first := true + _ = first + if in.BeforeRequest != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"beforeRequest\":") + if in.BeforeRequest == nil { + out.RawString("null") + } else { + (*in.BeforeRequest).MarshalEasyJSON(out) + } + } + if in.AfterRequest != nil { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"afterRequest\":") + if in.AfterRequest == nil { + out.RawString("null") + } else { + (*in.AfterRequest).MarshalEasyJSON(out) + } + } + if in.Comment != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"comment\":") + out.String(string(in.Comment)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Cache) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar15(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Cache) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHar15(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Cache) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar15(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHar15(l, v) +} diff --git a/cdp/har/har.go b/cdp/har/har.go new file mode 100644 index 0000000..ccc6c01 --- /dev/null +++ b/cdp/har/har.go @@ -0,0 +1,9 @@ +// Package har provides the Chrome Debugging Protocol +// commands, types, and events for the HAR domain. +// +// HTTP Archive Format. +// +// Generated by the chromedp-gen command. +package har + +// AUTOGENERATED. DO NOT EDIT. diff --git a/cdp/har/types.go b/cdp/har/types.go new file mode 100644 index 0000000..c55744f --- /dev/null +++ b/cdp/har/types.go @@ -0,0 +1,168 @@ +package har + +// AUTOGENERATED. DO NOT EDIT. + +// Cache this objects contains info about a request coming from browser +// cache. +type Cache struct { + BeforeRequest *CacheData `json:"beforeRequest,omitempty"` // State of a cache entry before the request. Leave out this field if the information is not available. + AfterRequest *CacheData `json:"afterRequest,omitempty"` // State of a cache entry after the request. Leave out this field if the information is not available. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// CacheData describes the cache data for beforeRequest and afterRequest. +type CacheData struct { + Expires string `json:"expires,omitempty"` // Expiration time of the cache entry. + LastAccess string `json:"lastAccess"` // The last time the cache entry was opened. + ETag string `json:"eTag"` // Etag + HitCount int64 `json:"hitCount"` // The number of times the cache entry has been opened. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Content this object describes details about response content (embedded in +// object). +type Content struct { + Size int64 `json:"size"` // Length of the returned content in bytes. Should be equal to response.bodySize if there is no compression and bigger when the content has been compressed. + Compression int64 `json:"compression,omitempty"` // Number of bytes saved. Leave out this field if the information is not available. + MimeType string `json:"mimeType"` // MIME type of the response text (value of the Content-Type response header). The charset attribute of the MIME type is included (if available). + Text string `json:"text,omitempty"` // Response body sent from the server or loaded from the browser cache. This field is populated with textual content only. The text field is either HTTP decoded text or a encoded (e.g. "base64") representation of the response body. Leave out this field if the information is not available. + Encoding string `json:"encoding,omitempty"` // Encoding used for response text field e.g "base64". Leave out this field if the text field is HTTP decoded (decompressed & unchunked), than trans-coded from its original character set into UTF-8. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Cookie this object contains list of all cookies (used in and +// objects). +type Cookie struct { + Name string `json:"name"` // The name of the cookie. + Value string `json:"value"` // The cookie value. + Path string `json:"path,omitempty"` // The path pertaining to the cookie. + Domain string `json:"domain,omitempty"` // The host of the cookie. + Expires string `json:"expires,omitempty"` // Cookie expiration time. (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.123+02:00). + HTTPOnly bool `json:"httpOnly,omitempty"` // Set to true if the cookie is HTTP only, false otherwise. + Secure bool `json:"secure,omitempty"` // True if the cookie was transmitted over ssl, false otherwise. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Creator creator and browser objects share the same structure. +type Creator struct { + Name string `json:"name"` // Name of the application/browser used to export the log. + Version string `json:"version"` // Version of the application/browser used to export the log. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Entry this object represents an array with all exported HTTP requests. +// Sorting entries by startedDateTime (starting from the oldest) is preferred +// way how to export data since it can make importing faster. However the reader +// application should always make sure the array is sorted (if required for the +// import). +type Entry struct { + Pageref string `json:"pageref,omitempty"` // Reference to the parent page. Leave out this field if the application does not support grouping by pages. + StartedDateTime string `json:"startedDateTime"` // Date and time stamp of the request start (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD). + Time float64 `json:"time"` // Total elapsed time of the request in milliseconds. This is the sum of all timings available in the timings object (i.e. not including -1 values) . + Request *Request `json:"request"` // Detailed info about the request. + Response *Response `json:"response"` // Detailed info about the response. + Cache *Cache `json:"cache"` // Info about cache usage. + Timings *Timings `json:"timings"` // Detailed timing info about request/response round trip. + ServerIPAddress string `json:"serverIPAddress,omitempty"` // IP address of the server that was connected (result of DNS resolution). + Connection string `json:"connection,omitempty"` // Unique ID of the parent TCP/IP connection, can be the client or server port number. Note that a port number doesn't have to be unique identifier in cases where the port is shared for more connections. If the port isn't available for the application, any other unique connection ID can be used instead (e.g. connection index). Leave out this field if the application doesn't support this info. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// HAR parent container for HAR log. +type HAR struct { + Log *Log `json:"log"` +} + +// Log this object represents the root of exported data. +type Log struct { + Version string `json:"version"` // Version number of the format. If empty, string "1.1" is assumed by default. + Creator *Creator `json:"creator"` // Name and version info of the log creator application. + Browser *Creator `json:"browser,omitempty"` // Name and version info of used browser. + Pages []*Page `json:"pages,omitempty"` // List of all exported (tracked) pages. Leave out this field if the application does not support grouping by pages. + Entries []*Entry `json:"entries"` // List of all exported (tracked) requests. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// NameValuePair describes a name/value pair. +type NameValuePair struct { + Name string `json:"name"` // Name of the pair. + Value string `json:"value"` // Value of the pair. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Page this object represents list of exported pages. +type Page struct { + StartedDateTime string `json:"startedDateTime"` // Date and time stamp for the beginning of the page load (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.45+01:00). + ID string `json:"id"` // Unique identifier of a page within the . Entries use it to refer the parent page. + Title string `json:"title"` // Page title. + PageTimings *PageTimings `json:"pageTimings"` // Detailed timing info about page load. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// PageTimings this object describes timings for various events (states) +// fired during the page load. All times are specified in milliseconds. If a +// time info is not available appropriate field is set to -1. +type PageTimings struct { + OnContentLoad float64 `json:"onContentLoad,omitempty"` // Content of the page loaded. Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request. + OnLoad float64 `json:"onLoad,omitempty"` // Page is loaded (onLoad event fired). Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Param list of posted parameters, if any (embedded in object). +type Param struct { + Name string `json:"name"` // name of a posted parameter. + Value string `json:"value,omitempty"` // value of a posted parameter or content of a posted file. + FileName string `json:"fileName,omitempty"` // name of a posted file. + ContentType string `json:"contentType,omitempty"` // content type of a posted file. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// PostData this object describes posted data, if any (embedded in +// object). +type PostData struct { + MimeType string `json:"mimeType"` // Mime type of posted data. + Params []*Param `json:"params"` // List of posted parameters (in case of URL encoded parameters). + Text string `json:"text"` // Plain text posted data + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Request this object contains detailed info about performed request. +type Request struct { + Method string `json:"method"` // Request method (GET, POST, ...). + URL string `json:"url"` // Absolute URL of the request (fragments are not included). + HTTPVersion string `json:"httpVersion"` // Request HTTP Version. + Cookies []*Cookie `json:"cookies"` // List of cookie objects. + Headers []*NameValuePair `json:"headers"` // List of header objects. + QueryString []*NameValuePair `json:"queryString"` // List of query parameter objects. + PostData *PostData `json:"postData,omitempty"` // Posted data info. + HeadersSize int64 `json:"headersSize"` // Total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the body. Set to -1 if the info is not available. + BodySize int64 `json:"bodySize"` // Size of the request body (POST data payload) in bytes. Set to -1 if the info is not available. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Response this object contains detailed info about the response. +type Response struct { + Status int64 `json:"status"` // Response status. + StatusText string `json:"statusText"` // Response status description. + HTTPVersion string `json:"httpVersion"` // Response HTTP Version. + Cookies []*Cookie `json:"cookies"` // List of cookie objects. + Headers []*NameValuePair `json:"headers"` // List of header objects. + Content *Content `json:"content"` // Details about the response body. + RedirectURL string `json:"redirectURL"` // Redirection target URL from the Location response header. + HeadersSize int64 `json:"headersSize"` // Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the body. Set to -1 if the info is not available. + BodySize int64 `json:"bodySize"` // Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} + +// Timings this object describes various phases within request-response round +// trip. All times are specified in milliseconds. +type Timings struct { + Blocked float64 `json:"blocked,omitempty"` // Time spent in a queue waiting for a network connection. Use -1 if the timing does not apply to the current request. + DNS float64 `json:"dns,omitempty"` // DNS resolution time. The time required to resolve a host name. Use -1 if the timing does not apply to the current request. + Connect float64 `json:"connect,omitempty"` // Time required to create TCP connection. Use -1 if the timing does not apply to the current request. + Send float64 `json:"send"` // Time required to send HTTP request to the server. + Wait float64 `json:"wait"` // Waiting for a response from the server. + Receive float64 `json:"receive"` // Time required to read entire response from the server (or cache). + Ssl float64 `json:"ssl,omitempty"` // Time required for SSL/TLS negotiation. If this field is defined then the time is also included in the connect field (to ensure backward compatibility with HAR 1.1). Use -1 if the timing does not apply to the current request. + Comment string `json:"comment,omitempty"` // A comment provided by the user or the application. +} diff --git a/cdp/heapprofiler/easyjson.go b/cdp/heapprofiler/easyjson.go index cb1d674..35f0461 100644 --- a/cdp/heapprofiler/easyjson.go +++ b/cdp/heapprofiler/easyjson.go @@ -511,48 +511,42 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler6(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.CallFrame != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"callFrame\":") - if in.CallFrame == nil { - out.RawString("null") - } else { - (*in.CallFrame).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.SelfSize != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"selfSize\":") - out.Float64(float64(in.SelfSize)) + first = false + out.RawString("\"callFrame\":") + if in.CallFrame == nil { + out.RawString("null") + } else { + (*in.CallFrame).MarshalEasyJSON(out) } - if len(in.Children) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"children\":") - if in.Children == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.Children { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - (*v3).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"selfSize\":") + out.Float64(float64(in.SelfSize)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"children\":") + if in.Children == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Children { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -623,17 +617,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler7(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.Head != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"head\":") - if in.Head == nil { - out.RawString("null") - } else { - (*in.Head).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"head\":") + if in.Head == nil { + out.RawString("null") + } else { + (*in.Head).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1053,22 +1045,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler13(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.Done != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"done\":") - out.Int64(int64(in.Done)) + if !first { + out.RawByte(',') } - if in.Total != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"total\":") - out.Int64(int64(in.Total)) + first = false + out.RawString("\"done\":") + out.Int64(int64(in.Done)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"total\":") + out.Int64(int64(in.Total)) if in.Finished { if !first { out.RawByte(',') @@ -1148,25 +1136,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler14(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.LastSeenObjectID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lastSeenObjectId\":") - out.Int64(int64(in.LastSeenObjectID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"lastSeenObjectId\":") + out.Int64(int64(in.LastSeenObjectID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1250,24 +1234,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler15(out *jwriter.Wr out.RawByte('{') first := true _ = first - if len(in.StatsUpdate) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"statsUpdate\":") - if in.StatsUpdate == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.StatsUpdate { - if v5 > 0 { - out.RawByte(',') - } - out.Int64(int64(v6)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"statsUpdate\":") + if in.StatsUpdate == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.StatsUpdate { + if v5 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.Int64(int64(v6)) } + out.RawByte(']') } out.RawByte('}') } @@ -1330,14 +1312,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler16(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.Chunk != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"chunk\":") - out.String(string(in.Chunk)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"chunk\":") + out.String(string(in.Chunk)) out.RawByte('}') } diff --git a/cdp/heapprofiler/events.go b/cdp/heapprofiler/events.go index 234c483..2af1413 100644 --- a/cdp/heapprofiler/events.go +++ b/cdp/heapprofiler/events.go @@ -8,7 +8,7 @@ import ( // EventAddHeapSnapshotChunk [no description]. type EventAddHeapSnapshotChunk struct { - Chunk string `json:"chunk,omitempty"` + Chunk string `json:"chunk"` } // EventResetProfiles [no description]. @@ -16,8 +16,8 @@ type EventResetProfiles struct{} // EventReportHeapSnapshotProgress [no description]. type EventReportHeapSnapshotProgress struct { - Done int64 `json:"done,omitempty"` - Total int64 `json:"total,omitempty"` + Done int64 `json:"done"` + Total int64 `json:"total"` Finished bool `json:"finished,omitempty"` } @@ -27,14 +27,14 @@ type EventReportHeapSnapshotProgress struct { // then one or more heapStatsUpdate events will be sent before a new // lastSeenObjectId event. type EventLastSeenObjectID struct { - LastSeenObjectID int64 `json:"lastSeenObjectId,omitempty"` - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` + LastSeenObjectID int64 `json:"lastSeenObjectId"` + Timestamp *cdp.Timestamp `json:"timestamp"` } // EventHeapStatsUpdate if heap objects tracking has been started then // backend may send update for one or more fragments. type EventHeapStatsUpdate struct { - StatsUpdate []int64 `json:"statsUpdate,omitempty"` // An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. + StatsUpdate []int64 `json:"statsUpdate"` // An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. } // EventTypes all event types in the domain. diff --git a/cdp/heapprofiler/types.go b/cdp/heapprofiler/types.go index c40681d..2bb09e1 100644 --- a/cdp/heapprofiler/types.go +++ b/cdp/heapprofiler/types.go @@ -15,12 +15,12 @@ func (t HeapSnapshotObjectID) String() string { // SamplingHeapProfileNode sampling Heap Profile node. Holds callsite // information, allocation statistics and child nodes. type SamplingHeapProfileNode struct { - CallFrame *runtime.CallFrame `json:"callFrame,omitempty"` // Function location. - SelfSize float64 `json:"selfSize,omitempty"` // Allocations size in bytes for the node excluding children. - Children []*SamplingHeapProfileNode `json:"children,omitempty"` // Child nodes. + CallFrame *runtime.CallFrame `json:"callFrame"` // Function location. + SelfSize float64 `json:"selfSize"` // Allocations size in bytes for the node excluding children. + Children []*SamplingHeapProfileNode `json:"children"` // Child nodes. } // SamplingHeapProfile profile. type SamplingHeapProfile struct { - Head *SamplingHeapProfileNode `json:"head,omitempty"` + Head *SamplingHeapProfileNode `json:"head"` } diff --git a/cdp/indexeddb/easyjson.go b/cdp/indexeddb/easyjson.go index b4b124c..f9b6079 100644 --- a/cdp/indexeddb/easyjson.go +++ b/cdp/indexeddb/easyjson.go @@ -643,42 +643,34 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb6(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.KeyPath != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyPath\":") - if in.KeyPath == nil { - out.RawString("null") - } else { - (*in.KeyPath).MarshalEasyJSON(out) - } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Unique { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"unique\":") - out.Bool(bool(in.Unique)) + first = false + out.RawString("\"keyPath\":") + if in.KeyPath == nil { + out.RawString("null") + } else { + (*in.KeyPath).MarshalEasyJSON(out) } - if in.MultiEntry { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"multiEntry\":") - out.Bool(bool(in.MultiEntry)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"unique\":") + out.Bool(bool(in.Unique)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"multiEntry\":") + out.Bool(bool(in.MultiEntry)) out.RawByte('}') } @@ -783,56 +775,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb7(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.KeyPath != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyPath\":") - if in.KeyPath == nil { - out.RawString("null") - } else { - (*in.KeyPath).MarshalEasyJSON(out) - } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.AutoIncrement { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"autoIncrement\":") - out.Bool(bool(in.AutoIncrement)) + first = false + out.RawString("\"keyPath\":") + if in.KeyPath == nil { + out.RawString("null") + } else { + (*in.KeyPath).MarshalEasyJSON(out) } - if len(in.Indexes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"indexes\":") - if in.Indexes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.Indexes { - if v8 > 0 { - out.RawByte(',') - } - if v9 == nil { - out.RawString("null") - } else { - (*v9).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"autoIncrement\":") + out.Bool(bool(in.AutoIncrement)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"indexes\":") + if in.Indexes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Indexes { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + (*v9).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -941,22 +925,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb8(out *jwriter.Writer (*in.Upper).MarshalEasyJSON(out) } } - if in.LowerOpen { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lowerOpen\":") - out.Bool(bool(in.LowerOpen)) + if !first { + out.RawByte(',') } - if in.UpperOpen { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"upperOpen\":") - out.Bool(bool(in.UpperOpen)) + first = false + out.RawString("\"lowerOpen\":") + out.Bool(bool(in.LowerOpen)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"upperOpen\":") + out.Bool(bool(in.UpperOpen)) out.RawByte('}') } @@ -1043,14 +1023,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb9(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.String != "" { if !first { out.RawByte(',') @@ -1176,14 +1154,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb10(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Number != 0 { if !first { out.RawByte(',') @@ -1518,44 +1494,38 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Version != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"version\":") - out.Int64(int64(in.Version)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if len(in.ObjectStores) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"objectStores\":") - if in.ObjectStores == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v17, v18 := range in.ObjectStores { - if v17 > 0 { - out.RawByte(',') - } - if v18 == nil { - out.RawString("null") - } else { - (*v18).MarshalEasyJSON(out) - } + first = false + out.RawString("\"version\":") + out.Int64(int64(in.Version)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"objectStores\":") + if in.ObjectStores == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v17, v18 := range in.ObjectStores { + if v17 > 0 { + out.RawByte(',') + } + if v18 == nil { + out.RawString("null") + } else { + (*v18).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -1646,41 +1616,35 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.Key != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"key\":") - if in.Key == nil { - out.RawString("null") - } else { - (*in.Key).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.PrimaryKey != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"primaryKey\":") - if in.PrimaryKey == nil { - out.RawString("null") - } else { - (*in.PrimaryKey).MarshalEasyJSON(out) - } + first = false + out.RawString("\"key\":") + if in.Key == nil { + out.RawString("null") + } else { + (*in.Key).MarshalEasyJSON(out) } - if in.Value != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - if in.Value == nil { - out.RawString("null") - } else { - (*in.Value).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"primaryKey\":") + if in.PrimaryKey == nil { + out.RawString("null") + } else { + (*in.PrimaryKey).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/cdp/indexeddb/types.go b/cdp/indexeddb/types.go index 4d9f58f..8bc7071 100644 --- a/cdp/indexeddb/types.go +++ b/cdp/indexeddb/types.go @@ -13,30 +13,30 @@ import ( // DatabaseWithObjectStores database with an array of object stores. type DatabaseWithObjectStores struct { - Name string `json:"name,omitempty"` // Database name. - Version int64 `json:"version,omitempty"` // Database version. - ObjectStores []*ObjectStore `json:"objectStores,omitempty"` // Object stores in this database. + Name string `json:"name"` // Database name. + Version int64 `json:"version"` // Database version. + ObjectStores []*ObjectStore `json:"objectStores"` // Object stores in this database. } // ObjectStore object store. type ObjectStore struct { - Name string `json:"name,omitempty"` // Object store name. - KeyPath *KeyPath `json:"keyPath,omitempty"` // Object store key path. - AutoIncrement bool `json:"autoIncrement,omitempty"` // If true, object store has auto increment flag set. - Indexes []*ObjectStoreIndex `json:"indexes,omitempty"` // Indexes in this object store. + Name string `json:"name"` // Object store name. + KeyPath *KeyPath `json:"keyPath"` // Object store key path. + AutoIncrement bool `json:"autoIncrement"` // If true, object store has auto increment flag set. + Indexes []*ObjectStoreIndex `json:"indexes"` // Indexes in this object store. } // ObjectStoreIndex object store index. type ObjectStoreIndex struct { - Name string `json:"name,omitempty"` // Index name. - KeyPath *KeyPath `json:"keyPath,omitempty"` // Index key path. - Unique bool `json:"unique,omitempty"` // If true, index is unique. - MultiEntry bool `json:"multiEntry,omitempty"` // If true, index allows multiple entries for a key. + Name string `json:"name"` // Index name. + KeyPath *KeyPath `json:"keyPath"` // Index key path. + Unique bool `json:"unique"` // If true, index is unique. + MultiEntry bool `json:"multiEntry"` // If true, index allows multiple entries for a key. } // Key key. type Key struct { - Type KeyType `json:"type,omitempty"` // Key type. + Type KeyType `json:"type"` // Key type. Number float64 `json:"number,omitempty"` // Number value. String string `json:"string,omitempty"` // String value. Date float64 `json:"date,omitempty"` // Date value. @@ -45,22 +45,22 @@ type Key struct { // KeyRange key range. type KeyRange struct { - Lower *Key `json:"lower,omitempty"` // Lower bound. - Upper *Key `json:"upper,omitempty"` // Upper bound. - LowerOpen bool `json:"lowerOpen,omitempty"` // If true lower bound is open. - UpperOpen bool `json:"upperOpen,omitempty"` // If true upper bound is open. + Lower *Key `json:"lower,omitempty"` // Lower bound. + Upper *Key `json:"upper,omitempty"` // Upper bound. + LowerOpen bool `json:"lowerOpen"` // If true lower bound is open. + UpperOpen bool `json:"upperOpen"` // If true upper bound is open. } // DataEntry data entry. type DataEntry struct { - Key *runtime.RemoteObject `json:"key,omitempty"` // Key object. - PrimaryKey *runtime.RemoteObject `json:"primaryKey,omitempty"` // Primary key object. - Value *runtime.RemoteObject `json:"value,omitempty"` // Value object. + Key *runtime.RemoteObject `json:"key"` // Key object. + PrimaryKey *runtime.RemoteObject `json:"primaryKey"` // Primary key object. + Value *runtime.RemoteObject `json:"value"` // Value object. } // KeyPath key path. type KeyPath struct { - Type KeyPathType `json:"type,omitempty"` // Key path type. + Type KeyPathType `json:"type"` // Key path type. String string `json:"string,omitempty"` // String value. Array []string `json:"array,omitempty"` // Array value. } diff --git a/cdp/input/easyjson.go b/cdp/input/easyjson.go index 4afb3bd..f66685d 100644 --- a/cdp/input/easyjson.go +++ b/cdp/input/easyjson.go @@ -67,30 +67,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.State != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"state\":") - (in.State).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.X != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"x\":") - out.Int64(int64(in.X)) + first = false + out.RawString("\"state\":") + (in.State).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Y != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"y\":") - out.Int64(int64(in.Y)) + first = false + out.RawString("\"x\":") + out.Int64(int64(in.X)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"y\":") + out.Int64(int64(in.Y)) if in.RadiusX != 0 { if !first { out.RawByte(',') diff --git a/cdp/input/types.go b/cdp/input/types.go index 16974b2..36cdb3d 100644 --- a/cdp/input/types.go +++ b/cdp/input/types.go @@ -13,9 +13,9 @@ import ( // TouchPoint [no description]. type TouchPoint struct { - State TouchState `json:"state,omitempty"` // State of the touch point. - X int64 `json:"x,omitempty"` // X coordinate of the event relative to the main frame's viewport. - Y int64 `json:"y,omitempty"` // Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. + State TouchState `json:"state"` // State of the touch point. + X int64 `json:"x"` // X coordinate of the event relative to the main frame's viewport. + Y int64 `json:"y"` // Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. RadiusX int64 `json:"radiusX,omitempty"` // X radius of the touch area (default: 1). RadiusY int64 `json:"radiusY,omitempty"` // Y radius of the touch area (default: 1). RotationAngle float64 `json:"rotationAngle,omitempty"` // Rotation angle (default: 0.0). diff --git a/cdp/inspector/easyjson.go b/cdp/inspector/easyjson.go index 2644b7b..d741c94 100644 --- a/cdp/inspector/easyjson.go +++ b/cdp/inspector/easyjson.go @@ -111,14 +111,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Reason != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"reason\":") - (in.Reason).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"reason\":") + (in.Reason).MarshalEasyJSON(out) out.RawByte('}') } diff --git a/cdp/inspector/events.go b/cdp/inspector/events.go index 804694d..585cd5d 100644 --- a/cdp/inspector/events.go +++ b/cdp/inspector/events.go @@ -9,7 +9,7 @@ import ( // EventDetached fired when remote debugging connection is about to be // terminated. Contains detach reason. type EventDetached struct { - Reason DetachReason `json:"reason,omitempty"` // The reason why connection has been terminated. + Reason DetachReason `json:"reason"` // The reason why connection has been terminated. } // EventTargetCrashed fired when debugging target has crashed. diff --git a/cdp/layertree/easyjson.go b/cdp/layertree/easyjson.go index 404ba21..b26f967 100644 --- a/cdp/layertree/easyjson.go +++ b/cdp/layertree/easyjson.go @@ -231,26 +231,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree2(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Rect != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"rect\":") - if in.Rect == nil { - out.RawString("null") - } else { - (*in.Rect).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"rect\":") + if in.Rect == nil { + out.RawString("null") + } else { + (*in.Rect).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) out.RawByte('}') } @@ -791,30 +787,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree8(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.X != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"x\":") - out.Float64(float64(in.X)) + if !first { + out.RawByte(',') } - if in.Y != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"y\":") - out.Float64(float64(in.Y)) + first = false + out.RawString("\"x\":") + out.Float64(float64(in.X)) + if !first { + out.RawByte(',') } - if in.Picture != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"picture\":") - out.String(string(in.Picture)) + first = false + out.RawString("\"y\":") + out.Float64(float64(in.Y)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"picture\":") + out.String(string(in.Picture)) out.RawByte('}') } @@ -1270,14 +1260,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree13(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.LayerID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"layerId\":") - out.String(string(in.LayerID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"layerId\":") + out.String(string(in.LayerID)) if in.ParentLayerID != "" { if !first { out.RawByte(',') @@ -1294,38 +1282,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree13(out *jwriter.Write out.RawString("\"backendNodeId\":") out.Int64(int64(in.BackendNodeID)) } - if in.OffsetX != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offsetX\":") - out.Float64(float64(in.OffsetX)) + if !first { + out.RawByte(',') } - if in.OffsetY != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offsetY\":") - out.Float64(float64(in.OffsetY)) + first = false + out.RawString("\"offsetX\":") + out.Float64(float64(in.OffsetX)) + if !first { + out.RawByte(',') } - if in.Width != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"width\":") - out.Float64(float64(in.Width)) + first = false + out.RawString("\"offsetY\":") + out.Float64(float64(in.OffsetY)) + if !first { + out.RawByte(',') } - if in.Height != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"height\":") - out.Float64(float64(in.Height)) + first = false + out.RawString("\"width\":") + out.Float64(float64(in.Width)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"height\":") + out.Float64(float64(in.Height)) if len(in.Transform) != 0 { if !first { out.RawByte(',') @@ -1369,22 +1349,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree13(out *jwriter.Write out.RawString("\"anchorZ\":") out.Float64(float64(in.AnchorZ)) } - if in.PaintCount != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"paintCount\":") - out.Int64(int64(in.PaintCount)) + if !first { + out.RawByte(',') } - if in.DrawsContent { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"drawsContent\":") - out.Bool(bool(in.DrawsContent)) + first = false + out.RawString("\"paintCount\":") + out.Int64(int64(in.PaintCount)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"drawsContent\":") + out.Bool(bool(in.DrawsContent)) if in.Invisible { if !first { out.RawByte(',') @@ -1600,25 +1576,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLayertree15(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.LayerID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"layerId\":") - out.String(string(in.LayerID)) + if !first { + out.RawByte(',') } - if in.Clip != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"clip\":") - if in.Clip == nil { - out.RawString("null") - } else { - (*in.Clip).MarshalEasyJSON(out) - } + first = false + out.RawString("\"layerId\":") + out.String(string(in.LayerID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"clip\":") + if in.Clip == nil { + out.RawString("null") + } else { + (*in.Clip).MarshalEasyJSON(out) } out.RawByte('}') } diff --git a/cdp/layertree/events.go b/cdp/layertree/events.go index 90dcf4a..4d59eb1 100644 --- a/cdp/layertree/events.go +++ b/cdp/layertree/events.go @@ -14,8 +14,8 @@ type EventLayerTreeDidChange struct { // EventLayerPainted [no description]. type EventLayerPainted struct { - LayerID LayerID `json:"layerId,omitempty"` // The id of the painted layer. - Clip *dom.Rect `json:"clip,omitempty"` // Clip rectangle. + LayerID LayerID `json:"layerId"` // The id of the painted layer. + Clip *dom.Rect `json:"clip"` // Clip rectangle. } // EventTypes all event types in the domain. diff --git a/cdp/layertree/types.go b/cdp/layertree/types.go index 333248a..095294c 100644 --- a/cdp/layertree/types.go +++ b/cdp/layertree/types.go @@ -30,33 +30,33 @@ func (t SnapshotID) String() string { // ScrollRect rectangle where scrolling happens on the main thread. type ScrollRect struct { - Rect *dom.Rect `json:"rect,omitempty"` // Rectangle itself. - Type ScrollRectType `json:"type,omitempty"` // Reason for rectangle to force scrolling on the main thread + Rect *dom.Rect `json:"rect"` // Rectangle itself. + Type ScrollRectType `json:"type"` // Reason for rectangle to force scrolling on the main thread } // PictureTile serialized fragment of layer picture along with its offset // within the layer. type PictureTile struct { - X float64 `json:"x,omitempty"` // Offset from owning layer left boundary - Y float64 `json:"y,omitempty"` // Offset from owning layer top boundary - Picture string `json:"picture,omitempty"` // Base64-encoded snapshot data. + X float64 `json:"x"` // Offset from owning layer left boundary + Y float64 `json:"y"` // Offset from owning layer top boundary + Picture string `json:"picture"` // Base64-encoded snapshot data. } // Layer information about a compositing layer. type Layer struct { - LayerID LayerID `json:"layerId,omitempty"` // The unique id for this layer. + LayerID LayerID `json:"layerId"` // The unique id for this layer. ParentLayerID LayerID `json:"parentLayerId,omitempty"` // The id of parent (not present for root). BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // The backend id for the node associated with this layer. - OffsetX float64 `json:"offsetX,omitempty"` // Offset from parent layer, X coordinate. - OffsetY float64 `json:"offsetY,omitempty"` // Offset from parent layer, Y coordinate. - Width float64 `json:"width,omitempty"` // Layer width. - Height float64 `json:"height,omitempty"` // Layer height. + OffsetX float64 `json:"offsetX"` // Offset from parent layer, X coordinate. + OffsetY float64 `json:"offsetY"` // Offset from parent layer, Y coordinate. + Width float64 `json:"width"` // Layer width. + Height float64 `json:"height"` // Layer height. Transform []float64 `json:"transform,omitempty"` // Transformation matrix for layer, default is identity matrix AnchorX float64 `json:"anchorX,omitempty"` // Transform anchor point X, absent if no transform specified AnchorY float64 `json:"anchorY,omitempty"` // Transform anchor point Y, absent if no transform specified AnchorZ float64 `json:"anchorZ,omitempty"` // Transform anchor point Z, absent if no transform specified - PaintCount int64 `json:"paintCount,omitempty"` // Indicates how many time this layer has painted. - DrawsContent bool `json:"drawsContent,omitempty"` // Indicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only. + PaintCount int64 `json:"paintCount"` // Indicates how many time this layer has painted. + DrawsContent bool `json:"drawsContent"` // Indicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only. Invisible bool `json:"invisible,omitempty"` // Set if layer is not visible. ScrollRects []*ScrollRect `json:"scrollRects,omitempty"` // Rectangles scrolling on main thread only. } diff --git a/cdp/log/easyjson.go b/cdp/log/easyjson.go index 05a9b1e..410d98e 100644 --- a/cdp/log/easyjson.go +++ b/cdp/log/easyjson.go @@ -56,22 +56,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(out *jwriter.Writer, in Vi out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - (in.Name).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Threshold != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"threshold\":") - out.Float64(float64(in.Threshold)) + first = false + out.RawString("\"name\":") + (in.Name).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"threshold\":") + out.Float64(float64(in.Threshold)) out.RawByte('}') } @@ -311,17 +307,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in E 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) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"entry\":") + if in.Entry == nil { + out.RawString("null") + } else { + (*in.Entry).MarshalEasyJSON(out) } out.RawByte('}') } @@ -416,41 +410,33 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in E out.RawByte('{') first := true _ = first - if in.Source != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"source\":") - (in.Source).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Level != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"level\":") - (in.Level).MarshalEasyJSON(out) + first = false + out.RawString("\"source\":") + (in.Source).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + first = false + out.RawString("\"level\":") + (in.Level).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } if in.URL != "" { if !first { diff --git a/cdp/log/events.go b/cdp/log/events.go index 6dce98f..57be595 100644 --- a/cdp/log/events.go +++ b/cdp/log/events.go @@ -8,7 +8,7 @@ import ( // EventEntryAdded issued when new message was logged. type EventEntryAdded struct { - Entry *Entry `json:"entry,omitempty"` // The entry. + Entry *Entry `json:"entry"` // The entry. } // EventTypes all event types in the domain. diff --git a/cdp/log/types.go b/cdp/log/types.go index e8c3fab..d456a72 100644 --- a/cdp/log/types.go +++ b/cdp/log/types.go @@ -14,10 +14,10 @@ import ( // Entry log entry. type Entry struct { - Source Source `json:"source,omitempty"` // Log entry source. - Level Level `json:"level,omitempty"` // Log entry severity. - Text string `json:"text,omitempty"` // Logged text. - Timestamp *runtime.Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added. + Source Source `json:"source"` // Log entry source. + Level Level `json:"level"` // Log entry severity. + Text string `json:"text"` // Logged text. + Timestamp *runtime.Timestamp `json:"timestamp"` // Timestamp when this entry was added. URL string `json:"url,omitempty"` // URL of the resource if known. LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the resource. StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace. @@ -27,8 +27,8 @@ type Entry struct { // ViolationSetting violation configuration setting. type ViolationSetting struct { - Name Violation `json:"name,omitempty"` // Violation type. - Threshold float64 `json:"threshold,omitempty"` // Time threshold to trigger upon. + Name Violation `json:"name"` // Violation type. + Threshold float64 `json:"threshold"` // Time threshold to trigger upon. } // Source log entry source. diff --git a/cdp/network/easyjson.go b/cdp/network/easyjson.go index 8f090f1..6475483 100644 --- a/cdp/network/easyjson.go +++ b/cdp/network/easyjson.go @@ -113,50 +113,44 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork(out *jwriter.Writer, i out.RawByte('{') first := true _ = first - if in.Status != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - out.Float64(float64(in.Status)) + if !first { + out.RawByte(',') } - if in.StatusText != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"statusText\":") - out.String(string(in.StatusText)) + first = false + out.RawString("\"status\":") + out.Float64(float64(in.Status)) + if !first { + out.RawByte(',') } - if len(in.Headers) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"headers\":") - if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { - out.RawString(`null`) - } else { - out.RawByte('{') - v3First := true - for v3Name, v3Value := range in.Headers { - if !v3First { - out.RawByte(',') - } - v3First = false - out.String(string(v3Name)) - out.RawByte(':') - if m, ok := v3Value.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := v3Value.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(v3Value)) - } + first = false + out.RawString("\"statusText\":") + out.String(string(in.StatusText)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { + out.RawString(`null`) + } else { + out.RawByte('{') + v3First := true + for v3Name, v3Value := range in.Headers { + if !v3First { + out.RawByte(',') + } + v3First = false + out.String(string(v3Name)) + out.RawByte(':') + if m, ok := v3Value.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := v3Value.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(v3Value)) } - out.RawByte('}') } + out.RawByte('}') } if in.HeadersText != "" { if !first { @@ -288,34 +282,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork1(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if len(in.Headers) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"headers\":") - if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { - out.RawString(`null`) - } else { - out.RawByte('{') - v6First := true - for v6Name, v6Value := range in.Headers { - if !v6First { - out.RawByte(',') - } - v6First = false - out.String(string(v6Name)) - out.RawByte(':') - if m, ok := v6Value.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := v6Value.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(v6Value)) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { + out.RawString(`null`) + } else { + out.RawByte('{') + v6First := true + for v6Name, v6Value := range in.Headers { + if !v6First { + out.RawByte(',') + } + v6First = false + out.String(string(v6Name)) + out.RawByte(':') + if m, ok := v6Value.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := v6Value.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(v6Value)) } - out.RawByte('}') } + out.RawByte('}') } out.RawByte('}') } @@ -382,30 +374,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork2(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Opcode != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"opcode\":") - out.Float64(float64(in.Opcode)) + if !first { + out.RawByte(',') } - if in.Mask { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"mask\":") - out.Bool(bool(in.Mask)) + first = false + out.RawString("\"opcode\":") + out.Float64(float64(in.Opcode)) + if !first { + out.RawByte(',') } - if in.PayloadData != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"payloadData\":") - out.String(string(in.PayloadData)) + first = false + out.RawString("\"mask\":") + out.Bool(bool(in.Mask)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"payloadData\":") + out.String(string(in.PayloadData)) out.RawByte('}') } @@ -489,74 +475,58 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork3(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Status != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - out.String(string(in.Status)) + if !first { + out.RawByte(',') } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - out.String(string(in.Origin)) + first = false + out.RawString("\"status\":") + out.String(string(in.Status)) + if !first { + out.RawByte(',') } - if in.LogDescription != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"logDescription\":") - out.String(string(in.LogDescription)) + first = false + out.RawString("\"origin\":") + out.String(string(in.Origin)) + if !first { + out.RawByte(',') } - if in.LogID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"logId\":") - out.String(string(in.LogID)) + first = false + out.RawString("\"logDescription\":") + out.String(string(in.LogDescription)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"logId\":") + out.String(string(in.LogID)) + if !first { + out.RawByte(',') } - if in.HashAlgorithm != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hashAlgorithm\":") - out.String(string(in.HashAlgorithm)) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.SignatureAlgorithm != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"signatureAlgorithm\":") - out.String(string(in.SignatureAlgorithm)) + if !first { + out.RawByte(',') } - if in.SignatureData != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"signatureData\":") - out.String(string(in.SignatureData)) + first = false + out.RawString("\"hashAlgorithm\":") + out.String(string(in.HashAlgorithm)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"signatureAlgorithm\":") + out.String(string(in.SignatureAlgorithm)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"signatureData\":") + out.String(string(in.SignatureData)) out.RawByte('}') } @@ -1417,22 +1387,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork12(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Protocol != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"protocol\":") - out.String(string(in.Protocol)) + if !first { + out.RawByte(',') } - if in.KeyExchange != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"keyExchange\":") - out.String(string(in.KeyExchange)) + first = false + out.RawString("\"protocol\":") + out.String(string(in.Protocol)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"keyExchange\":") + out.String(string(in.KeyExchange)) if in.KeyExchangeGroup != "" { if !first { out.RawByte(',') @@ -1441,14 +1407,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork12(out *jwriter.Writer, out.RawString("\"keyExchangeGroup\":") out.String(string(in.KeyExchangeGroup)) } - if in.Cipher != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"cipher\":") - out.String(string(in.Cipher)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"cipher\":") + out.String(string(in.Cipher)) if in.Mac != "" { if !first { out.RawByte(',') @@ -1457,95 +1421,81 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork12(out *jwriter.Writer, out.RawString("\"mac\":") out.String(string(in.Mac)) } - if in.CertificateID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"certificateId\":") - out.Int64(int64(in.CertificateID)) + if !first { + out.RawByte(',') } - if in.SubjectName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"subjectName\":") - out.String(string(in.SubjectName)) + first = false + out.RawString("\"certificateId\":") + out.Int64(int64(in.CertificateID)) + if !first { + out.RawByte(',') } - if len(in.SanList) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sanList\":") - if in.SanList == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v14, v15 := range in.SanList { - if v14 > 0 { - out.RawByte(',') - } - out.String(string(v15)) + first = false + out.RawString("\"subjectName\":") + out.String(string(in.SubjectName)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"sanList\":") + if in.SanList == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v14, v15 := range in.SanList { + if v14 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.String(string(v15)) } + out.RawByte(']') } - if in.Issuer != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"issuer\":") - out.String(string(in.Issuer)) + if !first { + out.RawByte(',') } - if in.ValidFrom != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"validFrom\":") - if in.ValidFrom == nil { - out.RawString("null") - } else { - (*in.ValidFrom).MarshalEasyJSON(out) - } + first = false + out.RawString("\"issuer\":") + out.String(string(in.Issuer)) + if !first { + out.RawByte(',') } - if in.ValidTo != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"validTo\":") - if in.ValidTo == nil { - out.RawString("null") - } else { - (*in.ValidTo).MarshalEasyJSON(out) - } + first = false + out.RawString("\"validFrom\":") + if in.ValidFrom == nil { + out.RawString("null") + } else { + (*in.ValidFrom).MarshalEasyJSON(out) } - if len(in.SignedCertificateTimestampList) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"signedCertificateTimestampList\":") - if in.SignedCertificateTimestampList == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v16, v17 := range in.SignedCertificateTimestampList { - if v16 > 0 { - out.RawByte(',') - } - if v17 == nil { - out.RawString("null") - } else { - (*v17).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"validTo\":") + if in.ValidTo == nil { + out.RawString("null") + } else { + (*in.ValidTo).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"signedCertificateTimestampList\":") + if in.SignedCertificateTimestampList == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v16, v17 := range in.SignedCertificateTimestampList { + if v16 > 0 { + out.RawByte(',') + } + if v17 == nil { + out.RawString("null") + } else { + (*v17).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -1708,58 +1658,50 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork13(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Status != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - out.Float64(float64(in.Status)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.StatusText != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"statusText\":") - out.String(string(in.StatusText)) + first = false + out.RawString("\"status\":") + out.Float64(float64(in.Status)) + if !first { + out.RawByte(',') } - if len(in.Headers) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"headers\":") - if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { - out.RawString(`null`) - } else { - out.RawByte('{') - v20First := true - for v20Name, v20Value := range in.Headers { - if !v20First { - out.RawByte(',') - } - v20First = false - out.String(string(v20Name)) - out.RawByte(':') - if m, ok := v20Value.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := v20Value.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(v20Value)) - } + first = false + out.RawString("\"statusText\":") + out.String(string(in.StatusText)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { + out.RawString(`null`) + } else { + out.RawByte('{') + v20First := true + for v20Name, v20Value := range in.Headers { + if !v20First { + out.RawByte(',') + } + v20First = false + out.String(string(v20Name)) + out.RawByte(':') + if m, ok := v20Value.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := v20Value.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(v20Value)) } - out.RawByte('}') } + out.RawByte('}') } if in.HeadersText != "" { if !first { @@ -1769,14 +1711,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork13(out *jwriter.Writer, out.RawString("\"headersText\":") out.String(string(in.HeadersText)) } - if in.MimeType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"mimeType\":") - out.String(string(in.MimeType)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"mimeType\":") + out.String(string(in.MimeType)) if len(in.RequestHeaders) != 0 { if !first { out.RawByte(',') @@ -1814,22 +1754,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork13(out *jwriter.Writer, out.RawString("\"requestHeadersText\":") out.String(string(in.RequestHeadersText)) } - if in.ConnectionReused { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"connectionReused\":") - out.Bool(bool(in.ConnectionReused)) + if !first { + out.RawByte(',') } - if in.ConnectionID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"connectionId\":") - out.Float64(float64(in.ConnectionID)) + first = false + out.RawString("\"connectionReused\":") + out.Bool(bool(in.ConnectionReused)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"connectionId\":") + out.Float64(float64(in.ConnectionID)) if in.RemoteIPAddress != "" { if !first { out.RawByte(',') @@ -1862,14 +1798,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork13(out *jwriter.Writer, out.RawString("\"fromServiceWorker\":") out.Bool(bool(in.FromServiceWorker)) } - if in.EncodedDataLength != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"encodedDataLength\":") - out.Float64(float64(in.EncodedDataLength)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"encodedDataLength\":") + out.Float64(float64(in.EncodedDataLength)) if in.Timing != nil { if !first { out.RawByte(',') @@ -1890,14 +1824,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork13(out *jwriter.Writer, out.RawString("\"protocol\":") out.String(string(in.Protocol)) } - if in.SecurityState != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityState\":") - (in.SecurityState).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"securityState\":") + (in.SecurityState).MarshalEasyJSON(out) if in.SecurityDetails != nil { if !first { out.RawByte(',') @@ -2001,134 +1933,102 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork14(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestTime\":") - out.Float64(float64(in.RequestTime)) + if !first { + out.RawByte(',') } - if in.ProxyStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"proxyStart\":") - out.Float64(float64(in.ProxyStart)) + first = false + out.RawString("\"requestTime\":") + out.Float64(float64(in.RequestTime)) + if !first { + out.RawByte(',') } - if in.ProxyEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"proxyEnd\":") - out.Float64(float64(in.ProxyEnd)) + first = false + out.RawString("\"proxyStart\":") + out.Float64(float64(in.ProxyStart)) + if !first { + out.RawByte(',') } - if in.DNSStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"dnsStart\":") - out.Float64(float64(in.DNSStart)) + first = false + out.RawString("\"proxyEnd\":") + out.Float64(float64(in.ProxyEnd)) + if !first { + out.RawByte(',') } - if in.DNSEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"dnsEnd\":") - out.Float64(float64(in.DNSEnd)) + first = false + out.RawString("\"dnsStart\":") + out.Float64(float64(in.DNSStart)) + if !first { + out.RawByte(',') } - if in.ConnectStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"connectStart\":") - out.Float64(float64(in.ConnectStart)) + first = false + out.RawString("\"dnsEnd\":") + out.Float64(float64(in.DNSEnd)) + if !first { + out.RawByte(',') } - if in.ConnectEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"connectEnd\":") - out.Float64(float64(in.ConnectEnd)) + first = false + out.RawString("\"connectStart\":") + out.Float64(float64(in.ConnectStart)) + if !first { + out.RawByte(',') } - if in.SslStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sslStart\":") - out.Float64(float64(in.SslStart)) + first = false + out.RawString("\"connectEnd\":") + out.Float64(float64(in.ConnectEnd)) + if !first { + out.RawByte(',') } - if in.SslEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sslEnd\":") - out.Float64(float64(in.SslEnd)) + first = false + out.RawString("\"sslStart\":") + out.Float64(float64(in.SslStart)) + if !first { + out.RawByte(',') } - if in.WorkerStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"workerStart\":") - out.Float64(float64(in.WorkerStart)) + first = false + out.RawString("\"sslEnd\":") + out.Float64(float64(in.SslEnd)) + if !first { + out.RawByte(',') } - if in.WorkerReady != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"workerReady\":") - out.Float64(float64(in.WorkerReady)) + first = false + out.RawString("\"workerStart\":") + out.Float64(float64(in.WorkerStart)) + if !first { + out.RawByte(',') } - if in.SendStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sendStart\":") - out.Float64(float64(in.SendStart)) + first = false + out.RawString("\"workerReady\":") + out.Float64(float64(in.WorkerReady)) + if !first { + out.RawByte(',') } - if in.SendEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sendEnd\":") - out.Float64(float64(in.SendEnd)) + first = false + out.RawString("\"sendStart\":") + out.Float64(float64(in.SendStart)) + if !first { + out.RawByte(',') } - if in.PushStart != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pushStart\":") - out.Float64(float64(in.PushStart)) + first = false + out.RawString("\"sendEnd\":") + out.Float64(float64(in.SendEnd)) + if !first { + out.RawByte(',') } - if in.PushEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pushEnd\":") - out.Float64(float64(in.PushEnd)) + first = false + out.RawString("\"pushStart\":") + out.Float64(float64(in.PushStart)) + if !first { + out.RawByte(',') } - if in.ReceiveHeadersEnd != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"receiveHeadersEnd\":") - out.Float64(float64(in.ReceiveHeadersEnd)) + first = false + out.RawString("\"pushEnd\":") + out.Float64(float64(in.PushEnd)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"receiveHeadersEnd\":") + out.Float64(float64(in.ReceiveHeadersEnd)) out.RawByte('}') } @@ -2228,50 +2128,44 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork15(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Method != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"method\":") - out.String(string(in.Method)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if len(in.Headers) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"headers\":") - if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { - out.RawString(`null`) - } else { - out.RawByte('{') - v23First := true - for v23Name, v23Value := range in.Headers { - if !v23First { - out.RawByte(',') - } - v23First = false - out.String(string(v23Name)) - out.RawByte(':') - if m, ok := v23Value.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := v23Value.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(v23Value)) - } + first = false + out.RawString("\"method\":") + out.String(string(in.Method)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"headers\":") + if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { + out.RawString(`null`) + } else { + out.RawByte('{') + v23First := true + for v23Name, v23Value := range in.Headers { + if !v23First { + out.RawByte(',') + } + v23First = false + out.String(string(v23Name)) + out.RawByte(':') + if m, ok := v23Value.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := v23Value.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(v23Value)) } - out.RawByte('}') } + out.RawByte('}') } if in.PostData != "" { if !first { @@ -2289,22 +2183,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork15(out *jwriter.Writer, out.RawString("\"mixedContentType\":") (in.MixedContentType).MarshalEasyJSON(out) } - if in.InitialPriority != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"initialPriority\":") - (in.InitialPriority).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.ReferrerPolicy != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"referrerPolicy\":") - (in.ReferrerPolicy).MarshalEasyJSON(out) + first = false + out.RawString("\"initialPriority\":") + (in.InitialPriority).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"referrerPolicy\":") + (in.ReferrerPolicy).MarshalEasyJSON(out) if in.IsLinkPreload { if !first { out.RawByte(',') @@ -2455,14 +2345,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork17(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Stack != nil { if !first { out.RawByte(',') @@ -3282,49 +3170,41 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork26(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.WallTime != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"wallTime\":") - if in.WallTime == nil { - out.RawString("null") - } else { - (*in.WallTime).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.Request != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"request\":") - if in.Request == nil { - out.RawString("null") - } else { - (*in.Request).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"wallTime\":") + if in.WallTime == nil { + out.RawString("null") + } else { + (*in.WallTime).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"request\":") + if in.Request == nil { + out.RawString("null") + } else { + (*in.Request).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3407,37 +3287,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork27(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Response != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - if in.Response == nil { - out.RawString("null") - } else { - (*in.Response).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"response\":") + if in.Response == nil { + out.RawString("null") + } else { + (*in.Response).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3520,37 +3394,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork28(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Response != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - if in.Response == nil { - out.RawString("null") - } else { - (*in.Response).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"response\":") + if in.Response == nil { + out.RawString("null") + } else { + (*in.Response).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3633,37 +3501,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork29(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Response != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - if in.Response == nil { - out.RawString("null") - } else { - (*in.Response).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"response\":") + if in.Response == nil { + out.RawString("null") + } else { + (*in.Response).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3738,34 +3600,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork30(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.ErrorMessage != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"errorMessage\":") - out.String(string(in.ErrorMessage)) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"errorMessage\":") + out.String(string(in.ErrorMessage)) out.RawByte('}') } @@ -3839,22 +3695,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork31(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) if in.Initiator != nil { if !first { out.RawByte(',') @@ -3938,25 +3790,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork32(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4045,61 +3893,49 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork33(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.LoaderID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"loaderId\":") - out.String(string(in.LoaderID)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"loaderId\":") + out.String(string(in.LoaderID)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.Response != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - if in.Response == nil { - out.RawString("null") - } else { - (*in.Response).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"response\":") + if in.Response == nil { + out.RawString("null") + } else { + (*in.Response).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4174,33 +4010,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork34(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.NewPriority != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"newPriority\":") - (in.NewPriority).MarshalEasyJSON(out) + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"newPriority\":") + (in.NewPriority).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4321,85 +4151,69 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork35(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.LoaderID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"loaderId\":") - out.String(string(in.LoaderID)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.DocumentURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"documentURL\":") - out.String(string(in.DocumentURL)) + first = false + out.RawString("\"loaderId\":") + out.String(string(in.LoaderID)) + if !first { + out.RawByte(',') } - if in.Request != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"request\":") - if in.Request == nil { - out.RawString("null") - } else { - (*in.Request).MarshalEasyJSON(out) - } + first = false + out.RawString("\"documentURL\":") + out.String(string(in.DocumentURL)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"request\":") + if in.Request == nil { + out.RawString("null") + } else { + (*in.Request).MarshalEasyJSON(out) } - if in.WallTime != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"wallTime\":") - if in.WallTime == nil { - out.RawString("null") - } else { - (*in.WallTime).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.Initiator != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"initiator\":") - if in.Initiator == nil { - out.RawString("null") - } else { - (*in.Initiator).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"wallTime\":") + if in.WallTime == nil { + out.RawString("null") + } else { + (*in.WallTime).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"initiator\":") + if in.Initiator == nil { + out.RawString("null") + } else { + (*in.Initiator).MarshalEasyJSON(out) } if in.RedirectResponse != nil { if !first { @@ -4482,14 +4296,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork36(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) out.RawByte('}') } @@ -4603,34 +4415,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork37(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.InterceptionID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"interceptionId\":") - out.String(string(in.InterceptionID)) + if !first { + out.RawByte(',') } - if in.Request != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"request\":") - if in.Request == nil { - out.RawString("null") - } else { - (*in.Request).MarshalEasyJSON(out) - } + first = false + out.RawString("\"interceptionId\":") + out.String(string(in.InterceptionID)) + if !first { + out.RawByte(',') } - if in.ResourceType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"resourceType\":") - (in.ResourceType).MarshalEasyJSON(out) + first = false + out.RawString("\"request\":") + if in.Request == nil { + out.RawString("null") + } else { + (*in.Request).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"resourceType\":") + (in.ResourceType).MarshalEasyJSON(out) if len(in.RedirectHeaders) != 0 { if !first { out.RawByte(',') @@ -4761,34 +4567,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.EncodedDataLength != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"encodedDataLength\":") - out.Float64(float64(in.EncodedDataLength)) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"encodedDataLength\":") + out.Float64(float64(in.EncodedDataLength)) out.RawByte('}') } @@ -4868,42 +4668,34 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork39(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.ErrorText != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"errorText\":") - out.String(string(in.ErrorText)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"errorText\":") + out.String(string(in.ErrorText)) if in.Canceled { if !first { out.RawByte(',') @@ -4997,50 +4789,40 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork40(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.EventName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"eventName\":") - out.String(string(in.EventName)) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.EventID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"eventId\":") - out.String(string(in.EventID)) + if !first { + out.RawByte(',') } - if in.Data != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"data\":") - out.String(string(in.Data)) + first = false + out.RawString("\"eventName\":") + out.String(string(in.EventName)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"eventId\":") + out.String(string(in.EventID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"data\":") + out.String(string(in.Data)) out.RawByte('}') } @@ -5116,42 +4898,34 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork41(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RequestID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestId\":") - out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"requestId\":") + out.String(string(in.RequestID)) + if !first { + out.RawByte(',') } - if in.DataLength != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"dataLength\":") - out.Int64(int64(in.DataLength)) + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } - if in.EncodedDataLength != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"encodedDataLength\":") - out.Int64(int64(in.EncodedDataLength)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"dataLength\":") + out.Int64(int64(in.DataLength)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"encodedDataLength\":") + out.Int64(int64(in.EncodedDataLength)) out.RawByte('}') } @@ -5612,78 +5386,60 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork47(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Value != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - out.String(string(in.Value)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Domain != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"domain\":") - out.String(string(in.Domain)) + first = false + out.RawString("\"value\":") + out.String(string(in.Value)) + if !first { + out.RawByte(',') } - if in.Path != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"path\":") - out.String(string(in.Path)) + first = false + out.RawString("\"domain\":") + out.String(string(in.Domain)) + if !first { + out.RawByte(',') } - if in.Expires != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"expires\":") - out.Float64(float64(in.Expires)) + first = false + out.RawString("\"path\":") + out.String(string(in.Path)) + if !first { + out.RawByte(',') } - if in.Size != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"size\":") - out.Int64(int64(in.Size)) + first = false + out.RawString("\"expires\":") + out.Float64(float64(in.Expires)) + if !first { + out.RawByte(',') } - if in.HTTPOnly { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"httpOnly\":") - out.Bool(bool(in.HTTPOnly)) + first = false + out.RawString("\"size\":") + out.Int64(int64(in.Size)) + if !first { + out.RawByte(',') } - if in.Secure { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"secure\":") - out.Bool(bool(in.Secure)) + first = false + out.RawString("\"httpOnly\":") + out.Bool(bool(in.HTTPOnly)) + if !first { + out.RawByte(',') } - if in.Session { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"session\":") - out.Bool(bool(in.Session)) + first = false + out.RawString("\"secure\":") + out.Bool(bool(in.Secure)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"session\":") + out.Bool(bool(in.Session)) if in.SameSite != "" { if !first { out.RawByte(',') @@ -6463,22 +6219,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork57(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Response != nil { if !first { out.RawByte(',') @@ -6491,14 +6243,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork57(out *jwriter.Writer, (*in.Response).MarshalEasyJSON(out) } } - if in.BodySize != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"bodySize\":") - out.Float64(float64(in.BodySize)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"bodySize\":") + out.Float64(float64(in.BodySize)) out.RawByte('}') } @@ -6564,14 +6314,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork58(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Response != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"response\":") - (in.Response).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"response\":") + (in.Response).MarshalEasyJSON(out) if in.Username != "" { if !first { out.RawByte(',') @@ -6663,30 +6411,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork59(out *jwriter.Writer, out.RawString("\"source\":") (in.Source).MarshalEasyJSON(out) } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - out.String(string(in.Origin)) + if !first { + out.RawByte(',') } - if in.Scheme != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scheme\":") - out.String(string(in.Scheme)) + first = false + out.RawString("\"origin\":") + out.String(string(in.Origin)) + if !first { + out.RawByte(',') } - if in.Realm != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"realm\":") - out.String(string(in.Realm)) + first = false + out.RawString("\"scheme\":") + out.String(string(in.Scheme)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"realm\":") + out.String(string(in.Realm)) out.RawByte('}') } diff --git a/cdp/network/events.go b/cdp/network/events.go index e9c5e8b..0448d6a 100644 --- a/cdp/network/events.go +++ b/cdp/network/events.go @@ -10,61 +10,61 @@ import ( // EventResourceChangedPriority fired when resource loading priority is // changed. type EventResourceChangedPriority struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - NewPriority ResourcePriority `json:"newPriority,omitempty"` // New priority - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. + RequestID RequestID `json:"requestId"` // Request identifier. + NewPriority ResourcePriority `json:"newPriority"` // New priority + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. } // EventRequestWillBeSent fired when page is about to send HTTP request. type EventRequestWillBeSent struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier. - LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier. - DocumentURL string `json:"documentURL,omitempty"` // URL of the document this request is loaded for. - Request *Request `json:"request,omitempty"` // Request data. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - WallTime *cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp. - Initiator *Initiator `json:"initiator,omitempty"` // Request initiator. + RequestID RequestID `json:"requestId"` // Request identifier. + FrameID cdp.FrameID `json:"frameId"` // Frame identifier. + LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. + DocumentURL string `json:"documentURL"` // URL of the document this request is loaded for. + Request *Request `json:"request"` // Request data. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + WallTime *cdp.Timestamp `json:"wallTime"` // UTC Timestamp. + Initiator *Initiator `json:"initiator"` // Request initiator. RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data. Type page.ResourceType `json:"type,omitempty"` // Type of this resource. } // EventRequestServedFromCache fired if request ended up loading from cache. type EventRequestServedFromCache struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. + RequestID RequestID `json:"requestId"` // Request identifier. } // EventResponseReceived fired when HTTP response is available. type EventResponseReceived struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier. - LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - Type page.ResourceType `json:"type,omitempty"` // Resource type. - Response *Response `json:"response,omitempty"` // Response data. + RequestID RequestID `json:"requestId"` // Request identifier. + FrameID cdp.FrameID `json:"frameId"` // Frame identifier. + LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + Type page.ResourceType `json:"type"` // Resource type. + Response *Response `json:"response"` // Response data. } // EventDataReceived fired when data chunk was received over the network. type EventDataReceived struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - DataLength int64 `json:"dataLength,omitempty"` // Data chunk length. - EncodedDataLength int64 `json:"encodedDataLength,omitempty"` // Actual bytes received (might be less than dataLength for compressed encodings). + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + DataLength int64 `json:"dataLength"` // Data chunk length. + EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings). } // EventLoadingFinished fired when HTTP request has finished loading. type EventLoadingFinished struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request. } // EventLoadingFailed fired when HTTP request has failed to load. type EventLoadingFailed struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - Type page.ResourceType `json:"type,omitempty"` // Resource type. - ErrorText string `json:"errorText,omitempty"` // User friendly error message. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + Type page.ResourceType `json:"type"` // Resource type. + ErrorText string `json:"errorText"` // User friendly error message. Canceled bool `json:"canceled,omitempty"` // True if loading was canceled. BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any. } @@ -72,70 +72,70 @@ type EventLoadingFailed struct { // EventWebSocketWillSendHandshakeRequest fired when WebSocket is about to // initiate handshake. type EventWebSocketWillSendHandshakeRequest struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - WallTime *cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp. - Request *WebSocketRequest `json:"request,omitempty"` // WebSocket request data. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + WallTime *cdp.Timestamp `json:"wallTime"` // UTC Timestamp. + Request *WebSocketRequest `json:"request"` // WebSocket request data. } // EventWebSocketHandshakeResponseReceived fired when WebSocket handshake // response becomes available. type EventWebSocketHandshakeResponseReceived struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - Response *WebSocketResponse `json:"response,omitempty"` // WebSocket response data. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + Response *WebSocketResponse `json:"response"` // WebSocket response data. } // EventWebSocketCreated fired upon WebSocket creation. type EventWebSocketCreated struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - URL string `json:"url,omitempty"` // WebSocket request URL. + RequestID RequestID `json:"requestId"` // Request identifier. + URL string `json:"url"` // WebSocket request URL. Initiator *Initiator `json:"initiator,omitempty"` // Request initiator. } // EventWebSocketClosed fired when WebSocket is closed. type EventWebSocketClosed struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. } // EventWebSocketFrameReceived fired when WebSocket frame is received. type EventWebSocketFrameReceived struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + Response *WebSocketFrame `json:"response"` // WebSocket response data. } // EventWebSocketFrameError fired when WebSocket frame error occurs. type EventWebSocketFrameError struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - ErrorMessage string `json:"errorMessage,omitempty"` // WebSocket frame error message. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + ErrorMessage string `json:"errorMessage"` // WebSocket frame error message. } // EventWebSocketFrameSent fired when WebSocket frame is sent. type EventWebSocketFrameSent struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + Response *WebSocketFrame `json:"response"` // WebSocket response data. } // EventEventSourceMessageReceived fired when EventSource message is // received. type EventEventSourceMessageReceived struct { - RequestID RequestID `json:"requestId,omitempty"` // Request identifier. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp. - EventName string `json:"eventName,omitempty"` // Message type. - EventID string `json:"eventId,omitempty"` // Message identifier. - Data string `json:"data,omitempty"` // Message content. + RequestID RequestID `json:"requestId"` // Request identifier. + Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. + EventName string `json:"eventName"` // Message type. + EventID string `json:"eventId"` // Message identifier. + Data string `json:"data"` // Message content. } // EventRequestIntercepted details of an intercepted HTTP request, which must // be either allowed, blocked, modified or mocked. type EventRequestIntercepted struct { - InterceptionID InterceptionID `json:"interceptionId,omitempty"` // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used. - Request *Request `json:"request,omitempty"` - ResourceType page.ResourceType `json:"resourceType,omitempty"` // How the requested resource will be used. + InterceptionID InterceptionID `json:"interceptionId"` // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used. + Request *Request `json:"request"` + ResourceType page.ResourceType `json:"resourceType"` // How the requested resource will be used. RedirectHeaders Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted. RedirectStatusCode int64 `json:"redirectStatusCode,omitempty"` // HTTP response code, only sent if a redirect was intercepted. RedirectURL string `json:"redirectUrl,omitempty"` // Redirect location, only sent if a redirect was intercepted. diff --git a/cdp/network/types.go b/cdp/network/types.go index b0ff755..a344c3f 100644 --- a/cdp/network/types.go +++ b/cdp/network/types.go @@ -213,22 +213,22 @@ func (t *CookieSameSite) UnmarshalJSON(buf []byte) error { // ResourceTiming timing information for the request. type ResourceTiming struct { - RequestTime float64 `json:"requestTime,omitempty"` // Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime. - ProxyStart float64 `json:"proxyStart,omitempty"` // Started resolving proxy. - ProxyEnd float64 `json:"proxyEnd,omitempty"` // Finished resolving proxy. - DNSStart float64 `json:"dnsStart,omitempty"` // Started DNS address resolve. - DNSEnd float64 `json:"dnsEnd,omitempty"` // Finished DNS address resolve. - ConnectStart float64 `json:"connectStart,omitempty"` // Started connecting to the remote host. - ConnectEnd float64 `json:"connectEnd,omitempty"` // Connected to the remote host. - SslStart float64 `json:"sslStart,omitempty"` // Started SSL handshake. - SslEnd float64 `json:"sslEnd,omitempty"` // Finished SSL handshake. - WorkerStart float64 `json:"workerStart,omitempty"` // Started running ServiceWorker. - WorkerReady float64 `json:"workerReady,omitempty"` // Finished Starting ServiceWorker. - SendStart float64 `json:"sendStart,omitempty"` // Started sending request. - SendEnd float64 `json:"sendEnd,omitempty"` // Finished sending request. - PushStart float64 `json:"pushStart,omitempty"` // Time the server started pushing request. - PushEnd float64 `json:"pushEnd,omitempty"` // Time the server finished pushing request. - ReceiveHeadersEnd float64 `json:"receiveHeadersEnd,omitempty"` // Finished receiving response headers. + RequestTime float64 `json:"requestTime"` // Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime. + ProxyStart float64 `json:"proxyStart"` // Started resolving proxy. + ProxyEnd float64 `json:"proxyEnd"` // Finished resolving proxy. + DNSStart float64 `json:"dnsStart"` // Started DNS address resolve. + DNSEnd float64 `json:"dnsEnd"` // Finished DNS address resolve. + ConnectStart float64 `json:"connectStart"` // Started connecting to the remote host. + ConnectEnd float64 `json:"connectEnd"` // Connected to the remote host. + SslStart float64 `json:"sslStart"` // Started SSL handshake. + SslEnd float64 `json:"sslEnd"` // Finished SSL handshake. + WorkerStart float64 `json:"workerStart"` // Started running ServiceWorker. + WorkerReady float64 `json:"workerReady"` // Finished Starting ServiceWorker. + SendStart float64 `json:"sendStart"` // Started sending request. + SendEnd float64 `json:"sendEnd"` // Finished sending request. + PushStart float64 `json:"pushStart"` // Time the server started pushing request. + PushEnd float64 `json:"pushEnd"` // Time the server finished pushing request. + ReceiveHeadersEnd float64 `json:"receiveHeadersEnd"` // Finished receiving response headers. } // ResourcePriority loading priority of a resource request. @@ -284,43 +284,43 @@ func (t *ResourcePriority) UnmarshalJSON(buf []byte) error { // Request hTTP request data. type Request struct { - URL string `json:"url,omitempty"` // Request URL. - Method string `json:"method,omitempty"` // HTTP request method. - Headers Headers `json:"headers,omitempty"` // HTTP request headers. + URL string `json:"url"` // Request URL. + Method string `json:"method"` // HTTP request method. + Headers Headers `json:"headers"` // HTTP request headers. PostData string `json:"postData,omitempty"` // HTTP POST request data. MixedContentType MixedContentType `json:"mixedContentType,omitempty"` // The mixed content status of the request, as defined in http://www.w3.org/TR/mixed-content/ - InitialPriority ResourcePriority `json:"initialPriority,omitempty"` // Priority of the resource request at the time request is sent. - ReferrerPolicy ReferrerPolicy `json:"referrerPolicy,omitempty"` // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ + InitialPriority ResourcePriority `json:"initialPriority"` // Priority of the resource request at the time request is sent. + ReferrerPolicy ReferrerPolicy `json:"referrerPolicy"` // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ IsLinkPreload bool `json:"isLinkPreload,omitempty"` // Whether is loaded via link preload. } // SignedCertificateTimestamp details of a signed certificate timestamp // (SCT). type SignedCertificateTimestamp struct { - Status string `json:"status,omitempty"` // Validation status. - Origin string `json:"origin,omitempty"` // Origin. - LogDescription string `json:"logDescription,omitempty"` // Log name / description. - LogID string `json:"logId,omitempty"` // Log ID. - Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Issuance date. - HashAlgorithm string `json:"hashAlgorithm,omitempty"` // Hash algorithm. - SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"` // Signature algorithm. - SignatureData string `json:"signatureData,omitempty"` // Signature data. + Status string `json:"status"` // Validation status. + Origin string `json:"origin"` // Origin. + LogDescription string `json:"logDescription"` // Log name / description. + LogID string `json:"logId"` // Log ID. + Timestamp *cdp.Timestamp `json:"timestamp"` // Issuance date. + HashAlgorithm string `json:"hashAlgorithm"` // Hash algorithm. + SignatureAlgorithm string `json:"signatureAlgorithm"` // Signature algorithm. + SignatureData string `json:"signatureData"` // Signature data. } // SecurityDetails security details about a request. type SecurityDetails struct { - Protocol string `json:"protocol,omitempty"` // Protocol name (e.g. "TLS 1.2" or "QUIC"). - KeyExchange string `json:"keyExchange,omitempty"` // Key Exchange used by the connection, or the empty string if not applicable. - KeyExchangeGroup string `json:"keyExchangeGroup,omitempty"` // (EC)DH group used by the connection, if applicable. - Cipher string `json:"cipher,omitempty"` // Cipher name. - Mac string `json:"mac,omitempty"` // TLS MAC. Note that AEAD ciphers do not have separate MACs. - CertificateID security.CertificateID `json:"certificateId,omitempty"` // Certificate ID value. - SubjectName string `json:"subjectName,omitempty"` // Certificate subject name. - SanList []string `json:"sanList,omitempty"` // Subject Alternative Name (SAN) DNS names and IP addresses. - Issuer string `json:"issuer,omitempty"` // Name of the issuing CA. - ValidFrom *cdp.Timestamp `json:"validFrom,omitempty"` // Certificate valid from date. - ValidTo *cdp.Timestamp `json:"validTo,omitempty"` // Certificate valid to (expiration) date - SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList,omitempty"` // List of signed certificate timestamps (SCTs). + Protocol string `json:"protocol"` // Protocol name (e.g. "TLS 1.2" or "QUIC"). + KeyExchange string `json:"keyExchange"` // Key Exchange used by the connection, or the empty string if not applicable. + KeyExchangeGroup string `json:"keyExchangeGroup,omitempty"` // (EC)DH group used by the connection, if applicable. + Cipher string `json:"cipher"` // Cipher name. + Mac string `json:"mac,omitempty"` // TLS MAC. Note that AEAD ciphers do not have separate MACs. + CertificateID security.CertificateID `json:"certificateId"` // Certificate ID value. + SubjectName string `json:"subjectName"` // Certificate subject name. + SanList []string `json:"sanList"` // Subject Alternative Name (SAN) DNS names and IP addresses. + Issuer string `json:"issuer"` // Name of the issuing CA. + ValidFrom *cdp.Timestamp `json:"validFrom"` // Certificate valid from date. + ValidTo *cdp.Timestamp `json:"validTo"` // Certificate valid to (expiration) date + SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList"` // List of signed certificate timestamps (SCTs). } // BlockedReason the reason why request was blocked. @@ -379,37 +379,37 @@ func (t *BlockedReason) UnmarshalJSON(buf []byte) error { // Response hTTP response data. type Response struct { - URL string `json:"url,omitempty"` // Response URL. This URL can be different from CachedResource.url in case of redirect. - Status float64 `json:"status,omitempty"` // HTTP response status code. - StatusText string `json:"statusText,omitempty"` // HTTP response status text. - Headers Headers `json:"headers,omitempty"` // HTTP response headers. + URL string `json:"url"` // Response URL. This URL can be different from CachedResource.url in case of redirect. + Status float64 `json:"status"` // HTTP response status code. + StatusText string `json:"statusText"` // HTTP response status text. + Headers Headers `json:"headers"` // HTTP response headers. HeadersText string `json:"headersText,omitempty"` // HTTP response headers text. - MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser. + MimeType string `json:"mimeType"` // Resource mimeType as determined by the browser. RequestHeaders Headers `json:"requestHeaders,omitempty"` // Refined HTTP request headers that were actually transmitted over the network. RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text. - ConnectionReused bool `json:"connectionReused,omitempty"` // Specifies whether physical connection was actually reused for this request. - ConnectionID float64 `json:"connectionId,omitempty"` // Physical connection id that was actually used for this request. + ConnectionReused bool `json:"connectionReused"` // Specifies whether physical connection was actually reused for this request. + ConnectionID float64 `json:"connectionId"` // Physical connection id that was actually used for this request. RemoteIPAddress string `json:"remoteIPAddress,omitempty"` // Remote IP address. RemotePort int64 `json:"remotePort,omitempty"` // Remote port. FromDiskCache bool `json:"fromDiskCache,omitempty"` // Specifies that the request was served from the disk cache. FromServiceWorker bool `json:"fromServiceWorker,omitempty"` // Specifies that the request was served from the ServiceWorker. - EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request so far. + EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request so far. Timing *ResourceTiming `json:"timing,omitempty"` // Timing information for the given request. Protocol string `json:"protocol,omitempty"` // Protocol used to fetch this request. - SecurityState security.State `json:"securityState,omitempty"` // Security state of the request resource. + SecurityState security.State `json:"securityState"` // Security state of the request resource. SecurityDetails *SecurityDetails `json:"securityDetails,omitempty"` // Security details for the request. } // WebSocketRequest webSocket request data. type WebSocketRequest struct { - Headers Headers `json:"headers,omitempty"` // HTTP request headers. + Headers Headers `json:"headers"` // HTTP request headers. } // WebSocketResponse webSocket response data. type WebSocketResponse struct { - Status float64 `json:"status,omitempty"` // HTTP response status code. - StatusText string `json:"statusText,omitempty"` // HTTP response status text. - Headers Headers `json:"headers,omitempty"` // HTTP response headers. + Status float64 `json:"status"` // HTTP response status code. + StatusText string `json:"statusText"` // HTTP response status text. + Headers Headers `json:"headers"` // HTTP response headers. HeadersText string `json:"headersText,omitempty"` // HTTP response headers text. RequestHeaders Headers `json:"requestHeaders,omitempty"` // HTTP request headers. RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text. @@ -417,22 +417,22 @@ type WebSocketResponse struct { // WebSocketFrame webSocket frame data. type WebSocketFrame struct { - Opcode float64 `json:"opcode,omitempty"` // WebSocket frame opcode. - Mask bool `json:"mask,omitempty"` // WebSocke frame mask. - PayloadData string `json:"payloadData,omitempty"` // WebSocke frame payload data. + Opcode float64 `json:"opcode"` // WebSocket frame opcode. + Mask bool `json:"mask"` // WebSocke frame mask. + PayloadData string `json:"payloadData"` // WebSocke frame payload data. } // CachedResource information about the cached resource. type CachedResource struct { - URL string `json:"url,omitempty"` // Resource URL. This is the url of the original network request. - Type page.ResourceType `json:"type,omitempty"` // Type of this resource. + URL string `json:"url"` // Resource URL. This is the url of the original network request. + Type page.ResourceType `json:"type"` // Type of this resource. Response *Response `json:"response,omitempty"` // Cached response data. - BodySize float64 `json:"bodySize,omitempty"` // Cached response body size. + BodySize float64 `json:"bodySize"` // Cached response body size. } // Initiator information about the request initiator. type Initiator struct { - Type InitiatorType `json:"type,omitempty"` // Type of this initiator. + Type InitiatorType `json:"type"` // Type of this initiator. Stack *runtime.StackTrace `json:"stack,omitempty"` // Initiator JavaScript stack trace, set for Script only. URL string `json:"url,omitempty"` // Initiator URL, set for Parser type or for Script type (when script is importing module). LineNumber float64 `json:"lineNumber,omitempty"` // Initiator line number, set for Parser type or for Script type (when script is importing module) (0-based). @@ -440,29 +440,29 @@ type Initiator struct { // Cookie cookie object. type Cookie struct { - Name string `json:"name,omitempty"` // Cookie name. - Value string `json:"value,omitempty"` // Cookie value. - Domain string `json:"domain,omitempty"` // Cookie domain. - Path string `json:"path,omitempty"` // Cookie path. - Expires float64 `json:"expires,omitempty"` // Cookie expiration date as the number of seconds since the UNIX epoch. - Size int64 `json:"size,omitempty"` // Cookie size. - HTTPOnly bool `json:"httpOnly,omitempty"` // True if cookie is http-only. - Secure bool `json:"secure,omitempty"` // True if cookie is secure. - Session bool `json:"session,omitempty"` // True in case of session cookie. + Name string `json:"name"` // Cookie name. + Value string `json:"value"` // Cookie value. + Domain string `json:"domain"` // Cookie domain. + Path string `json:"path"` // Cookie path. + Expires float64 `json:"expires"` // Cookie expiration date as the number of seconds since the UNIX epoch. + Size int64 `json:"size"` // Cookie size. + HTTPOnly bool `json:"httpOnly"` // True if cookie is http-only. + Secure bool `json:"secure"` // True if cookie is secure. + Session bool `json:"session"` // True in case of session cookie. SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type. } // AuthChallenge authorization challenge for HTTP status code 401 or 407. type AuthChallenge struct { Source AuthChallengeSource `json:"source,omitempty"` // Source of the authentication challenge. - Origin string `json:"origin,omitempty"` // Origin of the challenger. - Scheme string `json:"scheme,omitempty"` // The authentication scheme used, such as basic or digest - Realm string `json:"realm,omitempty"` // The realm of the challenge. May be empty. + Origin string `json:"origin"` // Origin of the challenger. + Scheme string `json:"scheme"` // The authentication scheme used, such as basic or digest + Realm string `json:"realm"` // The realm of the challenge. May be empty. } // AuthChallengeResponse response to an AuthChallenge. type AuthChallengeResponse struct { - Response AuthChallengeResponseResponse `json:"response,omitempty"` // The decision on what to do in response to the authorization challenge. Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box. + Response AuthChallengeResponseResponse `json:"response"` // The decision on what to do in response to the authorization challenge. Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box. Username string `json:"username,omitempty"` // The username to provide, possibly empty. Should only be set if response is ProvideCredentials. Password string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials. } diff --git a/cdp/overlay/easyjson.go b/cdp/overlay/easyjson.go index d1d6786..773ce10 100644 --- a/cdp/overlay/easyjson.go +++ b/cdp/overlay/easyjson.go @@ -1571,14 +1571,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpOverlay16(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.NodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodeId\":") - out.Int64(int64(in.NodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"nodeId\":") + out.Int64(int64(in.NodeID)) out.RawByte('}') } @@ -1640,14 +1638,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpOverlay17(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.BackendNodeID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"backendNodeId\":") - out.Int64(int64(in.BackendNodeID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"backendNodeId\":") + out.Int64(int64(in.BackendNodeID)) out.RawByte('}') } diff --git a/cdp/overlay/events.go b/cdp/overlay/events.go index f982676..34f62eb 100644 --- a/cdp/overlay/events.go +++ b/cdp/overlay/events.go @@ -9,14 +9,14 @@ import ( // EventNodeHighlightRequested fired when the node should be highlighted. // This happens after call to setInspectMode. type EventNodeHighlightRequested struct { - NodeID cdp.NodeID `json:"nodeId,omitempty"` + NodeID cdp.NodeID `json:"nodeId"` } // EventInspectNodeRequested fired when the node should be inspected. This // happens after call to setInspectMode or when user manually inspects an // element. type EventInspectNodeRequested struct { - BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Id of the node to inspect. + BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Id of the node to inspect. } // EventTypes all event types in the domain. diff --git a/cdp/page/easyjson.go b/cdp/page/easyjson.go index 5a21396..99522ad 100644 --- a/cdp/page/easyjson.go +++ b/cdp/page/easyjson.go @@ -68,62 +68,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage(out *jwriter.Writer, in V out.RawByte('{') first := true _ = first - if in.OffsetX != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offsetX\":") - out.Float64(float64(in.OffsetX)) + if !first { + out.RawByte(',') } - if in.OffsetY != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offsetY\":") - out.Float64(float64(in.OffsetY)) + first = false + out.RawString("\"offsetX\":") + out.Float64(float64(in.OffsetX)) + if !first { + out.RawByte(',') } - if in.PageX != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pageX\":") - out.Float64(float64(in.PageX)) + first = false + out.RawString("\"offsetY\":") + out.Float64(float64(in.OffsetY)) + if !first { + out.RawByte(',') } - if in.PageY != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pageY\":") - out.Float64(float64(in.PageY)) + first = false + out.RawString("\"pageX\":") + out.Float64(float64(in.PageX)) + if !first { + out.RawByte(',') } - if in.ClientWidth != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"clientWidth\":") - out.Float64(float64(in.ClientWidth)) + first = false + out.RawString("\"pageY\":") + out.Float64(float64(in.PageY)) + if !first { + out.RawByte(',') } - if in.ClientHeight != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"clientHeight\":") - out.Float64(float64(in.ClientHeight)) + first = false + out.RawString("\"clientWidth\":") + out.Float64(float64(in.ClientWidth)) + if !first { + out.RawByte(',') } - if in.Scale != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scale\":") - out.Float64(float64(in.Scale)) + first = false + out.RawString("\"clientHeight\":") + out.Float64(float64(in.ClientHeight)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"scale\":") + out.Float64(float64(in.Scale)) out.RawByte('}') } @@ -857,54 +843,42 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage9(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.OffsetTop != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"offsetTop\":") - out.Float64(float64(in.OffsetTop)) + if !first { + out.RawByte(',') } - if in.PageScaleFactor != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pageScaleFactor\":") - out.Float64(float64(in.PageScaleFactor)) + first = false + out.RawString("\"offsetTop\":") + out.Float64(float64(in.OffsetTop)) + if !first { + out.RawByte(',') } - if in.DeviceWidth != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"deviceWidth\":") - out.Float64(float64(in.DeviceWidth)) + first = false + out.RawString("\"pageScaleFactor\":") + out.Float64(float64(in.PageScaleFactor)) + if !first { + out.RawByte(',') } - if in.DeviceHeight != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"deviceHeight\":") - out.Float64(float64(in.DeviceHeight)) + first = false + out.RawString("\"deviceWidth\":") + out.Float64(float64(in.DeviceWidth)) + if !first { + out.RawByte(',') } - if in.ScrollOffsetX != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scrollOffsetX\":") - out.Float64(float64(in.ScrollOffsetX)) + first = false + out.RawString("\"deviceHeight\":") + out.Float64(float64(in.DeviceHeight)) + if !first { + out.RawByte(',') } - if in.ScrollOffsetY != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scrollOffsetY\":") - out.Float64(float64(in.ScrollOffsetY)) + first = false + out.RawString("\"scrollOffsetX\":") + out.Float64(float64(in.ScrollOffsetX)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"scrollOffsetY\":") + out.Float64(float64(in.ScrollOffsetY)) if in.Timestamp != nil { if !first { out.RawByte(',') @@ -1571,46 +1545,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage17(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.ID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"id\":") + out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') } - if in.UserTypedURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"userTypedURL\":") - out.String(string(in.UserTypedURL)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Title != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"title\":") - out.String(string(in.Title)) + first = false + out.RawString("\"userTypedURL\":") + out.String(string(in.UserTypedURL)) + if !first { + out.RawByte(',') } - if in.TransitionType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"transitionType\":") - (in.TransitionType).MarshalEasyJSON(out) + first = false + out.RawString("\"title\":") + out.String(string(in.Title)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"transitionType\":") + (in.TransitionType).MarshalEasyJSON(out) out.RawByte('}') } @@ -1901,38 +1865,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage21(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.PageX != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pageX\":") - out.Int64(int64(in.PageX)) + if !first { + out.RawByte(',') } - if in.PageY != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"pageY\":") - out.Int64(int64(in.PageY)) + first = false + out.RawString("\"pageX\":") + out.Int64(int64(in.PageX)) + if !first { + out.RawByte(',') } - if in.ClientWidth != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"clientWidth\":") - out.Int64(int64(in.ClientWidth)) + first = false + out.RawString("\"pageY\":") + out.Int64(int64(in.PageY)) + if !first { + out.RawByte(',') } - if in.ClientHeight != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"clientHeight\":") - out.Int64(int64(in.ClientHeight)) + first = false + out.RawString("\"clientWidth\":") + out.Int64(int64(in.ClientWidth)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"clientHeight\":") + out.Int64(int64(in.ClientHeight)) out.RawByte('}') } @@ -2993,17 +2949,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage33(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Frame != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frame\":") - if in.Frame == nil { - out.RawString("null") - } else { - (*in.Frame).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"frame\":") + if in.Frame == nil { + out.RawString("null") + } else { + (*in.Frame).MarshalEasyJSON(out) } if len(in.ChildFrames) != 0 { if !first { @@ -3028,28 +2982,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage33(out *jwriter.Writer, in out.RawByte(']') } } - if len(in.Resources) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"resources\":") - if in.Resources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v14, v15 := range in.Resources { - if v14 > 0 { - out.RawByte(',') - } - if v15 == nil { - out.RawString("null") - } else { - (*v15).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"resources\":") + if in.Resources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v14, v15 := range in.Resources { + if v14 > 0 { + out.RawByte(',') + } + if v15 == nil { + out.RawString("null") + } else { + (*v15).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -3132,30 +3084,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage34(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.MimeType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"mimeType\":") - out.String(string(in.MimeType)) + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"mimeType\":") + out.String(string(in.MimeType)) if in.LastModified != nil { if !first { out.RawByte(',') @@ -3253,14 +3199,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage35(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Visible { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"visible\":") - out.Bool(bool(in.Visible)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"visible\":") + out.Bool(bool(in.Visible)) out.RawByte('}') } @@ -3334,34 +3278,28 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage36(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Data != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"data\":") - out.String(string(in.Data)) + if !first { + out.RawByte(',') } - if in.Metadata != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"metadata\":") - if in.Metadata == nil { - out.RawString("null") - } else { - (*in.Metadata).MarshalEasyJSON(out) - } + first = false + out.RawString("\"data\":") + out.String(string(in.Data)) + if !first { + out.RawByte(',') } - if in.SessionID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sessionId\":") - out.Int64(int64(in.SessionID)) + first = false + out.RawString("\"metadata\":") + if in.Metadata == nil { + out.RawString("null") + } else { + (*in.Metadata).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"sessionId\":") + out.Int64(int64(in.SessionID)) out.RawByte('}') } @@ -3429,38 +3367,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage37(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.IsInMainFrame { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isInMainFrame\":") - out.Bool(bool(in.IsInMainFrame)) + if !first { + out.RawByte(',') } - if in.IsRedirect { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isRedirect\":") - out.Bool(bool(in.IsRedirect)) + first = false + out.RawString("\"isInMainFrame\":") + out.Bool(bool(in.IsInMainFrame)) + if !first { + out.RawByte(',') } - if in.NavigationID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"navigationId\":") - out.Int64(int64(in.NavigationID)) + first = false + out.RawString("\"isRedirect\":") + out.Bool(bool(in.IsRedirect)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"navigationId\":") + out.Int64(int64(in.NavigationID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) out.RawByte('}') } @@ -3530,17 +3460,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage38(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3605,22 +3533,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage39(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Message != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"message\":") - out.String(string(in.Message)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"message\":") + out.String(string(in.Message)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) out.RawByte('}') } @@ -3682,14 +3606,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage40(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Result { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"result\":") - out.Bool(bool(in.Result)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"result\":") + out.Bool(bool(in.Result)) out.RawByte('}') } @@ -3869,14 +3791,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage43(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) out.RawByte('}') } @@ -3938,14 +3858,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage44(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) out.RawByte('}') } @@ -4009,22 +3927,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage45(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.Delay != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"delay\":") - out.Float64(float64(in.Delay)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"delay\":") + out.Float64(float64(in.Delay)) out.RawByte('}') } @@ -4153,17 +4067,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage47(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Frame != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frame\":") - if in.Frame == nil { - out.RawString("null") - } else { - (*in.Frame).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"frame\":") + if in.Frame == nil { + out.RawString("null") + } else { + (*in.Frame).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4226,14 +4138,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage48(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) out.RawByte('}') } @@ -4295,14 +4205,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage49(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) out.RawByte('}') } @@ -4376,22 +4284,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage50(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.FrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } - if in.ParentFrameID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"parentFrameId\":") - out.String(string(in.ParentFrameID)) + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"parentFrameId\":") + out.String(string(in.ParentFrameID)) if in.Stack != nil { if !first { out.RawByte(',') @@ -4473,17 +4377,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage51(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } out.RawByte('}') } @@ -4984,38 +4886,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in out.RawByte('{') first := true _ = first - if in.Message != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"message\":") - out.String(string(in.Message)) + if !first { + out.RawByte(',') } - if in.Critical != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"critical\":") - out.Int64(int64(in.Critical)) + first = false + out.RawString("\"message\":") + out.String(string(in.Message)) + if !first { + out.RawByte(',') } - if in.Line != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"line\":") - out.Int64(int64(in.Line)) + first = false + out.RawString("\"critical\":") + out.Int64(int64(in.Critical)) + if !first { + out.RawByte(',') } - if in.Column != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"column\":") - out.Int64(int64(in.Column)) + first = false + out.RawString("\"line\":") + out.Int64(int64(in.Line)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"column\":") + out.Int64(int64(in.Column)) out.RawByte('}') } diff --git a/cdp/page/events.go b/cdp/page/events.go index 4779359..8a8efb8 100644 --- a/cdp/page/events.go +++ b/cdp/page/events.go @@ -9,53 +9,53 @@ import ( // EventDomContentEventFired [no description]. type EventDomContentEventFired struct { - Timestamp *Bootstamp `json:"timestamp,omitempty"` + Timestamp *Bootstamp `json:"timestamp"` } // EventLoadEventFired [no description]. type EventLoadEventFired struct { - Timestamp *Bootstamp `json:"timestamp,omitempty"` + Timestamp *Bootstamp `json:"timestamp"` } // EventFrameAttached fired when frame has been attached to its parent. type EventFrameAttached struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been attached. - ParentFrameID cdp.FrameID `json:"parentFrameId,omitempty"` // Parent frame identifier. - Stack *runtime.StackTrace `json:"stack,omitempty"` // JavaScript stack trace of when frame was attached, only set if frame initiated from script. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has been attached. + ParentFrameID cdp.FrameID `json:"parentFrameId"` // Parent frame identifier. + Stack *runtime.StackTrace `json:"stack,omitempty"` // JavaScript stack trace of when frame was attached, only set if frame initiated from script. } // EventFrameNavigated fired once navigation of the frame has completed. // Frame is now associated with the new loader. type EventFrameNavigated struct { - Frame *cdp.Frame `json:"frame,omitempty"` // Frame object. + Frame *cdp.Frame `json:"frame"` // Frame object. } // EventFrameDetached fired when frame has been detached from its parent. type EventFrameDetached struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been detached. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has been detached. } // EventFrameStartedLoading fired when frame has started loading. type EventFrameStartedLoading struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has started loading. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has started loading. } // EventFrameStoppedLoading fired when frame has stopped loading. type EventFrameStoppedLoading struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has stopped loading. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has stopped loading. } // EventFrameScheduledNavigation fired when frame schedules a potential // navigation. type EventFrameScheduledNavigation struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has scheduled a navigation. - Delay float64 `json:"delay,omitempty"` // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has scheduled a navigation. + Delay float64 `json:"delay"` // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start. } // EventFrameClearedScheduledNavigation fired when frame no longer has a // scheduled navigation. type EventFrameClearedScheduledNavigation struct { - FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has cleared its scheduled navigation. + FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has cleared its scheduled navigation. } // EventFrameResized [no description]. @@ -64,28 +64,28 @@ type EventFrameResized struct{} // EventJavascriptDialogOpening fired when a JavaScript initiated dialog // (alert, confirm, prompt, or onbeforeunload) is about to open. type EventJavascriptDialogOpening struct { - Message string `json:"message,omitempty"` // Message that will be displayed by the dialog. - Type DialogType `json:"type,omitempty"` // Dialog type. + Message string `json:"message"` // Message that will be displayed by the dialog. + Type DialogType `json:"type"` // Dialog type. } // EventJavascriptDialogClosed fired when a JavaScript initiated dialog // (alert, confirm, prompt, or onbeforeunload) has been closed. type EventJavascriptDialogClosed struct { - Result bool `json:"result,omitempty"` // Whether dialog was confirmed. + Result bool `json:"result"` // Whether dialog was confirmed. } // EventScreencastFrame compressed image data requested by the // startScreencast. type EventScreencastFrame struct { - Data string `json:"data,omitempty"` // Base64-encoded compressed image. - Metadata *ScreencastFrameMetadata `json:"metadata,omitempty"` // Screencast frame metadata. - SessionID int64 `json:"sessionId,omitempty"` // Frame number. + Data string `json:"data"` // Base64-encoded compressed image. + Metadata *ScreencastFrameMetadata `json:"metadata"` // Screencast frame metadata. + SessionID int64 `json:"sessionId"` // Frame number. } // EventScreencastVisibilityChanged fired when the page with currently // enabled screencast was shown or hidden . type EventScreencastVisibilityChanged struct { - Visible bool `json:"visible,omitempty"` // True if the page is visible. + Visible bool `json:"visible"` // True if the page is visible. } // EventInterstitialShown fired when interstitial page was shown. @@ -98,10 +98,10 @@ type EventInterstitialHidden struct{} // throttles are enabled. The navigation will be deferred until // processNavigation is called. type EventNavigationRequested struct { - IsInMainFrame bool `json:"isInMainFrame,omitempty"` // Whether the navigation is taking place in the main frame or in a subframe. - IsRedirect bool `json:"isRedirect,omitempty"` // Whether the navigation has encountered a server redirect or not. - NavigationID int64 `json:"navigationId,omitempty"` - URL string `json:"url,omitempty"` // URL of requested navigation. + IsInMainFrame bool `json:"isInMainFrame"` // Whether the navigation is taking place in the main frame or in a subframe. + IsRedirect bool `json:"isRedirect"` // Whether the navigation has encountered a server redirect or not. + NavigationID int64 `json:"navigationId"` + URL string `json:"url"` // URL of requested navigation. } // EventTypes all event types in the domain. diff --git a/cdp/page/types.go b/cdp/page/types.go index edb5ee4..f2105ce 100644 --- a/cdp/page/types.go +++ b/cdp/page/types.go @@ -91,9 +91,9 @@ func (t *ResourceType) UnmarshalJSON(buf []byte) error { // FrameResource information about the Resource on the page. type FrameResource struct { - URL string `json:"url,omitempty"` // Resource URL. - Type ResourceType `json:"type,omitempty"` // Type of this resource. - MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser. + URL string `json:"url"` // Resource URL. + Type ResourceType `json:"type"` // Type of this resource. + MimeType string `json:"mimeType"` // Resource mimeType as determined by the browser. LastModified *cdp.Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server. ContentSize float64 `json:"contentSize,omitempty"` // Resource content size. Failed bool `json:"failed,omitempty"` // True if the resource failed to load. @@ -103,9 +103,9 @@ type FrameResource struct { // FrameResourceTree information about the Frame hierarchy along with their // cached resources. type FrameResourceTree struct { - Frame *cdp.Frame `json:"frame,omitempty"` // Frame information for this tree item. + Frame *cdp.Frame `json:"frame"` // Frame information for this tree item. ChildFrames []*FrameResourceTree `json:"childFrames,omitempty"` // Child frames. - Resources []*FrameResource `json:"resources,omitempty"` // Information about frame resources. + Resources []*FrameResource `json:"resources"` // Information about frame resources. } // ScriptIdentifier unique script identifier. @@ -190,22 +190,22 @@ func (t *TransitionType) UnmarshalJSON(buf []byte) error { // NavigationEntry navigation history entry. type NavigationEntry struct { - ID int64 `json:"id,omitempty"` // Unique id of the navigation history entry. - URL string `json:"url,omitempty"` // URL of the navigation history entry. - UserTypedURL string `json:"userTypedURL,omitempty"` // URL that the user typed in the url bar. - Title string `json:"title,omitempty"` // Title of the navigation history entry. - TransitionType TransitionType `json:"transitionType,omitempty"` // Transition type. + ID int64 `json:"id"` // Unique id of the navigation history entry. + URL string `json:"url"` // URL of the navigation history entry. + UserTypedURL string `json:"userTypedURL"` // URL that the user typed in the url bar. + Title string `json:"title"` // Title of the navigation history entry. + TransitionType TransitionType `json:"transitionType"` // Transition type. } // ScreencastFrameMetadata screencast frame metadata. type ScreencastFrameMetadata struct { - OffsetTop float64 `json:"offsetTop,omitempty"` // Top offset in DIP. - PageScaleFactor float64 `json:"pageScaleFactor,omitempty"` // Page scale factor. - DeviceWidth float64 `json:"deviceWidth,omitempty"` // Device screen width in DIP. - DeviceHeight float64 `json:"deviceHeight,omitempty"` // Device screen height in DIP. - ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Position of horizontal scroll in CSS pixels. - ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"` // Position of vertical scroll in CSS pixels. - Timestamp *Bootstamp `json:"timestamp,omitempty"` // Frame swap timestamp. + OffsetTop float64 `json:"offsetTop"` // Top offset in DIP. + PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor. + DeviceWidth float64 `json:"deviceWidth"` // Device screen width in DIP. + DeviceHeight float64 `json:"deviceHeight"` // Device screen height in DIP. + ScrollOffsetX float64 `json:"scrollOffsetX"` // Position of horizontal scroll in CSS pixels. + ScrollOffsetY float64 `json:"scrollOffsetY"` // Position of vertical scroll in CSS pixels. + Timestamp *Bootstamp `json:"timestamp,omitempty"` // Frame swap timestamp. } // DialogType javascript dialog type. @@ -258,10 +258,10 @@ func (t *DialogType) UnmarshalJSON(buf []byte) error { // AppManifestError error while paring app manifest. type AppManifestError struct { - Message string `json:"message,omitempty"` // Error message. - Critical int64 `json:"critical,omitempty"` // If criticial, this is a non-recoverable parse error. - Line int64 `json:"line,omitempty"` // Error line. - Column int64 `json:"column,omitempty"` // Error column. + Message string `json:"message"` // Error message. + Critical int64 `json:"critical"` // If criticial, this is a non-recoverable parse error. + Line int64 `json:"line"` // Error line. + Column int64 `json:"column"` // Error column. } // NavigationResponse proceed: allow the navigation; Cancel: cancel the @@ -313,21 +313,21 @@ func (t *NavigationResponse) UnmarshalJSON(buf []byte) error { // LayoutViewport layout viewport position and dimensions. type LayoutViewport struct { - PageX int64 `json:"pageX,omitempty"` // Horizontal offset relative to the document (CSS pixels). - PageY int64 `json:"pageY,omitempty"` // Vertical offset relative to the document (CSS pixels). - ClientWidth int64 `json:"clientWidth,omitempty"` // Width (CSS pixels), excludes scrollbar if present. - ClientHeight int64 `json:"clientHeight,omitempty"` // Height (CSS pixels), excludes scrollbar if present. + PageX int64 `json:"pageX"` // Horizontal offset relative to the document (CSS pixels). + PageY int64 `json:"pageY"` // Vertical offset relative to the document (CSS pixels). + ClientWidth int64 `json:"clientWidth"` // Width (CSS pixels), excludes scrollbar if present. + ClientHeight int64 `json:"clientHeight"` // Height (CSS pixels), excludes scrollbar if present. } // VisualViewport visual viewport position, dimensions, and scale. type VisualViewport struct { - OffsetX float64 `json:"offsetX,omitempty"` // Horizontal offset relative to the layout viewport (CSS pixels). - OffsetY float64 `json:"offsetY,omitempty"` // Vertical offset relative to the layout viewport (CSS pixels). - PageX float64 `json:"pageX,omitempty"` // Horizontal offset relative to the document (CSS pixels). - PageY float64 `json:"pageY,omitempty"` // Vertical offset relative to the document (CSS pixels). - ClientWidth float64 `json:"clientWidth,omitempty"` // Width (CSS pixels), excludes scrollbar if present. - ClientHeight float64 `json:"clientHeight,omitempty"` // Height (CSS pixels), excludes scrollbar if present. - Scale float64 `json:"scale,omitempty"` // Scale relative to the ideal viewport (size at width=device-width). + OffsetX float64 `json:"offsetX"` // Horizontal offset relative to the layout viewport (CSS pixels). + OffsetY float64 `json:"offsetY"` // Vertical offset relative to the layout viewport (CSS pixels). + PageX float64 `json:"pageX"` // Horizontal offset relative to the document (CSS pixels). + PageY float64 `json:"pageY"` // Vertical offset relative to the document (CSS pixels). + ClientWidth float64 `json:"clientWidth"` // Width (CSS pixels), excludes scrollbar if present. + ClientHeight float64 `json:"clientHeight"` // Height (CSS pixels), excludes scrollbar if present. + Scale float64 `json:"scale"` // Scale relative to the ideal viewport (size at width=device-width). } // Bootstamp bootstamp type. diff --git a/cdp/profiler/easyjson.go b/cdp/profiler/easyjson.go index d2e797b..d1421dd 100644 --- a/cdp/profiler/easyjson.go +++ b/cdp/profiler/easyjson.go @@ -653,44 +653,38 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler8(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if len(in.Functions) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"functions\":") - if in.Functions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.Functions { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - (*v6).MarshalEasyJSON(out) - } + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"functions\":") + if in.Functions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Functions { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -821,25 +815,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler9(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') } - if in.CallFrame != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"callFrame\":") - if in.CallFrame == nil { - out.RawString("null") - } else { - (*in.CallFrame).MarshalEasyJSON(out) - } + first = false + out.RawString("\"id\":") + out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"callFrame\":") + if in.CallFrame == nil { + out.RawString("null") + } else { + (*in.CallFrame).MarshalEasyJSON(out) } if in.HitCount != 0 { if !first { @@ -1039,45 +1029,39 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler10(out *jwriter.Writer out.RawByte('{') first := true _ = first - if len(in.Nodes) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"nodes\":") - if in.Nodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v16, v17 := range in.Nodes { - if v16 > 0 { - out.RawByte(',') - } - if v17 == nil { - out.RawString("null") - } else { - (*v17).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"nodes\":") + if in.Nodes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v16, v17 := range in.Nodes { + if v16 > 0 { + out.RawByte(',') + } + if v17 == nil { + out.RawString("null") + } else { + (*v17).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.StartTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startTime\":") - out.Float64(float64(in.StartTime)) + if !first { + out.RawByte(',') } - if in.EndTime != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endTime\":") - out.Float64(float64(in.EndTime)) + first = false + out.RawString("\"startTime\":") + out.Float64(float64(in.StartTime)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"endTime\":") + out.Float64(float64(in.EndTime)) if len(in.Samples) != 0 { if !first { out.RawByte(',') @@ -1179,22 +1163,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler11(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Line != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"line\":") - out.Int64(int64(in.Line)) + if !first { + out.RawByte(',') } - if in.Ticks != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ticks\":") - out.Int64(int64(in.Ticks)) + first = false + out.RawString("\"line\":") + out.Int64(int64(in.Line)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"ticks\":") + out.Int64(int64(in.Ticks)) out.RawByte('}') } @@ -1461,45 +1441,39 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler14(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.FunctionName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"functionName\":") - out.String(string(in.FunctionName)) + if !first { + out.RawByte(',') } - if len(in.Ranges) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ranges\":") - if in.Ranges == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v26, v27 := range in.Ranges { - if v26 > 0 { - out.RawByte(',') - } - if v27 == nil { - out.RawString("null") - } else { - (*v27).MarshalEasyJSON(out) - } + first = false + out.RawString("\"functionName\":") + out.String(string(in.FunctionName)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"ranges\":") + if in.Ranges == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v26, v27 := range in.Ranges { + if v26 > 0 { + out.RawByte(',') + } + if v27 == nil { + out.RawString("null") + } else { + (*v27).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.IsBlockCoverage { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isBlockCoverage\":") - out.Bool(bool(in.IsBlockCoverage)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"isBlockCoverage\":") + out.Bool(bool(in.IsBlockCoverage)) out.RawByte('}') } @@ -1573,25 +1547,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler15(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Location != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"location\":") - if in.Location == nil { - out.RawString("null") - } else { - (*in.Location).MarshalEasyJSON(out) - } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"location\":") + if in.Location == nil { + out.RawString("null") + } else { + (*in.Location).MarshalEasyJSON(out) } if in.Title != "" { if !first { @@ -1684,37 +1654,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler16(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.ID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Location != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"location\":") - if in.Location == nil { - out.RawString("null") - } else { - (*in.Location).MarshalEasyJSON(out) - } + first = false + out.RawString("\"id\":") + out.String(string(in.ID)) + if !first { + out.RawByte(',') } - if in.Profile != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"profile\":") - if in.Profile == nil { - out.RawString("null") - } else { - (*in.Profile).MarshalEasyJSON(out) - } + first = false + out.RawString("\"location\":") + if in.Location == nil { + out.RawString("null") + } else { + (*in.Location).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"profile\":") + if in.Profile == nil { + out.RawString("null") + } else { + (*in.Profile).MarshalEasyJSON(out) } if in.Title != "" { if !first { @@ -1907,30 +1871,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler19(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.StartOffset != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"startOffset\":") - out.Int64(int64(in.StartOffset)) + if !first { + out.RawByte(',') } - if in.EndOffset != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"endOffset\":") - out.Int64(int64(in.EndOffset)) + first = false + out.RawString("\"startOffset\":") + out.Int64(int64(in.StartOffset)) + if !first { + out.RawByte(',') } - if in.Count != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"count\":") - out.Int64(int64(in.Count)) + first = false + out.RawString("\"endOffset\":") + out.Int64(int64(in.EndOffset)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"count\":") + out.Int64(int64(in.Count)) out.RawByte('}') } diff --git a/cdp/profiler/events.go b/cdp/profiler/events.go index 09a009b..bd98a72 100644 --- a/cdp/profiler/events.go +++ b/cdp/profiler/events.go @@ -10,16 +10,16 @@ import ( // EventConsoleProfileStarted sent when new profile recording is started // using console.profile() call. type EventConsoleProfileStarted struct { - ID string `json:"id,omitempty"` - Location *debugger.Location `json:"location,omitempty"` // Location of console.profile(). - Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile(). + ID string `json:"id"` + Location *debugger.Location `json:"location"` // Location of console.profile(). + Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile(). } // EventConsoleProfileFinished [no description]. type EventConsoleProfileFinished struct { - ID string `json:"id,omitempty"` - Location *debugger.Location `json:"location,omitempty"` // Location of console.profileEnd(). - Profile *Profile `json:"profile,omitempty"` + ID string `json:"id"` + Location *debugger.Location `json:"location"` // Location of console.profileEnd(). + Profile *Profile `json:"profile"` Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile(). } diff --git a/cdp/profiler/types.go b/cdp/profiler/types.go index bbb0adc..204ebeb 100644 --- a/cdp/profiler/types.go +++ b/cdp/profiler/types.go @@ -7,8 +7,8 @@ import "github.com/knq/chromedp/cdp/runtime" // ProfileNode profile node. Holds callsite information, execution statistics // and child nodes. type ProfileNode struct { - ID int64 `json:"id,omitempty"` // Unique id of the node. - CallFrame *runtime.CallFrame `json:"callFrame,omitempty"` // Function location. + ID int64 `json:"id"` // Unique id of the node. + CallFrame *runtime.CallFrame `json:"callFrame"` // Function location. HitCount int64 `json:"hitCount,omitempty"` // Number of samples where this node was on top of the call stack. Children []int64 `json:"children,omitempty"` // Child node ids. DeoptReason string `json:"deoptReason,omitempty"` // The reason of being not optimized. The function may be deoptimized or marked as don't optimize. @@ -17,9 +17,9 @@ type ProfileNode struct { // Profile profile. type Profile struct { - Nodes []*ProfileNode `json:"nodes,omitempty"` // The list of profile nodes. First item is the root node. - StartTime float64 `json:"startTime,omitempty"` // Profiling start timestamp in microseconds. - EndTime float64 `json:"endTime,omitempty"` // Profiling end timestamp in microseconds. + Nodes []*ProfileNode `json:"nodes"` // The list of profile nodes. First item is the root node. + StartTime float64 `json:"startTime"` // Profiling start timestamp in microseconds. + EndTime float64 `json:"endTime"` // Profiling end timestamp in microseconds. Samples []int64 `json:"samples,omitempty"` // Ids of samples top nodes. TimeDeltas []int64 `json:"timeDeltas,omitempty"` // Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. } @@ -27,27 +27,27 @@ type Profile struct { // PositionTickInfo specifies a number of samples attributed to a certain // source position. type PositionTickInfo struct { - Line int64 `json:"line,omitempty"` // Source line number (1-based). - Ticks int64 `json:"ticks,omitempty"` // Number of samples attributed to the source line. + Line int64 `json:"line"` // Source line number (1-based). + Ticks int64 `json:"ticks"` // Number of samples attributed to the source line. } // CoverageRange coverage data for a source range. type CoverageRange struct { - StartOffset int64 `json:"startOffset,omitempty"` // JavaScript script source offset for the range start. - EndOffset int64 `json:"endOffset,omitempty"` // JavaScript script source offset for the range end. - Count int64 `json:"count,omitempty"` // Collected execution count of the source range. + StartOffset int64 `json:"startOffset"` // JavaScript script source offset for the range start. + EndOffset int64 `json:"endOffset"` // JavaScript script source offset for the range end. + Count int64 `json:"count"` // Collected execution count of the source range. } // FunctionCoverage coverage data for a JavaScript function. type FunctionCoverage struct { - FunctionName string `json:"functionName,omitempty"` // JavaScript function name. - Ranges []*CoverageRange `json:"ranges,omitempty"` // Source ranges inside the function with coverage data. - IsBlockCoverage bool `json:"isBlockCoverage,omitempty"` // Whether coverage data for this function has block granularity. + FunctionName string `json:"functionName"` // JavaScript function name. + Ranges []*CoverageRange `json:"ranges"` // Source ranges inside the function with coverage data. + IsBlockCoverage bool `json:"isBlockCoverage"` // Whether coverage data for this function has block granularity. } // ScriptCoverage coverage data for a JavaScript script. type ScriptCoverage struct { - ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // JavaScript script id. - URL string `json:"url,omitempty"` // JavaScript script name or url. - Functions []*FunctionCoverage `json:"functions,omitempty"` // Functions contained in the script that has coverage data. + ScriptID runtime.ScriptID `json:"scriptId"` // JavaScript script id. + URL string `json:"url"` // JavaScript script name or url. + Functions []*FunctionCoverage `json:"functions"` // Functions contained in the script that has coverage data. } diff --git a/cdp/runtime/easyjson.go b/cdp/runtime/easyjson.go index fa94a67..cb133a7 100644 --- a/cdp/runtime/easyjson.go +++ b/cdp/runtime/easyjson.go @@ -111,28 +111,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime(out *jwriter.Writer, i out.RawString("\"description\":") out.String(string(in.Description)) } - if len(in.CallFrames) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"callFrames\":") - if in.CallFrames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.CallFrames { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - (*v3).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"callFrames\":") + if in.CallFrames == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.CallFrames { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } if in.Parent != nil { if !first { @@ -617,14 +615,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime5(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Subtype != "" { if !first { out.RawByte(',') @@ -908,22 +904,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime8(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Value != "" { if !first { out.RawByte(',') @@ -1063,14 +1055,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime9(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) if in.Value != nil { if !first { out.RawByte(',') @@ -1115,22 +1105,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime9(out *jwriter.Writer, (*in.Set).MarshalEasyJSON(out) } } - if in.Configurable { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"configurable\":") - out.Bool(bool(in.Configurable)) + if !first { + out.RawByte(',') } - if in.Enumerable { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"enumerable\":") - out.Bool(bool(in.Enumerable)) + first = false + out.RawString("\"configurable\":") + out.Bool(bool(in.Configurable)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"enumerable\":") + out.Bool(bool(in.Enumerable)) if in.WasThrown { if !first { out.RawByte(',') @@ -1288,14 +1274,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime10(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) if in.Subtype != "" { if !first { out.RawByte(',') @@ -1312,36 +1296,32 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime10(out *jwriter.Writer, out.RawString("\"description\":") out.String(string(in.Description)) } - if in.Overflow { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"overflow\":") - out.Bool(bool(in.Overflow)) + if !first { + out.RawByte(',') } - if len(in.Properties) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"properties\":") - if in.Properties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v6, v7 := range in.Properties { - if v6 > 0 { - out.RawByte(',') - } - if v7 == nil { - out.RawString("null") - } else { - (*v7).MarshalEasyJSON(out) - } + first = false + out.RawString("\"overflow\":") + out.Bool(bool(in.Overflow)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"properties\":") + if in.Properties == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v6, v7 := range in.Properties { + if v6 > 0 { + out.RawByte(',') + } + if v7 == nil { + out.RawString("null") + } else { + (*v7).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } if len(in.Entries) != 0 { if !first { @@ -1437,14 +1417,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime11(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) if in.Value != nil { if !first { out.RawByte(',') @@ -1810,30 +1788,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime14(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"id\":") - out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') } - if in.Origin != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"origin\":") - out.String(string(in.Origin)) + first = false + out.RawString("\"id\":") + out.Int64(int64(in.ID)) + if !first { + out.RawByte(',') } - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + first = false + out.RawString("\"origin\":") + out.String(string(in.Origin)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) if (in.AuxData).IsDefined() { if !first { out.RawByte(',') @@ -1935,38 +1907,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime15(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ExceptionID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"exceptionId\":") - out.Int64(int64(in.ExceptionID)) + if !first { + out.RawByte(',') } - if in.Text != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"text\":") - out.String(string(in.Text)) + first = false + out.RawString("\"exceptionId\":") + out.Int64(int64(in.ExceptionID)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"text\":") + out.String(string(in.Text)) + if !first { + out.RawByte(',') } - if in.ColumnNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"columnNumber\":") - out.Int64(int64(in.ColumnNumber)) + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"columnNumber\":") + out.Int64(int64(in.ColumnNumber)) if in.ScriptID != "" { if !first { out.RawByte(',') @@ -2086,26 +2050,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime16(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Object != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"object\":") - if in.Object == nil { - out.RawString("null") - } else { - (*in.Object).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if (in.Hints).IsDefined() { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hints\":") - (in.Hints).MarshalEasyJSON(out) + first = false + out.RawString("\"object\":") + if in.Object == nil { + out.RawString("null") + } else { + (*in.Object).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"hints\":") + (in.Hints).MarshalEasyJSON(out) out.RawByte('}') } @@ -2226,14 +2186,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime18(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.ExecutionContextID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"executionContextId\":") - out.Int64(int64(in.ExecutionContextID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"executionContextId\":") + out.Int64(int64(in.ExecutionContextID)) out.RawByte('}') } @@ -2303,17 +2261,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime19(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Context != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"context\":") - if in.Context == nil { - out.RawString("null") - } else { - (*in.Context).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"context\":") + if in.Context == nil { + out.RawString("null") + } else { + (*in.Context).MarshalEasyJSON(out) } out.RawByte('}') } @@ -2394,29 +2350,25 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime20(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.ExceptionDetails != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"exceptionDetails\":") - if in.ExceptionDetails == nil { - out.RawString("null") - } else { - (*in.ExceptionDetails).MarshalEasyJSON(out) - } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"exceptionDetails\":") + if in.ExceptionDetails == nil { + out.RawString("null") + } else { + (*in.ExceptionDetails).MarshalEasyJSON(out) } out.RawByte('}') } @@ -2481,22 +2433,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime21(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Reason != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"reason\":") - out.String(string(in.Reason)) + if !first { + out.RawByte(',') } - if in.ExceptionID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"exceptionId\":") - out.Int64(int64(in.ExceptionID)) + first = false + out.RawString("\"reason\":") + out.String(string(in.Reason)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"exceptionId\":") + out.Int64(int64(in.ExceptionID)) out.RawByte('}') } @@ -2613,56 +2561,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime22(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if len(in.Args) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"args\":") - if in.Args == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v17, v18 := range in.Args { - if v17 > 0 { - out.RawByte(',') - } - if v18 == nil { - out.RawString("null") - } else { - (*v18).MarshalEasyJSON(out) - } + first = false + out.RawString("\"type\":") + (in.Type).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"args\":") + if in.Args == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v17, v18 := range in.Args { + if v17 > 0 { + out.RawByte(',') + } + if v18 == nil { + out.RawString("null") + } else { + (*v18).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.ExecutionContextID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"executionContextId\":") - out.Int64(int64(in.ExecutionContextID)) + if !first { + out.RawByte(',') } - if in.Timestamp != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"timestamp\":") - if in.Timestamp == nil { - out.RawString("null") - } else { - (*in.Timestamp).MarshalEasyJSON(out) - } + first = false + out.RawString("\"executionContextId\":") + out.Int64(int64(in.ExecutionContextID)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"timestamp\":") + if in.Timestamp == nil { + out.RawString("null") + } else { + (*in.Timestamp).MarshalEasyJSON(out) } if in.StackTrace != nil { if !first { @@ -3025,17 +2965,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime25(out *jwriter.Writer, (*in.Key).MarshalEasyJSON(out) } } - if in.Value != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - if in.Value == nil { - out.RawString("null") - } else { - (*in.Value).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil { + out.RawString("null") + } else { + (*in.Value).MarshalEasyJSON(out) } out.RawByte('}') } @@ -3283,38 +3221,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime29(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Header != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"header\":") - out.String(string(in.Header)) + if !first { + out.RawByte(',') } - if in.HasBody { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hasBody\":") - out.Bool(bool(in.HasBody)) + first = false + out.RawString("\"header\":") + out.String(string(in.Header)) + if !first { + out.RawByte(',') } - if in.FormatterObjectID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"formatterObjectId\":") - out.String(string(in.FormatterObjectID)) + first = false + out.RawString("\"hasBody\":") + out.Bool(bool(in.HasBody)) + if !first { + out.RawByte(',') } - if in.BindRemoteObjectFunctionID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"bindRemoteObjectFunctionId\":") - out.String(string(in.BindRemoteObjectFunctionID)) + first = false + out.RawString("\"formatterObjectId\":") + out.String(string(in.FormatterObjectID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"bindRemoteObjectFunctionId\":") + out.String(string(in.BindRemoteObjectFunctionID)) if in.ConfigObjectID != "" { if !first { out.RawByte(',') @@ -3858,46 +3788,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime34(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.FunctionName != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"functionName\":") - out.String(string(in.FunctionName)) + if !first { + out.RawByte(',') } - if in.ScriptID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptId\":") - out.String(string(in.ScriptID)) + first = false + out.RawString("\"functionName\":") + out.String(string(in.FunctionName)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"scriptId\":") + out.String(string(in.ScriptID)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } - if in.ColumnNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"columnNumber\":") - out.Int64(int64(in.ColumnNumber)) + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"columnNumber\":") + out.Int64(int64(in.ColumnNumber)) out.RawByte('}') } diff --git a/cdp/runtime/events.go b/cdp/runtime/events.go index 2dfafa0..476a94d 100644 --- a/cdp/runtime/events.go +++ b/cdp/runtime/events.go @@ -9,12 +9,12 @@ import ( // EventExecutionContextCreated issued when new execution context is created. type EventExecutionContextCreated struct { - Context *ExecutionContextDescription `json:"context,omitempty"` // A newly created execution context. + Context *ExecutionContextDescription `json:"context"` // A newly created execution context. } // EventExecutionContextDestroyed issued when execution context is destroyed. type EventExecutionContextDestroyed struct { - ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Id of the destroyed context + ExecutionContextID ExecutionContextID `json:"executionContextId"` // Id of the destroyed context } // EventExecutionContextsCleared issued when all executionContexts were @@ -23,31 +23,31 @@ type EventExecutionContextsCleared struct{} // EventExceptionThrown issued when exception was thrown and unhandled. type EventExceptionThrown struct { - Timestamp *Timestamp `json:"timestamp,omitempty"` // Timestamp of the exception. - ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` + Timestamp *Timestamp `json:"timestamp"` // Timestamp of the exception. + ExceptionDetails *ExceptionDetails `json:"exceptionDetails"` } // EventExceptionRevoked issued when unhandled exception was revoked. type EventExceptionRevoked struct { - Reason string `json:"reason,omitempty"` // Reason describing why exception was revoked. - ExceptionID int64 `json:"exceptionId,omitempty"` // The id of revoked exception, as reported in exceptionUnhandled. + Reason string `json:"reason"` // Reason describing why exception was revoked. + ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionUnhandled. } // EventConsoleAPICalled issued when console API was called. type EventConsoleAPICalled struct { - Type APIType `json:"type,omitempty"` // Type of the call. - Args []*RemoteObject `json:"args,omitempty"` // Call arguments. - ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where the call was made. - Timestamp *Timestamp `json:"timestamp,omitempty"` // Call timestamp. - StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made. - Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. + Type APIType `json:"type"` // Type of the call. + Args []*RemoteObject `json:"args"` // Call arguments. + ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made. + Timestamp *Timestamp `json:"timestamp"` // Call timestamp. + StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made. + Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. } // EventInspectRequested issued when object should be inspected (for example, // as a result of inspect() command line API call). type EventInspectRequested struct { - Object *RemoteObject `json:"object,omitempty"` - Hints easyjson.RawMessage `json:"hints,omitempty"` + Object *RemoteObject `json:"object"` + Hints easyjson.RawMessage `json:"hints"` } // EventTypes all event types in the domain. diff --git a/cdp/runtime/types.go b/cdp/runtime/types.go index cb7eb4c..a336b58 100644 --- a/cdp/runtime/types.go +++ b/cdp/runtime/types.go @@ -79,7 +79,7 @@ func (t *UnserializableValue) UnmarshalJSON(buf []byte) error { // RemoteObject mirror object referencing original JavaScript object. type RemoteObject struct { - Type Type `json:"type,omitempty"` // Object type. + Type Type `json:"type"` // Object type. Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only. ClassName string `json:"className,omitempty"` // Object class (constructor) name. Specified for object type values only. Value easyjson.RawMessage `json:"value,omitempty"` // Remote object value in case of primitive values or JSON values (if it was requested). @@ -92,27 +92,27 @@ type RemoteObject struct { // CustomPreview [no description]. type CustomPreview struct { - Header string `json:"header,omitempty"` - HasBody bool `json:"hasBody,omitempty"` - FormatterObjectID RemoteObjectID `json:"formatterObjectId,omitempty"` - BindRemoteObjectFunctionID RemoteObjectID `json:"bindRemoteObjectFunctionId,omitempty"` + Header string `json:"header"` + HasBody bool `json:"hasBody"` + FormatterObjectID RemoteObjectID `json:"formatterObjectId"` + BindRemoteObjectFunctionID RemoteObjectID `json:"bindRemoteObjectFunctionId"` ConfigObjectID RemoteObjectID `json:"configObjectId,omitempty"` } // ObjectPreview object containing abbreviated remote object value. type ObjectPreview struct { - Type Type `json:"type,omitempty"` // Object type. + Type Type `json:"type"` // Object type. Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only. Description string `json:"description,omitempty"` // String representation of the object. - Overflow bool `json:"overflow,omitempty"` // True iff some of the properties or entries of the original object did not fit. - Properties []*PropertyPreview `json:"properties,omitempty"` // List of the properties. + Overflow bool `json:"overflow"` // True iff some of the properties or entries of the original object did not fit. + Properties []*PropertyPreview `json:"properties"` // List of the properties. Entries []*EntryPreview `json:"entries,omitempty"` // List of the entries. Specified for map and set subtype values only. } // PropertyPreview [no description]. type PropertyPreview struct { - Name string `json:"name,omitempty"` // Property name. - Type Type `json:"type,omitempty"` // Object type. Accessor means that the property itself is an accessor property. + Name string `json:"name"` // Property name. + Type Type `json:"type"` // Object type. Accessor means that the property itself is an accessor property. Value string `json:"value,omitempty"` // User-friendly property value string. ValuePreview *ObjectPreview `json:"valuePreview,omitempty"` // Nested value preview. Subtype Subtype `json:"subtype,omitempty"` // Object subtype hint. Specified for object type values only. @@ -120,28 +120,28 @@ type PropertyPreview struct { // EntryPreview [no description]. type EntryPreview struct { - Key *ObjectPreview `json:"key,omitempty"` // Preview of the key. Specified for map-like collection entries. - Value *ObjectPreview `json:"value,omitempty"` // Preview of the value. + Key *ObjectPreview `json:"key,omitempty"` // Preview of the key. Specified for map-like collection entries. + Value *ObjectPreview `json:"value"` // Preview of the value. } // PropertyDescriptor object property descriptor. type PropertyDescriptor struct { - Name string `json:"name,omitempty"` // Property name or symbol description. - Value *RemoteObject `json:"value,omitempty"` // The value associated with the property. - Writable bool `json:"writable,omitempty"` // True if the value associated with the property may be changed (data descriptors only). - Get *RemoteObject `json:"get,omitempty"` // A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - Set *RemoteObject `json:"set,omitempty"` // A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - Configurable bool `json:"configurable,omitempty"` // True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - Enumerable bool `json:"enumerable,omitempty"` // True if this property shows up during enumeration of the properties on the corresponding object. - WasThrown bool `json:"wasThrown,omitempty"` // True if the result was thrown during the evaluation. - IsOwn bool `json:"isOwn,omitempty"` // True if the property is owned for the object. - Symbol *RemoteObject `json:"symbol,omitempty"` // Property symbol object, if the property is of the symbol type. + Name string `json:"name"` // Property name or symbol description. + Value *RemoteObject `json:"value,omitempty"` // The value associated with the property. + Writable bool `json:"writable,omitempty"` // True if the value associated with the property may be changed (data descriptors only). + Get *RemoteObject `json:"get,omitempty"` // A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). + Set *RemoteObject `json:"set,omitempty"` // A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). + Configurable bool `json:"configurable"` // True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. + Enumerable bool `json:"enumerable"` // True if this property shows up during enumeration of the properties on the corresponding object. + WasThrown bool `json:"wasThrown,omitempty"` // True if the result was thrown during the evaluation. + IsOwn bool `json:"isOwn,omitempty"` // True if the property is owned for the object. + Symbol *RemoteObject `json:"symbol,omitempty"` // Property symbol object, if the property is of the symbol type. } // InternalPropertyDescriptor object internal property descriptor. This // property isn't normally visible in JavaScript code. type InternalPropertyDescriptor struct { - Name string `json:"name,omitempty"` // Conventional property name. + Name string `json:"name"` // Conventional property name. Value *RemoteObject `json:"value,omitempty"` // The value associated with the property. } @@ -164,19 +164,19 @@ func (t ExecutionContextID) Int64() int64 { // ExecutionContextDescription description of an isolated world. type ExecutionContextDescription struct { - ID ExecutionContextID `json:"id,omitempty"` // Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - Origin string `json:"origin,omitempty"` // Execution context origin. - Name string `json:"name,omitempty"` // Human readable name describing given context. + ID ExecutionContextID `json:"id"` // Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. + Origin string `json:"origin"` // Execution context origin. + Name string `json:"name"` // Human readable name describing given context. AuxData easyjson.RawMessage `json:"auxData,omitempty"` } // ExceptionDetails detailed information about exception (or error) that was // thrown during script compilation or execution. type ExceptionDetails struct { - ExceptionID int64 `json:"exceptionId,omitempty"` // Exception id. - Text string `json:"text,omitempty"` // Exception text, which should be used together with exception object when available. - LineNumber int64 `json:"lineNumber,omitempty"` // Line number of the exception location (0-based). - ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number of the exception location (0-based). + ExceptionID int64 `json:"exceptionId"` // Exception id. + Text string `json:"text"` // Exception text, which should be used together with exception object when available. + LineNumber int64 `json:"lineNumber"` // Line number of the exception location (0-based). + ColumnNumber int64 `json:"columnNumber"` // Column number of the exception location (0-based). ScriptID ScriptID `json:"scriptId,omitempty"` // Script ID of the exception location. URL string `json:"url,omitempty"` // URL of the exception location, to be used when the script was not reported. StackTrace *StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace if available. @@ -224,17 +224,17 @@ func (t *Timestamp) UnmarshalJSON(buf []byte) error { // CallFrame stack entry for runtime errors and assertions. type CallFrame struct { - FunctionName string `json:"functionName,omitempty"` // JavaScript function name. - ScriptID ScriptID `json:"scriptId,omitempty"` // JavaScript script id. - URL string `json:"url,omitempty"` // JavaScript script name or url. - LineNumber int64 `json:"lineNumber,omitempty"` // JavaScript script line number (0-based). - ColumnNumber int64 `json:"columnNumber,omitempty"` // JavaScript script column number (0-based). + FunctionName string `json:"functionName"` // JavaScript function name. + ScriptID ScriptID `json:"scriptId"` // JavaScript script id. + URL string `json:"url"` // JavaScript script name or url. + LineNumber int64 `json:"lineNumber"` // JavaScript script line number (0-based). + ColumnNumber int64 `json:"columnNumber"` // JavaScript script column number (0-based). } // StackTrace call frames for assertions or error messages. type StackTrace struct { Description string `json:"description,omitempty"` // String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - CallFrames []*CallFrame `json:"callFrames,omitempty"` // JavaScript function name. + CallFrames []*CallFrame `json:"callFrames"` // JavaScript function name. Parent *StackTrace `json:"parent,omitempty"` // Asynchronous JavaScript stack trace that preceded this stack, if available. PromiseCreationFrame *CallFrame `json:"promiseCreationFrame,omitempty"` // Creation frame of the Promise which produced the next synchronous trace when resolved, if available. } diff --git a/cdp/schema/easyjson.go b/cdp/schema/easyjson.go index 0e9c13e..d2328c5 100644 --- a/cdp/schema/easyjson.go +++ b/cdp/schema/easyjson.go @@ -226,22 +226,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSchema2(out *jwriter.Writer, i out.RawByte('{') first := true _ = first - if in.Name != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"name\":") - out.String(string(in.Name)) + if !first { + out.RawByte(',') } - if in.Version != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"version\":") - out.String(string(in.Version)) + first = false + out.RawString("\"name\":") + out.String(string(in.Name)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"version\":") + out.String(string(in.Version)) out.RawByte('}') } diff --git a/cdp/schema/types.go b/cdp/schema/types.go index 13121a3..2cc195d 100644 --- a/cdp/schema/types.go +++ b/cdp/schema/types.go @@ -4,6 +4,6 @@ package schema // Domain description of the protocol domain. type Domain struct { - Name string `json:"name,omitempty"` // Domain name. - Version string `json:"version,omitempty"` // Domain version. + Name string `json:"name"` // Domain name. + Version string `json:"version"` // Domain version. } diff --git a/cdp/security/easyjson.go b/cdp/security/easyjson.go index 80e31fb..4772674 100644 --- a/cdp/security/easyjson.go +++ b/cdp/security/easyjson.go @@ -58,38 +58,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.SecurityState != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityState\":") - (in.SecurityState).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Summary != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"summary\":") - out.String(string(in.Summary)) + first = false + out.RawString("\"securityState\":") + (in.SecurityState).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Description != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"description\":") - out.String(string(in.Description)) + first = false + out.RawString("\"summary\":") + out.String(string(in.Summary)) + if !first { + out.RawByte(',') } - if in.HasCertificate { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"hasCertificate\":") - out.Bool(bool(in.HasCertificate)) + first = false + out.RawString("\"description\":") + out.String(string(in.Description)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"hasCertificate\":") + out.Bool(bool(in.HasCertificate)) out.RawByte('}') } @@ -289,62 +281,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.RanMixedContent { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ranMixedContent\":") - out.Bool(bool(in.RanMixedContent)) + if !first { + out.RawByte(',') } - if in.DisplayedMixedContent { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"displayedMixedContent\":") - out.Bool(bool(in.DisplayedMixedContent)) + first = false + out.RawString("\"ranMixedContent\":") + out.Bool(bool(in.RanMixedContent)) + if !first { + out.RawByte(',') } - if in.ContainedMixedForm { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"containedMixedForm\":") - out.Bool(bool(in.ContainedMixedForm)) + first = false + out.RawString("\"displayedMixedContent\":") + out.Bool(bool(in.DisplayedMixedContent)) + if !first { + out.RawByte(',') } - if in.RanContentWithCertErrors { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ranContentWithCertErrors\":") - out.Bool(bool(in.RanContentWithCertErrors)) + first = false + out.RawString("\"containedMixedForm\":") + out.Bool(bool(in.ContainedMixedForm)) + if !first { + out.RawByte(',') } - if in.DisplayedContentWithCertErrors { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"displayedContentWithCertErrors\":") - out.Bool(bool(in.DisplayedContentWithCertErrors)) + first = false + out.RawString("\"ranContentWithCertErrors\":") + out.Bool(bool(in.RanContentWithCertErrors)) + if !first { + out.RawByte(',') } - if in.RanInsecureContentStyle != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"ranInsecureContentStyle\":") - (in.RanInsecureContentStyle).MarshalEasyJSON(out) + first = false + out.RawString("\"displayedContentWithCertErrors\":") + out.Bool(bool(in.DisplayedContentWithCertErrors)) + if !first { + out.RawByte(',') } - if in.DisplayedInsecureContentStyle != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"displayedInsecureContentStyle\":") - (in.DisplayedInsecureContentStyle).MarshalEasyJSON(out) + first = false + out.RawString("\"ranInsecureContentStyle\":") + (in.RanInsecureContentStyle).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"displayedInsecureContentStyle\":") + (in.DisplayedInsecureContentStyle).MarshalEasyJSON(out) out.RawByte('}') } @@ -526,56 +504,48 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.SecurityState != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"securityState\":") - (in.SecurityState).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.SchemeIsCryptographic { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"schemeIsCryptographic\":") - out.Bool(bool(in.SchemeIsCryptographic)) + first = false + out.RawString("\"securityState\":") + (in.SecurityState).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if len(in.Explanations) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"explanations\":") - if in.Explanations == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.Explanations { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - (*v3).MarshalEasyJSON(out) - } + first = false + out.RawString("\"schemeIsCryptographic\":") + out.Bool(bool(in.SchemeIsCryptographic)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"explanations\":") + if in.Explanations == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Explanations { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } - if in.InsecureContentStatus != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"insecureContentStatus\":") - if in.InsecureContentStatus == nil { - out.RawString("null") - } else { - (*in.InsecureContentStatus).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"insecureContentStatus\":") + if in.InsecureContentStatus == nil { + out.RawString("null") + } else { + (*in.InsecureContentStatus).MarshalEasyJSON(out) } if in.Summary != "" { if !first { @@ -650,30 +620,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity6(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.EventID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"eventId\":") - out.Int64(int64(in.EventID)) + if !first { + out.RawByte(',') } - if in.ErrorType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"errorType\":") - out.String(string(in.ErrorType)) + first = false + out.RawString("\"eventId\":") + out.Int64(int64(in.EventID)) + if !first { + out.RawByte(',') } - if in.RequestURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"requestURL\":") - out.String(string(in.RequestURL)) + first = false + out.RawString("\"errorType\":") + out.String(string(in.ErrorType)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"requestURL\":") + out.String(string(in.RequestURL)) out.RawByte('}') } diff --git a/cdp/security/events.go b/cdp/security/events.go index 1634429..a2b93ca 100644 --- a/cdp/security/events.go +++ b/cdp/security/events.go @@ -8,11 +8,11 @@ import ( // EventSecurityStateChanged the security state of the page changed. type EventSecurityStateChanged struct { - SecurityState State `json:"securityState,omitempty"` // Security state. - SchemeIsCryptographic bool `json:"schemeIsCryptographic,omitempty"` // True if the page was loaded over cryptographic transport such as HTTPS. - Explanations []*StateExplanation `json:"explanations,omitempty"` // List of explanations for the security state. If the overall security state is `insecure` or `warning`, at least one corresponding explanation should be included. - InsecureContentStatus *InsecureContentStatus `json:"insecureContentStatus,omitempty"` // Information about insecure content on the page. - Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state. + SecurityState State `json:"securityState"` // Security state. + SchemeIsCryptographic bool `json:"schemeIsCryptographic"` // True if the page was loaded over cryptographic transport such as HTTPS. + Explanations []*StateExplanation `json:"explanations"` // List of explanations for the security state. If the overall security state is `insecure` or `warning`, at least one corresponding explanation should be included. + InsecureContentStatus *InsecureContentStatus `json:"insecureContentStatus"` // Information about insecure content on the page. + Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state. } // EventCertificateError there is a certificate error. If overriding @@ -20,9 +20,9 @@ type EventSecurityStateChanged struct { // handleCertificateError command. Note: this event does not fire if the // certificate error has been allowed internally. type EventCertificateError struct { - EventID int64 `json:"eventId,omitempty"` // The ID of the event. - ErrorType string `json:"errorType,omitempty"` // The type of the error. - RequestURL string `json:"requestURL,omitempty"` // The url that was requested. + EventID int64 `json:"eventId"` // The ID of the event. + ErrorType string `json:"errorType"` // The type of the error. + RequestURL string `json:"requestURL"` // The url that was requested. } // EventTypes all event types in the domain. diff --git a/cdp/security/types.go b/cdp/security/types.go index 1c0d237..c34388a 100644 --- a/cdp/security/types.go +++ b/cdp/security/types.go @@ -75,21 +75,21 @@ func (t *State) UnmarshalJSON(buf []byte) error { // StateExplanation an explanation of an factor contributing to the security // state. type StateExplanation struct { - SecurityState State `json:"securityState,omitempty"` // Security state representing the severity of the factor being explained. - Summary string `json:"summary,omitempty"` // Short phrase describing the type of factor. - Description string `json:"description,omitempty"` // Full text explanation of the factor. - HasCertificate bool `json:"hasCertificate,omitempty"` // True if the page has a certificate. + SecurityState State `json:"securityState"` // Security state representing the severity of the factor being explained. + Summary string `json:"summary"` // Short phrase describing the type of factor. + Description string `json:"description"` // Full text explanation of the factor. + HasCertificate bool `json:"hasCertificate"` // True if the page has a certificate. } // InsecureContentStatus information about insecure content on the page. type InsecureContentStatus struct { - RanMixedContent bool `json:"ranMixedContent,omitempty"` // True if the page was loaded over HTTPS and ran mixed (HTTP) content such as scripts. - DisplayedMixedContent bool `json:"displayedMixedContent,omitempty"` // True if the page was loaded over HTTPS and displayed mixed (HTTP) content such as images. - ContainedMixedForm bool `json:"containedMixedForm,omitempty"` // True if the page was loaded over HTTPS and contained a form targeting an insecure url. - RanContentWithCertErrors bool `json:"ranContentWithCertErrors,omitempty"` // True if the page was loaded over HTTPS without certificate errors, and ran content such as scripts that were loaded with certificate errors. - DisplayedContentWithCertErrors bool `json:"displayedContentWithCertErrors,omitempty"` // True if the page was loaded over HTTPS without certificate errors, and displayed content such as images that were loaded with certificate errors. - RanInsecureContentStyle State `json:"ranInsecureContentStyle,omitempty"` // Security state representing a page that ran insecure content. - DisplayedInsecureContentStyle State `json:"displayedInsecureContentStyle,omitempty"` // Security state representing a page that displayed insecure content. + RanMixedContent bool `json:"ranMixedContent"` // True if the page was loaded over HTTPS and ran mixed (HTTP) content such as scripts. + DisplayedMixedContent bool `json:"displayedMixedContent"` // True if the page was loaded over HTTPS and displayed mixed (HTTP) content such as images. + ContainedMixedForm bool `json:"containedMixedForm"` // True if the page was loaded over HTTPS and contained a form targeting an insecure url. + RanContentWithCertErrors bool `json:"ranContentWithCertErrors"` // True if the page was loaded over HTTPS without certificate errors, and ran content such as scripts that were loaded with certificate errors. + DisplayedContentWithCertErrors bool `json:"displayedContentWithCertErrors"` // True if the page was loaded over HTTPS without certificate errors, and displayed content such as images that were loaded with certificate errors. + RanInsecureContentStyle State `json:"ranInsecureContentStyle"` // Security state representing a page that ran insecure content. + DisplayedInsecureContentStyle State `json:"displayedInsecureContentStyle"` // Security state representing a page that displayed insecure content. } // CertificateErrorAction the action to take when a certificate error occurs. diff --git a/cdp/serviceworker/easyjson.go b/cdp/serviceworker/easyjson.go index 9010e99..8951b25 100644 --- a/cdp/serviceworker/easyjson.go +++ b/cdp/serviceworker/easyjson.go @@ -90,46 +90,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker(out *jwriter.Wri out.RawByte('{') first := true _ = first - if in.VersionID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"versionId\":") - out.String(string(in.VersionID)) + if !first { + out.RawByte(',') } - if in.RegistrationID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"registrationId\":") - out.String(string(in.RegistrationID)) + first = false + out.RawString("\"versionId\":") + out.String(string(in.VersionID)) + if !first { + out.RawByte(',') } - if in.ScriptURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scriptURL\":") - out.String(string(in.ScriptURL)) + first = false + out.RawString("\"registrationId\":") + out.String(string(in.RegistrationID)) + if !first { + out.RawByte(',') } - if in.RunningStatus != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"runningStatus\":") - (in.RunningStatus).MarshalEasyJSON(out) + first = false + out.RawString("\"scriptURL\":") + out.String(string(in.ScriptURL)) + if !first { + out.RawByte(',') } - if in.Status != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"status\":") - (in.Status).MarshalEasyJSON(out) + first = false + out.RawString("\"runningStatus\":") + (in.RunningStatus).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"status\":") + (in.Status).MarshalEasyJSON(out) if in.ScriptLastModified != 0 { if !first { out.RawByte(',') @@ -640,30 +630,24 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker7(out *jwriter.Wr out.RawByte('{') first := true _ = first - if in.RegistrationID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"registrationId\":") - out.String(string(in.RegistrationID)) + if !first { + out.RawByte(',') } - if in.ScopeURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"scopeURL\":") - out.String(string(in.ScopeURL)) + first = false + out.RawString("\"registrationId\":") + out.String(string(in.RegistrationID)) + if !first { + out.RawByte(',') } - if in.IsDeleted { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"isDeleted\":") - out.Bool(bool(in.IsDeleted)) + first = false + out.RawString("\"scopeURL\":") + out.String(string(in.ScopeURL)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"isDeleted\":") + out.Bool(bool(in.IsDeleted)) out.RawByte('}') } @@ -821,28 +805,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker9(out *jwriter.Wr out.RawByte('{') first := true _ = first - if len(in.Versions) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"versions\":") - if in.Versions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.Versions { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - (*v6).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"versions\":") + if in.Versions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Versions { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -934,28 +916,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker10(out *jwriter.W out.RawByte('{') first := true _ = first - if len(in.Registrations) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"registrations\":") - if in.Registrations == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.Registrations { - if v8 > 0 { - out.RawByte(',') - } - if v9 == nil { - out.RawString("null") - } else { - (*v9).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"registrations\":") + if in.Registrations == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Registrations { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + (*v9).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } out.RawByte('}') } @@ -1026,17 +1006,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker11(out *jwriter.W out.RawByte('{') first := true _ = first - if in.ErrorMessage != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"errorMessage\":") - if in.ErrorMessage == nil { - out.RawString("null") - } else { - (*in.ErrorMessage).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"errorMessage\":") + if in.ErrorMessage == nil { + out.RawString("null") + } else { + (*in.ErrorMessage).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1109,54 +1087,42 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker12(out *jwriter.W out.RawByte('{') first := true _ = first - if in.ErrorMessage != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"errorMessage\":") - out.String(string(in.ErrorMessage)) + if !first { + out.RawByte(',') } - if in.RegistrationID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"registrationId\":") - out.String(string(in.RegistrationID)) + first = false + out.RawString("\"errorMessage\":") + out.String(string(in.ErrorMessage)) + if !first { + out.RawByte(',') } - if in.VersionID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"versionId\":") - out.String(string(in.VersionID)) + first = false + out.RawString("\"registrationId\":") + out.String(string(in.RegistrationID)) + if !first { + out.RawByte(',') } - if in.SourceURL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"sourceURL\":") - out.String(string(in.SourceURL)) + first = false + out.RawString("\"versionId\":") + out.String(string(in.VersionID)) + if !first { + out.RawByte(',') } - if in.LineNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"lineNumber\":") - out.Int64(int64(in.LineNumber)) + first = false + out.RawString("\"sourceURL\":") + out.String(string(in.SourceURL)) + if !first { + out.RawByte(',') } - if in.ColumnNumber != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"columnNumber\":") - out.Int64(int64(in.ColumnNumber)) + first = false + out.RawString("\"lineNumber\":") + out.Int64(int64(in.LineNumber)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"columnNumber\":") + out.Int64(int64(in.ColumnNumber)) out.RawByte('}') } diff --git a/cdp/serviceworker/events.go b/cdp/serviceworker/events.go index 7f54958..60ddeb8 100644 --- a/cdp/serviceworker/events.go +++ b/cdp/serviceworker/events.go @@ -8,17 +8,17 @@ import ( // EventWorkerRegistrationUpdated [no description]. type EventWorkerRegistrationUpdated struct { - Registrations []*Registration `json:"registrations,omitempty"` + Registrations []*Registration `json:"registrations"` } // EventWorkerVersionUpdated [no description]. type EventWorkerVersionUpdated struct { - Versions []*Version `json:"versions,omitempty"` + Versions []*Version `json:"versions"` } // EventWorkerErrorReported [no description]. type EventWorkerErrorReported struct { - ErrorMessage *ErrorMessage `json:"errorMessage,omitempty"` + ErrorMessage *ErrorMessage `json:"errorMessage"` } // EventTypes all event types in the domain. diff --git a/cdp/serviceworker/types.go b/cdp/serviceworker/types.go index 3eb0da0..bb6b0d5 100644 --- a/cdp/serviceworker/types.go +++ b/cdp/serviceworker/types.go @@ -13,9 +13,9 @@ import ( // Registration serviceWorker registration. type Registration struct { - RegistrationID string `json:"registrationId,omitempty"` - ScopeURL string `json:"scopeURL,omitempty"` - IsDeleted bool `json:"isDeleted,omitempty"` + RegistrationID string `json:"registrationId"` + ScopeURL string `json:"scopeURL"` + IsDeleted bool `json:"isDeleted"` } // VersionRunningStatus [no description]. @@ -122,11 +122,11 @@ func (t *VersionStatus) UnmarshalJSON(buf []byte) error { // Version serviceWorker version. type Version struct { - VersionID string `json:"versionId,omitempty"` - RegistrationID string `json:"registrationId,omitempty"` - ScriptURL string `json:"scriptURL,omitempty"` - RunningStatus VersionRunningStatus `json:"runningStatus,omitempty"` - Status VersionStatus `json:"status,omitempty"` + VersionID string `json:"versionId"` + RegistrationID string `json:"registrationId"` + ScriptURL string `json:"scriptURL"` + RunningStatus VersionRunningStatus `json:"runningStatus"` + Status VersionStatus `json:"status"` ScriptLastModified float64 `json:"scriptLastModified,omitempty"` // The Last-Modified header value of the main script. ScriptResponseTime float64 `json:"scriptResponseTime,omitempty"` // The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated. ControlledClients []target.ID `json:"controlledClients,omitempty"` @@ -135,10 +135,10 @@ type Version struct { // ErrorMessage serviceWorker error message. type ErrorMessage struct { - ErrorMessage string `json:"errorMessage,omitempty"` - RegistrationID string `json:"registrationId,omitempty"` - VersionID string `json:"versionId,omitempty"` - SourceURL string `json:"sourceURL,omitempty"` - LineNumber int64 `json:"lineNumber,omitempty"` - ColumnNumber int64 `json:"columnNumber,omitempty"` + ErrorMessage string `json:"errorMessage"` + RegistrationID string `json:"registrationId"` + VersionID string `json:"versionId"` + SourceURL string `json:"sourceURL"` + LineNumber int64 `json:"lineNumber"` + ColumnNumber int64 `json:"columnNumber"` } diff --git a/cdp/storage/easyjson.go b/cdp/storage/easyjson.go index 237015a..ea37e09 100644 --- a/cdp/storage/easyjson.go +++ b/cdp/storage/easyjson.go @@ -54,22 +54,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(out *jwriter.Writer, i out.RawByte('{') first := true _ = first - if in.StorageType != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"storageType\":") - (in.StorageType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } - if in.Usage != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"usage\":") - out.Float64(float64(in.Usage)) + first = false + out.RawString("\"storageType\":") + (in.StorageType).MarshalEasyJSON(out) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"usage\":") + out.Float64(float64(in.Usage)) out.RawByte('}') } diff --git a/cdp/storage/types.go b/cdp/storage/types.go index c560946..3ebd9f5 100644 --- a/cdp/storage/types.go +++ b/cdp/storage/types.go @@ -81,6 +81,6 @@ func (t *Type) UnmarshalJSON(buf []byte) error { // UsageForType usage for a storage type. type UsageForType struct { - StorageType Type `json:"storageType,omitempty"` // Name of storage type. - Usage float64 `json:"usage,omitempty"` // Storage usage (bytes). + StorageType Type `json:"storageType"` // Name of storage type. + Usage float64 `json:"usage"` // Storage usage (bytes). } diff --git a/cdp/systeminfo/easyjson.go b/cdp/systeminfo/easyjson.go index 0664adf..41a773d 100644 --- a/cdp/systeminfo/easyjson.go +++ b/cdp/systeminfo/easyjson.go @@ -278,28 +278,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Write out.RawByte('{') first := true _ = first - if len(in.Devices) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"devices\":") - if in.Devices == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v3, v4 := range in.Devices { - if v3 > 0 { - out.RawByte(',') - } - if v4 == nil { - out.RawString("null") - } else { - (*v4).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"devices\":") + if in.Devices == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.Devices { + if v3 > 0 { + out.RawByte(',') + } + if v4 == nil { + out.RawString("null") + } else { + (*v4).MarshalEasyJSON(out) } - out.RawByte(']') } + out.RawByte(']') } if (in.AuxAttributes).IsDefined() { if !first { @@ -317,24 +315,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo2(out *jwriter.Write out.RawString("\"featureStatus\":") (in.FeatureStatus).MarshalEasyJSON(out) } - if len(in.DriverBugWorkarounds) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"driverBugWorkarounds\":") - if in.DriverBugWorkarounds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.DriverBugWorkarounds { - if v5 > 0 { - out.RawByte(',') - } - out.String(string(v6)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"driverBugWorkarounds\":") + if in.DriverBugWorkarounds == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.DriverBugWorkarounds { + if v5 > 0 { + out.RawByte(',') } - out.RawByte(']') + out.String(string(v6)) } + out.RawByte(']') } out.RawByte('}') } @@ -403,38 +399,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSysteminfo3(out *jwriter.Write out.RawByte('{') first := true _ = first - if in.VendorID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"vendorId\":") - out.Float64(float64(in.VendorID)) + if !first { + out.RawByte(',') } - if in.DeviceID != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"deviceId\":") - out.Float64(float64(in.DeviceID)) + first = false + out.RawString("\"vendorId\":") + out.Float64(float64(in.VendorID)) + if !first { + out.RawByte(',') } - if in.VendorString != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"vendorString\":") - out.String(string(in.VendorString)) + first = false + out.RawString("\"deviceId\":") + out.Float64(float64(in.DeviceID)) + if !first { + out.RawByte(',') } - if in.DeviceString != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"deviceString\":") - out.String(string(in.DeviceString)) + first = false + out.RawString("\"vendorString\":") + out.String(string(in.VendorString)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"deviceString\":") + out.String(string(in.DeviceString)) out.RawByte('}') } diff --git a/cdp/systeminfo/types.go b/cdp/systeminfo/types.go index b1442a4..c17c5ee 100644 --- a/cdp/systeminfo/types.go +++ b/cdp/systeminfo/types.go @@ -6,16 +6,16 @@ import "github.com/mailru/easyjson" // GPUDevice describes a single graphics processor (GPU). type GPUDevice struct { - VendorID float64 `json:"vendorId,omitempty"` // PCI ID of the GPU vendor, if available; 0 otherwise. - DeviceID float64 `json:"deviceId,omitempty"` // PCI ID of the GPU device, if available; 0 otherwise. - VendorString string `json:"vendorString,omitempty"` // String description of the GPU vendor, if the PCI ID is not available. - DeviceString string `json:"deviceString,omitempty"` // String description of the GPU device, if the PCI ID is not available. + VendorID float64 `json:"vendorId"` // PCI ID of the GPU vendor, if available; 0 otherwise. + DeviceID float64 `json:"deviceId"` // PCI ID of the GPU device, if available; 0 otherwise. + VendorString string `json:"vendorString"` // String description of the GPU vendor, if the PCI ID is not available. + DeviceString string `json:"deviceString"` // String description of the GPU device, if the PCI ID is not available. } // GPUInfo provides information about the GPU(s) on the system. type GPUInfo struct { - Devices []*GPUDevice `json:"devices,omitempty"` // The graphics devices on the system. Element 0 is the primary GPU. + Devices []*GPUDevice `json:"devices"` // The graphics devices on the system. Element 0 is the primary GPU. AuxAttributes easyjson.RawMessage `json:"auxAttributes,omitempty"` FeatureStatus easyjson.RawMessage `json:"featureStatus,omitempty"` - DriverBugWorkarounds []string `json:"driverBugWorkarounds,omitempty"` // An optional array of GPU driver bug workarounds. + DriverBugWorkarounds []string `json:"driverBugWorkarounds"` // An optional array of GPU driver bug workarounds. } diff --git a/cdp/target/easyjson.go b/cdp/target/easyjson.go index b8cf5bc..9214d97 100644 --- a/cdp/target/easyjson.go +++ b/cdp/target/easyjson.go @@ -449,22 +449,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget5(out *jwriter.Writer, i out.RawByte('{') first := true _ = first - if in.Host != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"host\":") - out.String(string(in.Host)) + if !first { + out.RawByte(',') } - if in.Port != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"port\":") - out.Int64(int64(in.Port)) + first = false + out.RawString("\"host\":") + out.String(string(in.Host)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"port\":") + out.Int64(int64(in.Port)) out.RawByte('}') } @@ -534,46 +530,36 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget6(out *jwriter.Writer, i out.RawByte('{') first := true _ = first - if in.TargetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } - if in.Type != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"type\":") - out.String(string(in.Type)) + first = false + out.RawString("\"targetId\":") + out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } - if in.Title != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"title\":") - out.String(string(in.Title)) + first = false + out.RawString("\"type\":") + out.String(string(in.Type)) + if !first { + out.RawByte(',') } - if in.URL != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + first = false + out.RawString("\"title\":") + out.String(string(in.Title)) + if !first { + out.RawByte(',') } - if in.Attached { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"attached\":") - out.Bool(bool(in.Attached)) + first = false + out.RawString("\"url\":") + out.String(string(in.URL)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"attached\":") + out.Bool(bool(in.Attached)) out.RawByte('}') } @@ -963,17 +949,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget11(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetInfo != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetInfo\":") - if in.TargetInfo == nil { - out.RawString("null") - } else { - (*in.TargetInfo).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"targetInfo\":") + if in.TargetInfo == nil { + out.RawString("null") + } else { + (*in.TargetInfo).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1036,14 +1020,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget12(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"targetId\":") + out.String(string(in.TargetID)) out.RawByte('}') } @@ -1113,17 +1095,15 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget13(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetInfo != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetInfo\":") - if in.TargetInfo == nil { - out.RawString("null") - } else { - (*in.TargetInfo).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"targetInfo\":") + if in.TargetInfo == nil { + out.RawString("null") + } else { + (*in.TargetInfo).MarshalEasyJSON(out) } out.RawByte('}') } @@ -1188,22 +1168,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget14(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } - if in.Message != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"message\":") - out.String(string(in.Message)) + first = false + out.RawString("\"targetId\":") + out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"message\":") + out.String(string(in.Message)) out.RawByte('}') } @@ -1265,14 +1241,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget15(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"targetId\":") + out.String(string(in.TargetID)) out.RawByte('}') } @@ -1344,26 +1318,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget16(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.TargetInfo != nil { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"targetInfo\":") - if in.TargetInfo == nil { - out.RawString("null") - } else { - (*in.TargetInfo).MarshalEasyJSON(out) - } + if !first { + out.RawByte(',') } - if in.WaitingForDebugger { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"waitingForDebugger\":") - out.Bool(bool(in.WaitingForDebugger)) + first = false + out.RawString("\"targetInfo\":") + if in.TargetInfo == nil { + out.RawString("null") + } else { + (*in.TargetInfo).MarshalEasyJSON(out) } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"waitingForDebugger\":") + out.Bool(bool(in.WaitingForDebugger)) out.RawByte('}') } diff --git a/cdp/target/events.go b/cdp/target/events.go index 2b0ff3b..44066b6 100644 --- a/cdp/target/events.go +++ b/cdp/target/events.go @@ -8,38 +8,38 @@ import ( // EventTargetCreated issued when a possible inspection target is created. type EventTargetCreated struct { - TargetInfo *Info `json:"targetInfo,omitempty"` + TargetInfo *Info `json:"targetInfo"` } // EventTargetInfoChanged issued when some information about a target has // changed. This only happens between targetCreated and targetDestroyed. type EventTargetInfoChanged struct { - TargetInfo *Info `json:"targetInfo,omitempty"` + TargetInfo *Info `json:"targetInfo"` } // EventTargetDestroyed issued when a target is destroyed. type EventTargetDestroyed struct { - TargetID ID `json:"targetId,omitempty"` + TargetID ID `json:"targetId"` } // EventAttachedToTarget issued when attached to target because of // auto-attach or attachToTarget command. type EventAttachedToTarget struct { - TargetInfo *Info `json:"targetInfo,omitempty"` - WaitingForDebugger bool `json:"waitingForDebugger,omitempty"` + TargetInfo *Info `json:"targetInfo"` + WaitingForDebugger bool `json:"waitingForDebugger"` } // EventDetachedFromTarget issued when detached from target for any reason // (including detachFromTarget command). type EventDetachedFromTarget struct { - TargetID ID `json:"targetId,omitempty"` + TargetID ID `json:"targetId"` } // EventReceivedMessageFromTarget notifies about new protocol message from // attached target. type EventReceivedMessageFromTarget struct { - TargetID ID `json:"targetId,omitempty"` - Message string `json:"message,omitempty"` + TargetID ID `json:"targetId"` + Message string `json:"message"` } // EventTypes all event types in the domain. diff --git a/cdp/target/types.go b/cdp/target/types.go index d1b1fb3..8468b66 100644 --- a/cdp/target/types.go +++ b/cdp/target/types.go @@ -20,15 +20,15 @@ func (t BrowserContextID) String() string { // Info [no description]. type Info struct { - TargetID ID `json:"targetId,omitempty"` - Type string `json:"type,omitempty"` - Title string `json:"title,omitempty"` - URL string `json:"url,omitempty"` - Attached bool `json:"attached,omitempty"` // Whether the target has an attached client. + TargetID ID `json:"targetId"` + Type string `json:"type"` + Title string `json:"title"` + URL string `json:"url"` + Attached bool `json:"attached"` // Whether the target has an attached client. } // RemoteLocation [no description]. type RemoteLocation struct { - Host string `json:"host,omitempty"` - Port int64 `json:"port,omitempty"` + Host string `json:"host"` + Port int64 `json:"port"` } diff --git a/cdp/tethering/easyjson.go b/cdp/tethering/easyjson.go index efe4a78..d60ff61 100644 --- a/cdp/tethering/easyjson.go +++ b/cdp/tethering/easyjson.go @@ -121,22 +121,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTethering1(out *jwriter.Writer out.RawByte('{') first := true _ = first - if in.Port != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"port\":") - out.Int64(int64(in.Port)) + if !first { + out.RawByte(',') } - if in.ConnectionID != "" { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"connectionId\":") - out.String(string(in.ConnectionID)) + first = false + out.RawString("\"port\":") + out.Int64(int64(in.Port)) + if !first { + out.RawByte(',') } + first = false + out.RawString("\"connectionId\":") + out.String(string(in.ConnectionID)) out.RawByte('}') } diff --git a/cdp/tethering/events.go b/cdp/tethering/events.go index f4eaf69..83b3c52 100644 --- a/cdp/tethering/events.go +++ b/cdp/tethering/events.go @@ -9,8 +9,8 @@ import ( // EventAccepted informs that port was successfully bound and got a specified // connection id. type EventAccepted struct { - Port int64 `json:"port,omitempty"` // Port number that was successfully bound. - ConnectionID string `json:"connectionId,omitempty"` // Connection id to be used. + Port int64 `json:"port"` // Port number that was successfully bound. + ConnectionID string `json:"connectionId"` // Connection id to be used. } // EventTypes all event types in the domain. diff --git a/cdp/tracing/easyjson.go b/cdp/tracing/easyjson.go index 0a9fbc2..7678ea1 100644 --- a/cdp/tracing/easyjson.go +++ b/cdp/tracing/easyjson.go @@ -915,24 +915,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTracing9(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if len(in.Value) != 0 { - if !first { - out.RawByte(',') - } - first = false - out.RawString("\"value\":") - if in.Value == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v14, v15 := range in.Value { - if v14 > 0 { - out.RawByte(',') - } - (v15).MarshalEasyJSON(out) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"value\":") + if in.Value == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v14, v15 := range in.Value { + if v14 > 0 { + out.RawByte(',') } - out.RawByte(']') + (v15).MarshalEasyJSON(out) } + out.RawByte(']') } out.RawByte('}') } diff --git a/cdp/tracing/events.go b/cdp/tracing/events.go index 78df675..80038af 100644 --- a/cdp/tracing/events.go +++ b/cdp/tracing/events.go @@ -12,7 +12,7 @@ import ( // tracing is stopped collected events will be send as a sequence of // dataCollected events followed by tracingComplete event. type EventDataCollected struct { - Value []easyjson.RawMessage `json:"value,omitempty"` + Value []easyjson.RawMessage `json:"value"` } // EventTracingComplete signals that tracing is stopped and there is no trace diff --git a/cmd/chromedp-gen/fixup/fixup.go b/cmd/chromedp-gen/fixup/fixup.go index 2f53420..5ad423e 100644 --- a/cmd/chromedp-gen/fixup/fixup.go +++ b/cmd/chromedp-gen/fixup/fixup.go @@ -132,26 +132,31 @@ func FixDomains(domains []*internal.Domain) { Name: "id", Type: internal.TypeInteger, Description: "Unique message identifier.", + Optional: true, }, { Name: "method", Ref: "Inspector.MethodType", Description: "Event or command type.", + Optional: true, }, { Name: "params", Type: internal.TypeAny, Description: "Event or command parameters.", + Optional: true, }, { Name: "result", Type: internal.TypeAny, Description: "Command return values.", + Optional: true, }, { Name: "error", Ref: "MessageError", Description: "Error message.", + Optional: true, }, }, } diff --git a/cmd/chromedp-gen/domain-gen.go b/cmd/chromedp-gen/gen-domain.go similarity index 100% rename from cmd/chromedp-gen/domain-gen.go rename to cmd/chromedp-gen/gen-domain.go diff --git a/cmd/chromedp-gen/gen-har-proto.go b/cmd/chromedp-gen/gen-har-proto.go new file mode 100644 index 0000000..6d5cc60 --- /dev/null +++ b/cmd/chromedp-gen/gen-har-proto.go @@ -0,0 +1,261 @@ +// +build ignore + +package main + +import ( + "bufio" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "sort" + "strings" + + "github.com/PuerkitoBio/goquery" + "github.com/gedex/inflector" + "github.com/knq/chromedp/cmd/chromedp-gen/internal" +) + +const ( + specURL = "http://www.softwareishard.com/blog/har-12-spec/" + + cacheDataID = "CacheData" +) + +var ( + flagOut = flag.String("out", "har.json", "out file") +) + +// propRefMap is the map of property names to their respective type. +var propRefMap = map[string]string{ + "Log.creator": "Creator", + "Log.browser": "Creator", + "Log.pages": "Page", + "Log.entries": "Entry", + "Page.pageTimings": "PageTimings", + "Entry.request": "Request", + "Entry.response": "Response", + "Entry.cache": "Cache", + "Entry.timings": "Timings", + "Request.cookies": "Cookie", + "Request.headers": "NameValuePair", + "Request.queryString": "NameValuePair", + "Request.postData": "PostData", + "Response.cookies": "Cookie", + "Response.headers": "NameValuePair", + "Response.content": "Content", + "PostData.params": "Param", + "Cache.beforeRequest": cacheDataID, + "Cache.afterRequest": cacheDataID, +} + +func main() { + var err error + + flag.Parse() + + // initial type map + typeMap := map[string]internal.Type{ + "HAR": { + ID: "HAR", + Type: internal.TypeObject, + Description: "Parent container for HAR log.", + Properties: []*internal.Type{{ + Name: "log", + Ref: "Log", + }}, + }, + "NameValuePair": { + ID: "NameValuePair", + Type: internal.TypeObject, + Description: "Describes a name/value pair.", + Properties: []*internal.Type{{ + Name: "name", + Type: internal.TypeString, + Description: "Name of the pair.", + }, { + Name: "value", + Type: internal.TypeString, + Description: "Value of the pair.", + }, { + Name: "comment", + Type: internal.TypeString, + Description: "A comment provided by the user or the application.", + Optional: internal.Bool(true), + }}, + }, + } + + // load remote definition + doc, err := goquery.NewDocument(specURL) + if err != nil { + log.Fatal(err) + } + + // loop over type definitions + doc.Find(`h3:contains("HAR Data Structure") + p + p + ul a`).Each(func(i int, s *goquery.Selection) { + n := s.Text() + + // skip browser (same as creator) + switch n { + case "browser", "queryString", "headers": + return + } + + // generate the object ID + id := inflector.Singularize(internal.ForceCamel(n)) + if strings.HasSuffix(id, "um") { + id = strings.TrimSuffix(id, "um") + "a" + } + if strings.HasSuffix(id, "Timing") { + id += "s" + } + + log.Printf("processing '%s', id: '%s'", n, id) + + // base selector + sel := fmt.Sprintf(".harType#%s", n) + + // grab description + desc := strings.TrimSpace(doc.Find(sel + " + p").Text()) + if desc == "" { + panic(fmt.Sprintf("%s (%s) has no description", n, id)) + } + + // grab properties and scan + props, err := scanProps(id, readPropText(sel, doc)) + if err != nil { + log.Fatal(err) + } + + // add to type map + typeMap[id] = internal.Type{ + ID: id, + Type: internal.TypeObject, + Description: desc, + Properties: props, + } + }) + + // grab and scan cachedata properties + cacheDataPropText := readPropText(`p:contains("Both beforeRequest and afterRequest object share the following structure.")`, doc) + cacheDataProps, err := scanProps(cacheDataID, cacheDataPropText) + if err != nil { + log.Fatal(err) + } + typeMap[cacheDataID] = internal.Type{ + ID: cacheDataID, + Type: internal.TypeObject, + Description: "Describes the cache data for beforeRequest and afterRequest.", + Properties: cacheDataProps, + } + + // sort by type names + var typeNames []string + for n := range typeMap { + typeNames = append(typeNames, n) + } + sort.Strings(typeNames) + + // add to type list + var types []*internal.Type + for _, n := range typeNames { + typ := typeMap[n] + types = append(types, &typ) + } + + // create the protocol info + def := internal.ProtocolInfo{ + Version: &internal.Version{Major: "1", Minor: "2"}, + Domains: []*internal.Domain{{ + Domain: internal.DomainType("HAR"), + Description: "HTTP Archive Format", + Types: types, + }}, + } + + // json marshal + buf, err := json.MarshalIndent(def, "", " ") + if err != nil { + log.Fatal(buf) + } + + // write + err = ioutil.WriteFile(*flagOut, buf, 0644) + if err != nil { + log.Fatal(err) + } +} + +func scanProps(id string, propText string) ([]*internal.Type, error) { + // scan properties + var props []*internal.Type + scanner := bufio.NewScanner(strings.NewReader(propText)) + i := 0 + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + + // grab prop stuff + propName := strings.TrimSpace(line[:strings.IndexAny(line, "[")]) + propDesc := strings.TrimSpace(line[strings.Index(line, "-")+1:]) + if propName == "" || propDesc == "" { + return nil, fmt.Errorf("line %d missing either name or description", i) + } + opts := strings.TrimSpace(line[strings.Index(line, "[")+1 : strings.Index(line, "]")]) + + // determine type + typ := internal.TypeEnum(opts) + if z := strings.Index(opts, ","); z != -1 { + typ = internal.TypeEnum(strings.TrimSpace(opts[:z])) + } + + // convert some fields to integers + if strings.Contains(strings.ToLower(propName), "size") || + propName == "compression" || propName == "status" || + propName == "hitCount" { + typ = internal.TypeInteger + } + + // fix object/array refs + var ref string + var items *internal.Type + fqPropName := fmt.Sprintf("%s.%s", id, propName) + switch typ { + case internal.TypeObject: + typ = internal.TypeEnum("") + ref = propRefMap[fqPropName] + + case internal.TypeArray: + items = &internal.Type{ + Ref: propRefMap[fqPropName], + } + } + + // add property + props = append(props, &internal.Type{ + Name: propName, + Type: typ, + Description: propDesc, + Ref: ref, + Items: items, + Optional: internal.Bool(strings.Contains(opts, "optional")), + }) + + i++ + } + if err := scanner.Err(); err != nil { + return nil, err + } + + return props, nil +} + +func readPropText(sel string, doc *goquery.Document) string { + text := strings.TrimSpace(doc.Find(sel).NextAllFiltered("ul").Text()) + j := strings.Index(text, "\n\n") + if j == -1 { + panic(fmt.Sprintf("could not find property description for `%s`", sel)) + } + return text[:j] +} diff --git a/cmd/chromedp-gen/gen/gen.go b/cmd/chromedp-gen/gen/gen.go index f205c02..4f9e5a4 100644 --- a/cmd/chromedp-gen/gen/gen.go +++ b/cmd/chromedp-gen/gen/gen.go @@ -92,7 +92,7 @@ func (fb fileBuffers) generateCDPTypes(domains []*internal.Domain) { w := fb.get(pkg+".go", pkg, nil) for _, t := range types { - templates.StreamTypeTemplate(w, t, internal.TypePrefix, internal.TypeSuffix, cdpDomain, doms, nil, false, false) + templates.StreamTypeTemplate(w, t, internal.TypePrefix, internal.TypeSuffix, cdpDomain, doms, nil, false, true) } fb.release(w) } @@ -133,7 +133,7 @@ func (fb fileBuffers) generateTypes( if internal.IsCDPType(d.Domain, t.IDorName()) { continue } - templates.StreamTypeTemplate(w, t, prefix, suffix, d, domains, nil, false, false) + templates.StreamTypeTemplate(w, t, prefix, suffix, d, domains, nil, false, true) names = append(names, t.TypeName(emitPrefix, emitSuffix)) } diff --git a/cmd/chromedp-gen/har.json b/cmd/chromedp-gen/har.json new file mode 100644 index 0000000..82c6fb8 --- /dev/null +++ b/cmd/chromedp-gen/har.json @@ -0,0 +1,640 @@ +{ + "version": { + "major": "1", + "minor": "2" + }, + "domains": [ + { + "domain": "HAR", + "description": "HTTP Archive Format", + "types": [ + { + "type": "object", + "id": "Cache", + "description": "This objects contains info about a request coming from browser cache.", + "properties": [ + { + "name": "beforeRequest", + "description": "State of a cache entry before the request. Leave out this field if the information is not available.", + "optional": true, + "$ref": "CacheData" + }, + { + "name": "afterRequest", + "description": "State of a cache entry after the request. Leave out this field if the information is not available.", + "optional": true, + "$ref": "CacheData" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "CacheData", + "description": "Describes the cache data for beforeRequest and afterRequest.", + "properties": [ + { + "type": "string", + "name": "expires", + "description": "Expiration time of the cache entry.", + "optional": true + }, + { + "type": "string", + "name": "lastAccess", + "description": "The last time the cache entry was opened." + }, + { + "type": "string", + "name": "eTag", + "description": "Etag" + }, + { + "type": "integer", + "name": "hitCount", + "description": "The number of times the cache entry has been opened." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Content", + "description": "This object describes details about response content (embedded in \u003cresponse\u003e object).", + "properties": [ + { + "type": "integer", + "name": "size", + "description": "Length of the returned content in bytes. Should be equal to response.bodySize if there is no compression and bigger when the content has been compressed." + }, + { + "type": "integer", + "name": "compression", + "description": "Number of bytes saved. Leave out this field if the information is not available.", + "optional": true + }, + { + "type": "string", + "name": "mimeType", + "description": "MIME type of the response text (value of the Content-Type response header). The charset attribute of the MIME type is included (if available)." + }, + { + "type": "string", + "name": "text", + "description": "Response body sent from the server or loaded from the browser cache. This field is populated with textual content only. The text field is either HTTP decoded text or a encoded (e.g. \"base64\") representation of the response body. Leave out this field if the information is not available.", + "optional": true + }, + { + "type": "string", + "name": "encoding", + "description": "Encoding used for response text field e.g \"base64\". Leave out this field if the text field is HTTP decoded (decompressed \u0026 unchunked), than trans-coded from its original character set into UTF-8.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Cookie", + "description": "This object contains list of all cookies (used in \u003crequest\u003e and \u003cresponse\u003e objects).", + "properties": [ + { + "type": "string", + "name": "name", + "description": "The name of the cookie." + }, + { + "type": "string", + "name": "value", + "description": "The cookie value." + }, + { + "type": "string", + "name": "path", + "description": "The path pertaining to the cookie.", + "optional": true + }, + { + "type": "string", + "name": "domain", + "description": "The host of the cookie.", + "optional": true + }, + { + "type": "string", + "name": "expires", + "description": "Cookie expiration time. (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.123+02:00).", + "optional": true + }, + { + "type": "boolean", + "name": "httpOnly", + "description": "Set to true if the cookie is HTTP only, false otherwise.", + "optional": true + }, + { + "type": "boolean", + "name": "secure", + "description": "True if the cookie was transmitted over ssl, false otherwise.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Creator", + "description": "Creator and browser objects share the same structure.", + "properties": [ + { + "type": "string", + "name": "name", + "description": "Name of the application/browser used to export the log." + }, + { + "type": "string", + "name": "version", + "description": "Version of the application/browser used to export the log." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Entry", + "description": "This object represents an array with all exported HTTP requests. Sorting entries by startedDateTime (starting from the oldest) is preferred way how to export data since it can make importing faster. However the reader application should always make sure the array is sorted (if required for the import).", + "properties": [ + { + "type": "string", + "name": "pageref", + "description": "Reference to the parent page. Leave out this field if the application does not support grouping by pages.", + "optional": true + }, + { + "type": "string", + "name": "startedDateTime", + "description": "Date and time stamp of the request start (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD)." + }, + { + "type": "number", + "name": "time", + "description": "Total elapsed time of the request in milliseconds. This is the sum of all timings available in the timings object (i.e. not including -1 values) ." + }, + { + "name": "request", + "description": "Detailed info about the request.", + "$ref": "Request" + }, + { + "name": "response", + "description": "Detailed info about the response.", + "$ref": "Response" + }, + { + "name": "cache", + "description": "Info about cache usage.", + "$ref": "Cache" + }, + { + "name": "timings", + "description": "Detailed timing info about request/response round trip.", + "$ref": "Timings" + }, + { + "type": "string", + "name": "serverIPAddress", + "description": "IP address of the server that was connected (result of DNS resolution).", + "optional": true + }, + { + "type": "string", + "name": "connection", + "description": "Unique ID of the parent TCP/IP connection, can be the client or server port number. Note that a port number doesn't have to be unique identifier in cases where the port is shared for more connections. If the port isn't available for the application, any other unique connection ID can be used instead (e.g. connection index). Leave out this field if the application doesn't support this info.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "HAR", + "description": "Parent container for HAR log.", + "properties": [ + { + "name": "log", + "$ref": "Log" + } + ] + }, + { + "type": "object", + "id": "Log", + "description": "This object represents the root of exported data.", + "properties": [ + { + "type": "string", + "name": "version", + "description": "Version number of the format. If empty, string \"1.1\" is assumed by default." + }, + { + "name": "creator", + "description": "Name and version info of the log creator application.", + "$ref": "Creator" + }, + { + "name": "browser", + "description": "Name and version info of used browser.", + "optional": true, + "$ref": "Creator" + }, + { + "type": "array", + "name": "pages", + "description": "List of all exported (tracked) pages. Leave out this field if the application does not support grouping by pages.", + "optional": true, + "items": { + "$ref": "Page" + } + }, + { + "type": "array", + "name": "entries", + "description": "List of all exported (tracked) requests.", + "items": { + "$ref": "Entry" + } + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "NameValuePair", + "description": "Describes a name/value pair.", + "properties": [ + { + "type": "string", + "name": "name", + "description": "Name of the pair." + }, + { + "type": "string", + "name": "value", + "description": "Value of the pair." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Page", + "description": "This object represents list of exported pages.", + "properties": [ + { + "type": "string", + "name": "startedDateTime", + "description": "Date and time stamp for the beginning of the page load (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.45+01:00)." + }, + { + "type": "string", + "name": "id", + "description": "Unique identifier of a page within the \u003clog\u003e. Entries use it to refer the parent page." + }, + { + "type": "string", + "name": "title", + "description": "Page title." + }, + { + "name": "pageTimings", + "description": "Detailed timing info about page load.", + "$ref": "PageTimings" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "PageTimings", + "description": "This object describes timings for various events (states) fired during the page load. All times are specified in milliseconds. If a time info is not available appropriate field is set to -1.", + "properties": [ + { + "type": "number", + "name": "onContentLoad", + "description": "Content of the page loaded. Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "onLoad", + "description": "Page is loaded (onLoad event fired). Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Param", + "description": "List of posted parameters, if any (embedded in \u003cpostData\u003e object).", + "properties": [ + { + "type": "string", + "name": "name", + "description": "name of a posted parameter." + }, + { + "type": "string", + "name": "value", + "description": "value of a posted parameter or content of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "fileName", + "description": "name of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "contentType", + "description": "content type of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "PostData", + "description": "This object describes posted data, if any (embedded in \u003crequest\u003e object).", + "properties": [ + { + "type": "string", + "name": "mimeType", + "description": "Mime type of posted data." + }, + { + "type": "array", + "name": "params", + "description": "List of posted parameters (in case of URL encoded parameters).", + "items": { + "$ref": "Param" + } + }, + { + "type": "string", + "name": "text", + "description": "Plain text posted data" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Request", + "description": "This object contains detailed info about performed request.", + "properties": [ + { + "type": "string", + "name": "method", + "description": "Request method (GET, POST, ...)." + }, + { + "type": "string", + "name": "url", + "description": "Absolute URL of the request (fragments are not included)." + }, + { + "type": "string", + "name": "httpVersion", + "description": "Request HTTP Version." + }, + { + "type": "array", + "name": "cookies", + "description": "List of cookie objects.", + "items": { + "$ref": "Cookie" + } + }, + { + "type": "array", + "name": "headers", + "description": "List of header objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "type": "array", + "name": "queryString", + "description": "List of query parameter objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "name": "postData", + "description": "Posted data info.", + "optional": true, + "$ref": "PostData" + }, + { + "type": "integer", + "name": "headersSize", + "description": "Total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the body. Set to -1 if the info is not available." + }, + { + "type": "integer", + "name": "bodySize", + "description": "Size of the request body (POST data payload) in bytes. Set to -1 if the info is not available." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Response", + "description": "This object contains detailed info about the response.", + "properties": [ + { + "type": "integer", + "name": "status", + "description": "Response status." + }, + { + "type": "string", + "name": "statusText", + "description": "Response status description." + }, + { + "type": "string", + "name": "httpVersion", + "description": "Response HTTP Version." + }, + { + "type": "array", + "name": "cookies", + "description": "List of cookie objects.", + "items": { + "$ref": "Cookie" + } + }, + { + "type": "array", + "name": "headers", + "description": "List of header objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "name": "content", + "description": "Details about the response body.", + "$ref": "Content" + }, + { + "type": "string", + "name": "redirectURL", + "description": "Redirection target URL from the Location response header." + }, + { + "type": "integer", + "name": "headersSize", + "description": "Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the body. Set to -1 if the info is not available." + }, + { + "type": "integer", + "name": "bodySize", + "description": "Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Timings", + "description": "This object describes various phases within request-response round trip. All times are specified in milliseconds.", + "properties": [ + { + "type": "number", + "name": "blocked", + "description": "Time spent in a queue waiting for a network connection. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "dns", + "description": "DNS resolution time. The time required to resolve a host name. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "connect", + "description": "Time required to create TCP connection. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "send", + "description": "Time required to send HTTP request to the server." + }, + { + "type": "number", + "name": "wait", + "description": "Waiting for a response from the server." + }, + { + "type": "number", + "name": "receive", + "description": "Time required to read entire response from the server (or cache)." + }, + { + "type": "number", + "name": "ssl", + "description": "Time required for SSL/TLS negotiation. If this field is defined then the time is also included in the connect field (to ensure backward compatibility with HAR 1.1). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/cmd/chromedp-gen/internal/domain.go b/cmd/chromedp-gen/internal/domain.go index 376623b..0df853c 100644 --- a/cmd/chromedp-gen/internal/domain.go +++ b/cmd/chromedp-gen/internal/domain.go @@ -27,6 +27,7 @@ const ( DomainDebugger DomainType = "Debugger" DomainDeviceOrientation DomainType = "DeviceOrientation" DomainEmulation DomainType = "Emulation" + DomainHAR DomainType = "HAR" DomainHeapProfiler DomainType = "HeapProfiler" DomainIO DomainType = "IO" DomainIndexedDB DomainType = "IndexedDB" @@ -98,6 +99,8 @@ func (dt *DomainType) UnmarshalJSON(buf []byte) error { *dt = DomainDeviceOrientation case DomainEmulation: *dt = DomainEmulation + case DomainHAR: + *dt = DomainHAR case DomainHeapProfiler: *dt = DomainHeapProfiler case DomainIO: diff --git a/cmd/chromedp-gen/main.go b/cmd/chromedp-gen/main.go index bb88927..a96980b 100644 --- a/cmd/chromedp-gen/main.go +++ b/cmd/chromedp-gen/main.go @@ -4,7 +4,7 @@ // Please see README.md for more information on using this tool. package main -//go:generate go run domain-gen.go +//go:generate go run gen-domain.go //go:generate qtc -dir templates -ext qtpl //go:generate gofmt -w -s templates/ diff --git a/cmd/chromedp-gen/protocol.json b/cmd/chromedp-gen/protocol.json index b9e69ff..380a660 100644 --- a/cmd/chromedp-gen/protocol.json +++ b/cmd/chromedp-gen/protocol.json @@ -13633,6 +13633,638 @@ ] } ] + }, + { + "domain": "HAR", + "description": "HTTP Archive Format", + "types": [ + { + "type": "object", + "id": "Cache", + "description": "This objects contains info about a request coming from browser cache.", + "properties": [ + { + "name": "beforeRequest", + "description": "State of a cache entry before the request. Leave out this field if the information is not available.", + "optional": true, + "$ref": "CacheData" + }, + { + "name": "afterRequest", + "description": "State of a cache entry after the request. Leave out this field if the information is not available.", + "optional": true, + "$ref": "CacheData" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "CacheData", + "description": "Describes the cache data for beforeRequest and afterRequest.", + "properties": [ + { + "type": "string", + "name": "expires", + "description": "Expiration time of the cache entry.", + "optional": true + }, + { + "type": "string", + "name": "lastAccess", + "description": "The last time the cache entry was opened." + }, + { + "type": "string", + "name": "eTag", + "description": "Etag" + }, + { + "type": "integer", + "name": "hitCount", + "description": "The number of times the cache entry has been opened." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Content", + "description": "This object describes details about response content (embedded in object).", + "properties": [ + { + "type": "integer", + "name": "size", + "description": "Length of the returned content in bytes. Should be equal to response.bodySize if there is no compression and bigger when the content has been compressed." + }, + { + "type": "integer", + "name": "compression", + "description": "Number of bytes saved. Leave out this field if the information is not available.", + "optional": true + }, + { + "type": "string", + "name": "mimeType", + "description": "MIME type of the response text (value of the Content-Type response header). The charset attribute of the MIME type is included (if available)." + }, + { + "type": "string", + "name": "text", + "description": "Response body sent from the server or loaded from the browser cache. This field is populated with textual content only. The text field is either HTTP decoded text or a encoded (e.g. \"base64\") representation of the response body. Leave out this field if the information is not available.", + "optional": true + }, + { + "type": "string", + "name": "encoding", + "description": "Encoding used for response text field e.g \"base64\". Leave out this field if the text field is HTTP decoded (decompressed & unchunked), than trans-coded from its original character set into UTF-8.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Cookie", + "description": "This object contains list of all cookies (used in and objects).", + "properties": [ + { + "type": "string", + "name": "name", + "description": "The name of the cookie." + }, + { + "type": "string", + "name": "value", + "description": "The cookie value." + }, + { + "type": "string", + "name": "path", + "description": "The path pertaining to the cookie.", + "optional": true + }, + { + "type": "string", + "name": "domain", + "description": "The host of the cookie.", + "optional": true + }, + { + "type": "string", + "name": "expires", + "description": "Cookie expiration time. (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.123+02:00).", + "optional": true + }, + { + "type": "boolean", + "name": "httpOnly", + "description": "Set to true if the cookie is HTTP only, false otherwise.", + "optional": true + }, + { + "type": "boolean", + "name": "secure", + "description": "True if the cookie was transmitted over ssl, false otherwise.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Creator", + "description": "Creator and browser objects share the same structure.", + "properties": [ + { + "type": "string", + "name": "name", + "description": "Name of the application/browser used to export the log." + }, + { + "type": "string", + "name": "version", + "description": "Version of the application/browser used to export the log." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Entry", + "description": "This object represents an array with all exported HTTP requests. Sorting entries by startedDateTime (starting from the oldest) is preferred way how to export data since it can make importing faster. However the reader application should always make sure the array is sorted (if required for the import).", + "properties": [ + { + "type": "string", + "name": "pageref", + "description": "Reference to the parent page. Leave out this field if the application does not support grouping by pages.", + "optional": true + }, + { + "type": "string", + "name": "startedDateTime", + "description": "Date and time stamp of the request start (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD)." + }, + { + "type": "number", + "name": "time", + "description": "Total elapsed time of the request in milliseconds. This is the sum of all timings available in the timings object (i.e. not including -1 values) ." + }, + { + "name": "request", + "description": "Detailed info about the request.", + "$ref": "Request" + }, + { + "name": "response", + "description": "Detailed info about the response.", + "$ref": "Response" + }, + { + "name": "cache", + "description": "Info about cache usage.", + "$ref": "Cache" + }, + { + "name": "timings", + "description": "Detailed timing info about request/response round trip.", + "$ref": "Timings" + }, + { + "type": "string", + "name": "serverIPAddress", + "description": "IP address of the server that was connected (result of DNS resolution).", + "optional": true + }, + { + "type": "string", + "name": "connection", + "description": "Unique ID of the parent TCP/IP connection, can be the client or server port number. Note that a port number doesn't have to be unique identifier in cases where the port is shared for more connections. If the port isn't available for the application, any other unique connection ID can be used instead (e.g. connection index). Leave out this field if the application doesn't support this info.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "HAR", + "description": "Parent container for HAR log.", + "properties": [ + { + "name": "log", + "$ref": "Log" + } + ] + }, + { + "type": "object", + "id": "Log", + "description": "This object represents the root of exported data.", + "properties": [ + { + "type": "string", + "name": "version", + "description": "Version number of the format. If empty, string \"1.1\" is assumed by default." + }, + { + "name": "creator", + "description": "Name and version info of the log creator application.", + "$ref": "Creator" + }, + { + "name": "browser", + "description": "Name and version info of used browser.", + "optional": true, + "$ref": "Creator" + }, + { + "type": "array", + "name": "pages", + "description": "List of all exported (tracked) pages. Leave out this field if the application does not support grouping by pages.", + "optional": true, + "items": { + "$ref": "Page" + } + }, + { + "type": "array", + "name": "entries", + "description": "List of all exported (tracked) requests.", + "items": { + "$ref": "Entry" + } + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "NameValuePair", + "description": "Describes a name/value pair.", + "properties": [ + { + "type": "string", + "name": "name", + "description": "Name of the pair." + }, + { + "type": "string", + "name": "value", + "description": "Value of the pair." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Page", + "description": "This object represents list of exported pages.", + "properties": [ + { + "type": "string", + "name": "startedDateTime", + "description": "Date and time stamp for the beginning of the page load (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.45+01:00)." + }, + { + "type": "string", + "name": "id", + "description": "Unique identifier of a page within the . Entries use it to refer the parent page." + }, + { + "type": "string", + "name": "title", + "description": "Page title." + }, + { + "name": "pageTimings", + "description": "Detailed timing info about page load.", + "$ref": "PageTimings" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "PageTimings", + "description": "This object describes timings for various events (states) fired during the page load. All times are specified in milliseconds. If a time info is not available appropriate field is set to -1.", + "properties": [ + { + "type": "number", + "name": "onContentLoad", + "description": "Content of the page loaded. Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "onLoad", + "description": "Page is loaded (onLoad event fired). Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Param", + "description": "List of posted parameters, if any (embedded in object).", + "properties": [ + { + "type": "string", + "name": "name", + "description": "name of a posted parameter." + }, + { + "type": "string", + "name": "value", + "description": "value of a posted parameter or content of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "fileName", + "description": "name of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "contentType", + "description": "content type of a posted file.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "PostData", + "description": "This object describes posted data, if any (embedded in object).", + "properties": [ + { + "type": "string", + "name": "mimeType", + "description": "Mime type of posted data." + }, + { + "type": "array", + "name": "params", + "description": "List of posted parameters (in case of URL encoded parameters).", + "items": { + "$ref": "Param" + } + }, + { + "type": "string", + "name": "text", + "description": "Plain text posted data" + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Request", + "description": "This object contains detailed info about performed request.", + "properties": [ + { + "type": "string", + "name": "method", + "description": "Request method (GET, POST, ...)." + }, + { + "type": "string", + "name": "url", + "description": "Absolute URL of the request (fragments are not included)." + }, + { + "type": "string", + "name": "httpVersion", + "description": "Request HTTP Version." + }, + { + "type": "array", + "name": "cookies", + "description": "List of cookie objects.", + "items": { + "$ref": "Cookie" + } + }, + { + "type": "array", + "name": "headers", + "description": "List of header objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "type": "array", + "name": "queryString", + "description": "List of query parameter objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "name": "postData", + "description": "Posted data info.", + "optional": true, + "$ref": "PostData" + }, + { + "type": "integer", + "name": "headersSize", + "description": "Total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the body. Set to -1 if the info is not available." + }, + { + "type": "integer", + "name": "bodySize", + "description": "Size of the request body (POST data payload) in bytes. Set to -1 if the info is not available." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Response", + "description": "This object contains detailed info about the response.", + "properties": [ + { + "type": "integer", + "name": "status", + "description": "Response status." + }, + { + "type": "string", + "name": "statusText", + "description": "Response status description." + }, + { + "type": "string", + "name": "httpVersion", + "description": "Response HTTP Version." + }, + { + "type": "array", + "name": "cookies", + "description": "List of cookie objects.", + "items": { + "$ref": "Cookie" + } + }, + { + "type": "array", + "name": "headers", + "description": "List of header objects.", + "items": { + "$ref": "NameValuePair" + } + }, + { + "name": "content", + "description": "Details about the response body.", + "$ref": "Content" + }, + { + "type": "string", + "name": "redirectURL", + "description": "Redirection target URL from the Location response header." + }, + { + "type": "integer", + "name": "headersSize", + "description": "Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the body. Set to -1 if the info is not available." + }, + { + "type": "integer", + "name": "bodySize", + "description": "Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available." + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + }, + { + "type": "object", + "id": "Timings", + "description": "This object describes various phases within request-response round trip. All times are specified in milliseconds.", + "properties": [ + { + "type": "number", + "name": "blocked", + "description": "Time spent in a queue waiting for a network connection. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "dns", + "description": "DNS resolution time. The time required to resolve a host name. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "connect", + "description": "Time required to create TCP connection. Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "number", + "name": "send", + "description": "Time required to send HTTP request to the server." + }, + { + "type": "number", + "name": "wait", + "description": "Waiting for a response from the server." + }, + { + "type": "number", + "name": "receive", + "description": "Time required to read entire response from the server (or cache)." + }, + { + "type": "number", + "name": "ssl", + "description": "Time required for SSL/TLS negotiation. If this field is defined then the time is also included in the connect field (to ensure backward compatibility with HAR 1.1). Use -1 if the timing does not apply to the current request.", + "optional": true + }, + { + "type": "string", + "name": "comment", + "description": "A comment provided by the user or the application.", + "optional": true + } + ] + } + ] } ] } diff --git a/cmd/chromedp-gen/update.sh b/cmd/chromedp-gen/update.sh index 40cd8fa..d518855 100755 --- a/cmd/chromedp-gen/update.sh +++ b/cmd/chromedp-gen/update.sh @@ -4,6 +4,8 @@ SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) +HAR_PROTO="$SRC/har.json" + BASE_URL="https://chromium.googlesource.com" BROWSER_PROTO="$BASE_URL/chromium/src/+/master/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT" JS_PROTO="$BASE_URL/v8/v8/+/master/src/inspector/js_protocol.json?format=TEXT" @@ -20,7 +22,7 @@ curl -s $BROWSER_PROTO | base64 -d > $BROWSER_TMP curl -s $JS_PROTO | base64 -d > $JS_TMP # merge browser_protocol.json and js_protocol.json -jq -s '[.[] | to_entries] | flatten | reduce .[] as $dot ({}; .[$dot.key] += $dot.value)' $BROWSER_TMP $JS_TMP > $OUT +jq -s '[.[] | to_entries] | flatten | reduce .[] as $dot ({}; .[$dot.key] += $dot.value)' $BROWSER_TMP $JS_TMP $HAR_PROTO > $OUT UPDATE=0 LASTUPDATE=0