Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-09-28 15:41:05 +07:00
parent f7ba4ae79b
commit 2bc9c6ad0b
20 changed files with 73 additions and 52 deletions

View File

@ -1828,7 +1828,7 @@ func (t *ShadowRootType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t) return easyjson.Unmarshal(buf, t)
} }
// Node dOM interaction is implemented in terms of mirror objects that // Node DOM interaction is implemented in terms of mirror objects that
// represent the actual DOM nodes. DOMNode is a base node mirror type. // represent the actual DOM nodes. DOMNode is a base node mirror type.
type Node struct { type Node struct {
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. 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.

View File

@ -71,7 +71,7 @@ func (t *StyleSheetOrigin) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t) return easyjson.Unmarshal(buf, t)
} }
// PseudoElementMatches cSS rule collection for a single pseudo style. // PseudoElementMatches CSS rule collection for a single pseudo style.
type PseudoElementMatches struct { type PseudoElementMatches struct {
PseudoType cdp.PseudoType `json:"pseudoType"` // Pseudo element type. PseudoType cdp.PseudoType `json:"pseudoType"` // Pseudo element type.
Matches []*RuleMatch `json:"matches"` // Matches of CSS rules applicable to the pseudo style. Matches []*RuleMatch `json:"matches"` // Matches of CSS rules applicable to the pseudo style.
@ -102,7 +102,7 @@ type SelectorList struct {
Text string `json:"text"` // Rule selector text. Text string `json:"text"` // Rule selector text.
} }
// StyleSheetHeader cSS stylesheet metainformation. // StyleSheetHeader CSS stylesheet metainformation.
type StyleSheetHeader struct { type StyleSheetHeader struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The stylesheet identifier. StyleSheetID StyleSheetID `json:"styleSheetId"` // The stylesheet identifier.
FrameID cdp.FrameID `json:"frameId"` // Owner frame identifier. FrameID cdp.FrameID `json:"frameId"` // Owner frame identifier.
@ -119,7 +119,7 @@ type StyleSheetHeader struct {
Length float64 `json:"length"` // Size of the content (in characters). Length float64 `json:"length"` // Size of the content (in characters).
} }
// Rule cSS rule representation. // Rule CSS rule representation.
type Rule struct { 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. 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"` // Rule selector data. SelectorList *SelectorList `json:"selectorList"` // Rule selector data.
@ -128,7 +128,7 @@ type Rule struct {
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. 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. // RuleUsage CSS coverage information.
type RuleUsage struct { type RuleUsage struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from. 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. StartOffset float64 `json:"startOffset"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet.
@ -157,7 +157,7 @@ type ComputedProperty struct {
Value string `json:"value"` // Computed style property value. Value string `json:"value"` // Computed style property value.
} }
// Style cSS style representation. // Style CSS style representation.
type Style struct { 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. 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. CSSProperties []*Property `json:"cssProperties"` // CSS properties in the style.
@ -166,7 +166,7 @@ type Style struct {
Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available). Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available).
} }
// Property cSS property declaration data. // Property CSS property declaration data.
type Property struct { type Property struct {
Name string `json:"name"` // The property name. Name string `json:"name"` // The property name.
Value string `json:"value"` // The property value. Value string `json:"value"` // The property value.
@ -178,7 +178,7 @@ type Property struct {
Range *SourceRange `json:"range,omitempty"` // The entire property range in the enclosing style declaration (if available). Range *SourceRange `json:"range,omitempty"` // The entire property range in the enclosing style declaration (if available).
} }
// Media cSS media rule descriptor. // Media CSS media rule descriptor.
type Media struct { type Media struct {
Text string `json:"text"` // Media query text. 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. 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.
@ -211,13 +211,13 @@ type PlatformFontUsage struct {
GlyphCount float64 `json:"glyphCount"` // Amount of glyphs that were rendered with this font. GlyphCount float64 `json:"glyphCount"` // Amount of glyphs that were rendered with this font.
} }
// KeyframesRule cSS keyframes rule representation. // KeyframesRule CSS keyframes rule representation.
type KeyframesRule struct { type KeyframesRule struct {
AnimationName *Value `json:"animationName"` // Animation name. AnimationName *Value `json:"animationName"` // Animation name.
Keyframes []*KeyframeRule `json:"keyframes"` // List of keyframes. Keyframes []*KeyframeRule `json:"keyframes"` // List of keyframes.
} }
// KeyframeRule cSS keyframe rule representation. // KeyframeRule CSS keyframe rule representation.
type KeyframeRule struct { 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. 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"` // Parent stylesheet's origin. Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin.

View File

@ -121,7 +121,7 @@ func SetBreakpointByURL(lineNumber int64) *SetBreakpointByURLParams {
} }
} }
// WithURL uRL of the resources to set breakpoint on. // WithURL URL of the resources to set breakpoint on.
func (p SetBreakpointByURLParams) WithURL(url string) *SetBreakpointByURLParams { func (p SetBreakpointByURLParams) WithURL(url string) *SetBreakpointByURLParams {
p.URL = url p.URL = url
return &p return &p
@ -484,7 +484,7 @@ func SetScriptSource(scriptID runtime.ScriptID, scriptSource string) *SetScriptS
} }
} }
// WithDryRun If true the change will not actually be applied. Dry run may be // WithDryRun if true the change will not actually be applied. Dry run may be
// used to get result description without actually modifying the code. // used to get result description without actually modifying the code.
func (p SetScriptSourceParams) WithDryRun(dryRun bool) *SetScriptSourceParams { func (p SetScriptSourceParams) WithDryRun(dryRun bool) *SetScriptSourceParams {
p.DryRun = dryRun p.DryRun = dryRun

View File

@ -40,7 +40,7 @@ type ScriptPosition struct {
ColumnNumber int64 `json:"columnNumber"` ColumnNumber int64 `json:"columnNumber"`
} }
// CallFrame javaScript call frame. Array of call frames form the call stack. // CallFrame JavaScript call frame. Array of call frames form the call stack.
type CallFrame struct { type CallFrame struct {
CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier. This identifier is only valid while the virtual machine is paused. 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. FunctionName string `json:"functionName"` // Name of the JavaScript function called on this call frame.

View File

@ -512,7 +512,7 @@ func (p GetOuterHTMLParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *
return &p return &p
} }
// WithObjectID javaScript object id of the node wrapper. // WithObjectID JavaScript object id of the node wrapper.
func (p GetOuterHTMLParams) WithObjectID(objectID runtime.RemoteObjectID) *GetOuterHTMLParams { func (p GetOuterHTMLParams) WithObjectID(objectID runtime.RemoteObjectID) *GetOuterHTMLParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p
@ -613,7 +613,7 @@ func (p *PerformSearchParams) Do(ctxt context.Context, h cdp.Handler) (searchID
} }
// GetSearchResultsParams returns search results from given fromIndex to // GetSearchResultsParams returns search results from given fromIndex to
// given toIndex from the sarch with the given identifier. // given toIndex from the search with the given identifier.
type GetSearchResultsParams struct { type GetSearchResultsParams struct {
SearchID string `json:"searchId"` // Unique search session identifier. SearchID string `json:"searchId"` // Unique search session identifier.
FromIndex int64 `json:"fromIndex"` // Start index of the search result to be returned. FromIndex int64 `json:"fromIndex"` // Start index of the search result to be returned.
@ -621,7 +621,7 @@ type GetSearchResultsParams struct {
} }
// GetSearchResults returns search results from given fromIndex to given // GetSearchResults returns search results from given fromIndex to given
// toIndex from the sarch with the given identifier. // toIndex from the search with the given identifier.
// //
// parameters: // parameters:
// searchID - Unique search session identifier. // searchID - Unique search session identifier.
@ -836,7 +836,7 @@ func ResolveNode() *ResolveNodeParams {
return &ResolveNodeParams{} return &ResolveNodeParams{}
} }
// WithNodeID id of the node to resolve. // WithNodeID ID of the node to resolve.
func (p ResolveNodeParams) WithNodeID(nodeID cdp.NodeID) *ResolveNodeParams { func (p ResolveNodeParams) WithNodeID(nodeID cdp.NodeID) *ResolveNodeParams {
p.NodeID = nodeID p.NodeID = nodeID
return &p return &p
@ -1078,7 +1078,7 @@ func (p FocusParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *FocusPa
return &p return &p
} }
// WithObjectID javaScript object id of the node wrapper. // WithObjectID JavaScript object id of the node wrapper.
func (p FocusParams) WithObjectID(objectID runtime.RemoteObjectID) *FocusParams { func (p FocusParams) WithObjectID(objectID runtime.RemoteObjectID) *FocusParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p
@ -1120,7 +1120,7 @@ func (p SetFileInputFilesParams) WithBackendNodeID(backendNodeID cdp.BackendNode
return &p return &p
} }
// WithObjectID javaScript object id of the node wrapper. // WithObjectID JavaScript object id of the node wrapper.
func (p SetFileInputFilesParams) WithObjectID(objectID runtime.RemoteObjectID) *SetFileInputFilesParams { func (p SetFileInputFilesParams) WithObjectID(objectID runtime.RemoteObjectID) *SetFileInputFilesParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p
@ -1158,7 +1158,7 @@ func (p GetBoxModelParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *G
return &p return &p
} }
// WithObjectID javaScript object id of the node wrapper. // WithObjectID JavaScript object id of the node wrapper.
func (p GetBoxModelParams) WithObjectID(objectID runtime.RemoteObjectID) *GetBoxModelParams { func (p GetBoxModelParams) WithObjectID(objectID runtime.RemoteObjectID) *GetBoxModelParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p
@ -1300,7 +1300,7 @@ func (p DescribeNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *
return &p return &p
} }
// WithObjectID javaScript object id of the node wrapper. // WithObjectID JavaScript object id of the node wrapper.
func (p DescribeNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *DescribeNodeParams { func (p DescribeNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *DescribeNodeParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p

View File

@ -19,14 +19,14 @@ type BoxModel struct {
ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates
} }
// ShapeOutsideInfo cSS Shape Outside details. // ShapeOutsideInfo CSS Shape Outside details.
type ShapeOutsideInfo struct { type ShapeOutsideInfo struct {
Bounds Quad `json:"bounds"` // Shape bounds Bounds Quad `json:"bounds"` // Shape bounds
Shape []easyjson.RawMessage `json:"shape"` // Shape coordinate details Shape []easyjson.RawMessage `json:"shape"` // Shape coordinate details
MarginShape []easyjson.RawMessage `json:"marginShape"` // Margin shape bounds MarginShape []easyjson.RawMessage `json:"marginShape"` // Margin shape bounds
} }
// Rect rectangle. // Rect Rectangle.
type Rect struct { type Rect struct {
X float64 `json:"x"` // X coordinate X float64 `json:"x"` // X coordinate
Y float64 `json:"y"` // Y coordinate Y float64 `json:"y"` // Y coordinate

View File

@ -12,7 +12,7 @@ import (
"github.com/mailru/easyjson/jwriter" "github.com/mailru/easyjson/jwriter"
) )
// DOMBreakpointType dOM breakpoint type. // DOMBreakpointType DOM breakpoint type.
type DOMBreakpointType string type DOMBreakpointType string
// String returns the DOMBreakpointType as string value. // String returns the DOMBreakpointType as string value.

View File

@ -19,7 +19,7 @@ import (
// of the root node (including iframes, template contents, and imported // of the root node (including iframes, template contents, and imported
// documents) in a flattened array, as well as layout and white-listed computed // documents) in a flattened array, as well as layout and white-listed computed
// style information for the nodes. Shadow DOM in the returned DOM tree is // style information for the nodes. Shadow DOM in the returned DOM tree is
// flattened. . // flattened.
type GetSnapshotParams struct { type GetSnapshotParams struct {
ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return. ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return.
} }
@ -28,7 +28,6 @@ type GetSnapshotParams struct {
// the root node (including iframes, template contents, and imported documents) // the root node (including iframes, template contents, and imported documents)
// in a flattened array, as well as layout and white-listed computed style // in a flattened array, as well as layout and white-listed computed style
// information for the nodes. Shadow DOM in the returned DOM tree is flattened. // information for the nodes. Shadow DOM in the returned DOM tree is flattened.
// .
// //
// parameters: // parameters:
// computedStyleWhitelist - Whitelist of computed styles to return. // computedStyleWhitelist - Whitelist of computed styles to return.

View File

@ -2,11 +2,11 @@ package domstorage
// Code generated by chromedp-gen. DO NOT EDIT. // Code generated by chromedp-gen. DO NOT EDIT.
// StorageID dOM Storage identifier. // StorageID DOM Storage identifier.
type StorageID struct { type StorageID struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin for the storage. SecurityOrigin string `json:"securityOrigin"` // Security origin for the storage.
IsLocalStorage bool `json:"isLocalStorage"` // Whether the storage is local storage (not session storage). IsLocalStorage bool `json:"isLocalStorage"` // Whether the storage is local storage (not session storage).
} }
// Item dOM Storage item. // Item DOM Storage item.
type Item []string type Item []string

View File

@ -20,7 +20,7 @@ type SamplingHeapProfileNode struct {
Children []*SamplingHeapProfileNode `json:"children"` // Child nodes. Children []*SamplingHeapProfileNode `json:"children"` // Child nodes.
} }
// SamplingHeapProfile profile. // SamplingHeapProfile Profile.
type SamplingHeapProfile struct { type SamplingHeapProfile struct {
Head *SamplingHeapProfileNode `json:"head"` Head *SamplingHeapProfileNode `json:"head"`
} }

View File

@ -34,7 +34,7 @@ type ObjectStoreIndex struct {
MultiEntry bool `json:"multiEntry"` // If true, index allows multiple entries for a key. MultiEntry bool `json:"multiEntry"` // If true, index allows multiple entries for a key.
} }
// Key key. // Key Key.
type Key struct { type Key struct {
Type KeyType `json:"type"` // Key type. Type KeyType `json:"type"` // Key type.
Number float64 `json:"number,omitempty"` // Number value. Number float64 `json:"number,omitempty"` // Number value.

View File

@ -201,13 +201,13 @@ func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMous
return &p return &p
} }
// WithDeltaX x delta in CSS pixels for mouse wheel event (default: 0). // WithDeltaX X delta in CSS pixels for mouse wheel event (default: 0).
func (p DispatchMouseEventParams) WithDeltaX(deltaX float64) *DispatchMouseEventParams { func (p DispatchMouseEventParams) WithDeltaX(deltaX float64) *DispatchMouseEventParams {
p.DeltaX = deltaX p.DeltaX = deltaX
return &p return &p
} }
// WithDeltaY y delta in CSS pixels for mouse wheel event (default: 0). // WithDeltaY Y delta in CSS pixels for mouse wheel event (default: 0).
func (p DispatchMouseEventParams) WithDeltaY(deltaY float64) *DispatchMouseEventParams { func (p DispatchMouseEventParams) WithDeltaY(deltaY float64) *DispatchMouseEventParams {
p.DeltaY = deltaY p.DeltaY = deltaY
return &p return &p
@ -291,13 +291,13 @@ func EmulateTouchFromMouseEvent(typeVal MouseType, x int64, y int64, timestamp *
} }
} }
// WithDeltaX x delta in DIP for mouse wheel event (default: 0). // WithDeltaX X delta in DIP for mouse wheel event (default: 0).
func (p EmulateTouchFromMouseEventParams) WithDeltaX(deltaX float64) *EmulateTouchFromMouseEventParams { func (p EmulateTouchFromMouseEventParams) WithDeltaX(deltaX float64) *EmulateTouchFromMouseEventParams {
p.DeltaX = deltaX p.DeltaX = deltaX
return &p return &p
} }
// WithDeltaY y delta in DIP for mouse wheel event (default: 0). // WithDeltaY Y delta in DIP for mouse wheel event (default: 0).
func (p EmulateTouchFromMouseEventParams) WithDeltaY(deltaY float64) *EmulateTouchFromMouseEventParams { func (p EmulateTouchFromMouseEventParams) WithDeltaY(deltaY float64) *EmulateTouchFromMouseEventParams {
p.DeltaY = deltaY p.DeltaY = deltaY
return &p return &p

View File

@ -40,7 +40,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork(in *jlexer.Lexer, out
} }
switch key { switch key {
case "status": case "status":
out.Status = float64(in.Float64()) out.Status = int64(in.Int64())
case "statusText": case "statusText":
out.StatusText = string(in.String()) out.StatusText = string(in.String())
case "headers": case "headers":
@ -118,7 +118,7 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork(out *jwriter.Writer, i
} }
first = false first = false
out.RawString("\"status\":") out.RawString("\"status\":")
out.Float64(float64(in.Status)) out.Int64(int64(in.Status))
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }
@ -1767,7 +1767,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork15(in *jlexer.Lexer, ou
case "url": case "url":
out.URL = string(in.String()) out.URL = string(in.String())
case "status": case "status":
out.Status = float64(in.Float64()) out.Status = int64(in.Int64())
case "statusText": case "statusText":
out.StatusText = string(in.String()) out.StatusText = string(in.String())
case "headers": case "headers":
@ -1891,7 +1891,7 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork15(out *jwriter.Writer,
} }
first = false first = false
out.RawString("\"status\":") out.RawString("\"status\":")
out.Float64(float64(in.Status)) out.Int64(int64(in.Status))
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }

View File

@ -283,7 +283,7 @@ func (t *ResourcePriority) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t) return easyjson.Unmarshal(buf, t)
} }
// Request hTTP request data. // Request HTTP request data.
type Request struct { type Request struct {
URL string `json:"url"` // Request URL. URL string `json:"url"` // Request URL.
Method string `json:"method"` // HTTP request method. Method string `json:"method"` // HTTP request method.
@ -378,10 +378,10 @@ func (t *BlockedReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t) return easyjson.Unmarshal(buf, t)
} }
// Response hTTP response data. // Response HTTP response data.
type Response struct { type Response struct {
URL string `json:"url"` // Response URL. This URL can be different from CachedResource.url in case of redirect. 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. Status int64 `json:"status"` // HTTP response status code.
StatusText string `json:"statusText"` // HTTP response status text. StatusText string `json:"statusText"` // HTTP response status text.
Headers Headers `json:"headers"` // HTTP response headers. Headers Headers `json:"headers"` // HTTP response headers.
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text. HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
@ -408,7 +408,7 @@ type WebSocketRequest struct {
// WebSocketResponse webSocket response data. // WebSocketResponse webSocket response data.
type WebSocketResponse struct { type WebSocketResponse struct {
Status float64 `json:"status"` // HTTP response status code. Status int64 `json:"status"` // HTTP response status code.
StatusText string `json:"statusText"` // HTTP response status text. StatusText string `json:"statusText"` // HTTP response status text.
Headers Headers `json:"headers"` // HTTP response headers. Headers Headers `json:"headers"` // HTTP response headers.
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text. HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.

View File

@ -349,7 +349,7 @@ func (p HighlightNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID)
return &p return &p
} }
// WithObjectID javaScript object id of the node to be highlighted. // WithObjectID JavaScript object id of the node to be highlighted.
func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams { func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams {
p.ObjectID = objectID p.ObjectID = objectID
return &p return &p

View File

@ -15,7 +15,7 @@ type ProfileNode struct {
PositionTicks []*PositionTickInfo `json:"positionTicks,omitempty"` // An array of source position ticks. PositionTicks []*PositionTickInfo `json:"positionTicks,omitempty"` // An array of source position ticks.
} }
// Profile profile. // Profile Profile.
type Profile struct { type Profile struct {
Nodes []*ProfileNode `json:"nodes"` // The list of profile nodes. First item is the root node. Nodes []*ProfileNode `json:"nodes"` // The list of profile nodes. First item is the root node.
StartTime float64 `json:"startTime"` // Profiling start timestamp in microseconds. StartTime float64 `json:"startTime"` // Profiling start timestamp in microseconds.

View File

@ -30,7 +30,7 @@ type EventExceptionThrown struct {
// EventExceptionRevoked issued when unhandled exception was revoked. // EventExceptionRevoked issued when unhandled exception was revoked.
type EventExceptionRevoked struct { type EventExceptionRevoked struct {
Reason string `json:"reason"` // Reason describing why exception was revoked. Reason string `json:"reason"` // Reason describing why exception was revoked.
ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionUnhandled. ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionThrown.
} }
// EventConsoleAPICalled issued when console API was called. // EventConsoleAPICalled issued when console API was called.

View File

@ -154,7 +154,7 @@ type CallArgument struct {
ObjectID RemoteObjectID `json:"objectId,omitempty"` // Remote object handle. ObjectID RemoteObjectID `json:"objectId,omitempty"` // Remote object handle.
} }
// ExecutionContextID id of an execution context. // ExecutionContextID ID of an execution context.
type ExecutionContextID int64 type ExecutionContextID int64
// Int64 returns the ExecutionContextID as int64 value. // Int64 returns the ExecutionContextID as int64 value.

View File

@ -3001,7 +3001,7 @@
}, },
{ {
"name": "status", "name": "status",
"type": "number", "type": "integer",
"description": "HTTP response status code." "description": "HTTP response status code."
}, },
{ {
@ -3125,7 +3125,7 @@
"properties": [ "properties": [
{ {
"name": "status", "name": "status",
"type": "number", "type": "integer",
"description": "HTTP response status code." "description": "HTTP response status code."
}, },
{ {
@ -6183,7 +6183,7 @@
"description": "Ids of the search result nodes." "description": "Ids of the search result nodes."
} }
], ],
"description": "Returns search results from given <code>fromIndex</code> to given <code>toIndex</code> from the sarch with the given identifier.", "description": "Returns search results from given <code>fromIndex</code> to given <code>toIndex</code> from the search with the given identifier.",
"experimental": true "experimental": true
}, },
{ {
@ -12801,7 +12801,7 @@
{ {
"name": "exceptionId", "name": "exceptionId",
"type": "integer", "type": "integer",
"description": "The id of revoked exception, as reported in <code>exceptionUnhandled</code>." "description": "The id of revoked exception, as reported in <code>exceptionThrown</code>."
} }
] ]
}, },

View File

@ -4,8 +4,10 @@ package templates
import ( import (
"strings" "strings"
"unicode"
"github.com/knq/chromedp/cmd/chromedp-gen/internal" "github.com/knq/chromedp/cmd/chromedp-gen/internal"
"github.com/knq/snaker"
) )
const ( const (
@ -13,14 +15,34 @@ const (
commentPrefix = `// ` commentPrefix = `// `
) )
var toUpper = map[string]bool{
"DOM": true,
"X": true,
"Y": true,
}
var keep = map[string]bool{
"JavaScript": true,
}
// formatComment formats a comment. // formatComment formats a comment.
func formatComment(s, chop, newstr string) string { func formatComment(s, chop, newstr string) string {
s = strings.TrimPrefix(s, chop) s = strings.TrimPrefix(s, chop)
s = internal.CodeRE.ReplaceAllString(s, "") s = strings.TrimSpace(internal.CodeRE.ReplaceAllString(s, ""))
l := len(s) l := len(s)
if newstr != "" && l > 0 { if newstr != "" && l > 0 {
s = strings.ToLower(s[:1]) + s[1:] if i := strings.IndexFunc(s, unicode.IsSpace); i != -1 {
firstWord, remaining := s[:i], s[i:]
if snaker.IsInitialism(firstWord) || toUpper[firstWord] {
s = strings.ToUpper(firstWord)
} else if keep[firstWord] {
s = firstWord
} else {
s = strings.ToLower(firstWord[:1]) + firstWord[1:]
}
s += remaining
}
} }
s = newstr + strings.TrimSuffix(s, ".") s = newstr + strings.TrimSuffix(s, ".")
if l < 1 { if l < 1 {