Fixing issue with nodeType named object parameters in chromedp-gen, and updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-06-18 07:55:45 +07:00
parent 57160a279e
commit a7d69aad1f
20 changed files with 2444 additions and 1046 deletions

View File

@ -568,6 +568,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer
out.Request = string(in.String()) out.Request = string(in.String())
case "response": case "response":
out.Response = string(in.String()) out.Response = string(in.String())
case "responseTime":
out.ResponseTime = float64(in.Float64())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -598,6 +600,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Wri
out.RawString("\"response\":") out.RawString("\"response\":")
out.String(string(in.Response)) out.String(string(in.Response))
} }
if in.ResponseTime != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"responseTime\":")
out.Float64(float64(in.ResponseTime))
}
out.RawByte('}') out.RawByte('}')
} }

View File

@ -12,8 +12,9 @@ func (t CacheID) String() string {
// DataEntry data entry. // DataEntry data entry.
type DataEntry struct { type DataEntry struct {
Request string `json:"request,omitempty"` // Request url spec. Request string `json:"request,omitempty"` // Request url spec.
Response string `json:"response,omitempty"` // Response stataus text. Response string `json:"response,omitempty"` // Response status text.
ResponseTime float64 `json:"responseTime,omitempty"` // Number of seconds since epoch.
} }
// Cache cache identifier. // Cache cache identifier.

View File

@ -285,10 +285,10 @@ const (
CommandCSSGetMediaQueries MethodType = "CSS.getMediaQueries" CommandCSSGetMediaQueries MethodType = "CSS.getMediaQueries"
CommandCSSSetEffectivePropertyValueForNode MethodType = "CSS.setEffectivePropertyValueForNode" CommandCSSSetEffectivePropertyValueForNode MethodType = "CSS.setEffectivePropertyValueForNode"
CommandCSSGetBackgroundColors MethodType = "CSS.getBackgroundColors" CommandCSSGetBackgroundColors MethodType = "CSS.getBackgroundColors"
CommandCSSGetLayoutTreeAndStyles MethodType = "CSS.getLayoutTreeAndStyles"
CommandCSSStartRuleUsageTracking MethodType = "CSS.startRuleUsageTracking" CommandCSSStartRuleUsageTracking MethodType = "CSS.startRuleUsageTracking"
CommandCSSTakeCoverageDelta MethodType = "CSS.takeCoverageDelta" CommandCSSTakeCoverageDelta MethodType = "CSS.takeCoverageDelta"
CommandCSSStopRuleUsageTracking MethodType = "CSS.stopRuleUsageTracking" CommandCSSStopRuleUsageTracking MethodType = "CSS.stopRuleUsageTracking"
CommandDOMSnapshotGetSnapshot MethodType = "DOMSnapshot.getSnapshot"
CommandIORead MethodType = "IO.read" CommandIORead MethodType = "IO.read"
CommandIOClose MethodType = "IO.close" CommandIOClose MethodType = "IO.close"
CommandDOMDebuggerSetDOMBreakpoint MethodType = "DOMDebugger.setDOMBreakpoint" CommandDOMDebuggerSetDOMBreakpoint MethodType = "DOMDebugger.setDOMBreakpoint"
@ -377,6 +377,7 @@ const (
CommandAnimationResolveAnimation MethodType = "Animation.resolveAnimation" CommandAnimationResolveAnimation MethodType = "Animation.resolveAnimation"
CommandAccessibilityGetPartialAXTree MethodType = "Accessibility.getPartialAXTree" CommandAccessibilityGetPartialAXTree MethodType = "Accessibility.getPartialAXTree"
CommandStorageClearDataForOrigin MethodType = "Storage.clearDataForOrigin" CommandStorageClearDataForOrigin MethodType = "Storage.clearDataForOrigin"
CommandStorageGetUsageAndQuota MethodType = "Storage.getUsageAndQuota"
EventLogEntryAdded MethodType = "Log.entryAdded" EventLogEntryAdded MethodType = "Log.entryAdded"
CommandLogEnable MethodType = "Log.enable" CommandLogEnable MethodType = "Log.enable"
CommandLogDisable MethodType = "Log.disable" CommandLogDisable MethodType = "Log.disable"
@ -955,14 +956,14 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandCSSSetEffectivePropertyValueForNode *t = CommandCSSSetEffectivePropertyValueForNode
case CommandCSSGetBackgroundColors: case CommandCSSGetBackgroundColors:
*t = CommandCSSGetBackgroundColors *t = CommandCSSGetBackgroundColors
case CommandCSSGetLayoutTreeAndStyles:
*t = CommandCSSGetLayoutTreeAndStyles
case CommandCSSStartRuleUsageTracking: case CommandCSSStartRuleUsageTracking:
*t = CommandCSSStartRuleUsageTracking *t = CommandCSSStartRuleUsageTracking
case CommandCSSTakeCoverageDelta: case CommandCSSTakeCoverageDelta:
*t = CommandCSSTakeCoverageDelta *t = CommandCSSTakeCoverageDelta
case CommandCSSStopRuleUsageTracking: case CommandCSSStopRuleUsageTracking:
*t = CommandCSSStopRuleUsageTracking *t = CommandCSSStopRuleUsageTracking
case CommandDOMSnapshotGetSnapshot:
*t = CommandDOMSnapshotGetSnapshot
case CommandIORead: case CommandIORead:
*t = CommandIORead *t = CommandIORead
case CommandIOClose: case CommandIOClose:
@ -1139,6 +1140,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandAccessibilityGetPartialAXTree *t = CommandAccessibilityGetPartialAXTree
case CommandStorageClearDataForOrigin: case CommandStorageClearDataForOrigin:
*t = CommandStorageClearDataForOrigin *t = CommandStorageClearDataForOrigin
case CommandStorageGetUsageAndQuota:
*t = CommandStorageGetUsageAndQuota
case EventLogEntryAdded: case EventLogEntryAdded:
*t = EventLogEntryAdded *t = EventLogEntryAdded
case CommandLogEnable: case CommandLogEnable:

View File

@ -16,6 +16,7 @@ import (
"github.com/knq/chromedp/cdp/debugger" "github.com/knq/chromedp/cdp/debugger"
"github.com/knq/chromedp/cdp/dom" "github.com/knq/chromedp/cdp/dom"
"github.com/knq/chromedp/cdp/domdebugger" "github.com/knq/chromedp/cdp/domdebugger"
"github.com/knq/chromedp/cdp/domsnapshot"
"github.com/knq/chromedp/cdp/domstorage" "github.com/knq/chromedp/cdp/domstorage"
"github.com/knq/chromedp/cdp/emulation" "github.com/knq/chromedp/cdp/emulation"
"github.com/knq/chromedp/cdp/heapprofiler" "github.com/knq/chromedp/cdp/heapprofiler"
@ -33,6 +34,7 @@ import (
"github.com/knq/chromedp/cdp/schema" "github.com/knq/chromedp/cdp/schema"
"github.com/knq/chromedp/cdp/security" "github.com/knq/chromedp/cdp/security"
"github.com/knq/chromedp/cdp/serviceworker" "github.com/knq/chromedp/cdp/serviceworker"
"github.com/knq/chromedp/cdp/storage"
"github.com/knq/chromedp/cdp/systeminfo" "github.com/knq/chromedp/cdp/systeminfo"
"github.com/knq/chromedp/cdp/target" "github.com/knq/chromedp/cdp/target"
"github.com/knq/chromedp/cdp/tethering" "github.com/knq/chromedp/cdp/tethering"
@ -741,9 +743,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandCSSGetBackgroundColors: case cdp.CommandCSSGetBackgroundColors:
v = new(css.GetBackgroundColorsReturns) v = new(css.GetBackgroundColorsReturns)
case cdp.CommandCSSGetLayoutTreeAndStyles:
v = new(css.GetLayoutTreeAndStylesReturns)
case cdp.CommandCSSStartRuleUsageTracking: case cdp.CommandCSSStartRuleUsageTracking:
return emptyVal, nil return emptyVal, nil
@ -768,6 +767,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventCSSStyleSheetRemoved: case cdp.EventCSSStyleSheetRemoved:
v = new(css.EventStyleSheetRemoved) v = new(css.EventStyleSheetRemoved)
case cdp.CommandDOMSnapshotGetSnapshot:
v = new(domsnapshot.GetSnapshotReturns)
case cdp.CommandIORead: case cdp.CommandIORead:
v = new(iodom.ReadReturns) v = new(iodom.ReadReturns)
@ -1032,6 +1034,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandStorageClearDataForOrigin: case cdp.CommandStorageClearDataForOrigin:
return emptyVal, nil return emptyVal, nil
case cdp.CommandStorageGetUsageAndQuota:
v = new(storage.GetUsageAndQuotaReturns)
case cdp.CommandLogEnable: case cdp.CommandLogEnable:
return emptyVal, nil return emptyVal, nil

View File

@ -700,50 +700,6 @@ func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.Handler) (bac
return res.BackgroundColors, nil return res.BackgroundColors, nil
} }
// GetLayoutTreeAndStylesParams for the main document and any content
// documents, return the LayoutTreeNodes and a whitelisted subset of the
// computed style. It only returns pushed nodes, on way to pull all nodes is to
// call DOM.getDocument with a depth of -1.
type GetLayoutTreeAndStylesParams struct {
ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return.
}
// GetLayoutTreeAndStyles for the main document and any content documents,
// return the LayoutTreeNodes and a whitelisted subset of the computed style. It
// only returns pushed nodes, on way to pull all nodes is to call
// DOM.getDocument with a depth of -1.
//
// parameters:
// computedStyleWhitelist - Whitelist of computed styles to return.
func GetLayoutTreeAndStyles(computedStyleWhitelist []string) *GetLayoutTreeAndStylesParams {
return &GetLayoutTreeAndStylesParams{
ComputedStyleWhitelist: computedStyleWhitelist,
}
}
// GetLayoutTreeAndStylesReturns return values.
type GetLayoutTreeAndStylesReturns struct {
LayoutTreeNodes []*LayoutTreeNode `json:"layoutTreeNodes,omitempty"`
ComputedStyles []*ComputedStyle `json:"computedStyles,omitempty"`
}
// Do executes CSS.getLayoutTreeAndStyles against the provided context and
// target handler.
//
// returns:
// layoutTreeNodes
// computedStyles
func (p *GetLayoutTreeAndStylesParams) Do(ctxt context.Context, h cdp.Handler) (layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error) {
// execute
var res GetLayoutTreeAndStylesReturns
err = h.Execute(ctxt, cdp.CommandCSSGetLayoutTreeAndStyles, p, &res)
if err != nil {
return nil, nil, err
}
return res.LayoutTreeNodes, res.ComputedStyles, nil
}
// StartRuleUsageTrackingParams enables the selector recording. // StartRuleUsageTrackingParams enables the selector recording.
type StartRuleUsageTrackingParams struct{} type StartRuleUsageTrackingParams struct{}

File diff suppressed because it is too large Load Diff

View File

@ -241,21 +241,6 @@ type InlineTextBox struct {
NumCharacters int64 `json:"numCharacters,omitempty"` // The number of characters in this post layout textbox substring. NumCharacters int64 `json:"numCharacters,omitempty"` // The number of characters in this post layout textbox substring.
} }
// LayoutTreeNode details of an element in the DOM tree with a LayoutObject.
type LayoutTreeNode struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // The id of the related DOM node matching one from DOM.GetDocument.
BoundingBox *dom.Rect `json:"boundingBox,omitempty"` // The absolute position bounding box.
LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText if any
InlineTextNodes []*InlineTextBox `json:"inlineTextNodes,omitempty"` // The post layout inline text nodes, if any.
StyleIndex int64 `json:"styleIndex,omitempty"` // Index into the computedStyles array returned by getLayoutTreeAndStyles.
}
// ComputedStyle a subset of the full ComputedStyle as defined by the request
// whitelist.
type ComputedStyle struct {
Properties []*ComputedProperty `json:"properties,omitempty"`
}
// MediaSource source of the media query: "mediaRule" if specified by a // MediaSource source of the media query: "mediaRule" if specified by a
// @media rule, "importRule" if specified by an @import rule, "linkedSheet" if // @media rule, "importRule" if specified by an @import rule, "linkedSheet" if
// specified by a "media" attribute in a linked stylesheet's LINK tag, // specified by a "media" attribute in a linked stylesheet's LINK tag,

View File

@ -0,0 +1,64 @@
// Package domsnapshot provides the Chrome Debugging Protocol
// commands, types, and events for the DOMSnapshot domain.
//
// This domain facilitates obtaining document snapshots with DOM, layout, and
// style information.
//
// Generated by the chromedp-gen command.
package domsnapshot
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetSnapshotParams returns a document snapshot, including the full DOM tree
// of the root node (including iframes, template contents, and imported
// 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
// flattened. .
type GetSnapshotParams struct {
ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return.
}
// GetSnapshot returns a document snapshot, including the full DOM tree of
// the root node (including iframes, template contents, and imported 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 flattened.
// .
//
// parameters:
// computedStyleWhitelist - Whitelist of computed styles to return.
func GetSnapshot(computedStyleWhitelist []string) *GetSnapshotParams {
return &GetSnapshotParams{
ComputedStyleWhitelist: computedStyleWhitelist,
}
}
// GetSnapshotReturns return values.
type GetSnapshotReturns struct {
DomNodes []*DOMNode `json:"domNodes,omitempty"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
LayoutTreeNodes []*LayoutTreeNode `json:"layoutTreeNodes,omitempty"` // The nodes in the layout tree.
ComputedStyles []*ComputedStyle `json:"computedStyles,omitempty"` // Whitelisted ComputedStyle properties for each node in the layout tree.
}
// Do executes DOMSnapshot.getSnapshot against the provided context and
// target handler.
//
// returns:
// domNodes - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
// layoutTreeNodes - The nodes in the layout tree.
// computedStyles - Whitelisted ComputedStyle properties for each node in the layout tree.
func (p *GetSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (domNodes []*DOMNode, layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error) {
// execute
var res GetSnapshotReturns
err = h.Execute(ctxt, cdp.CommandDOMSnapshotGetSnapshot, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.DomNodes, res.LayoutTreeNodes, res.ComputedStyles, nil
}

1035
cdp/domsnapshot/easyjson.go Normal file

File diff suppressed because it is too large Load Diff

51
cdp/domsnapshot/types.go Normal file
View File

@ -0,0 +1,51 @@
package domsnapshot
// AUTOGENERATED. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/css"
"github.com/knq/chromedp/cdp/dom"
)
// 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.
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.
LayoutNodeIndex int64 `json:"layoutNodeIndex,omitempty"` // The index of the node's related layout tree node in the layoutTreeNodes array returned by getSnapshot, if any.
DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to.
BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion.
PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements.
ContentDocumentIndex int64 `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any.
ImportedDocumentIndex int64 `json:"importedDocumentIndex,omitempty"` // Index of the imported document's node of a link element in the domNodes array returned by getSnapshot, if any.
TemplateContentIndex int64 `json:"templateContentIndex,omitempty"` // Index of the content node of a template element in the domNodes array returned by getSnapshot.
PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Type of a pseudo element node.
}
// 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.
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.
}
// 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.
}
// NameValue a name/value pair.
type NameValue struct {
Name string `json:"name,omitempty"` // Attribute/property name.
Value string `json:"value,omitempty"` // Attribute/property value.
}

View File

@ -4183,7 +4183,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork38(in *jlexer.Lexer, ou
continue continue
} }
switch key { switch key {
case "InterceptionId": case "interceptionId":
out.InterceptionID = InterceptionID(in.String()) out.InterceptionID = InterceptionID(in.String())
case "request": case "request":
if in.IsNull() { if in.IsNull() {
@ -4195,6 +4195,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork38(in *jlexer.Lexer, ou
} }
(*out.Request).UnmarshalEasyJSON(in) (*out.Request).UnmarshalEasyJSON(in)
} }
case "resourceType":
(out.ResourceType).UnmarshalEasyJSON(in)
case "redirectHeaders": case "redirectHeaders":
if in.IsNull() { if in.IsNull() {
in.Skip() in.Skip()
@ -4209,6 +4211,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork38(in *jlexer.Lexer, ou
out.RedirectStatusCode = int64(in.Int64()) out.RedirectStatusCode = int64(in.Int64())
case "redirectUrl": case "redirectUrl":
out.RedirectURL = string(in.String()) out.RedirectURL = string(in.String())
case "authChallenge":
if in.IsNull() {
in.Skip()
out.AuthChallenge = nil
} else {
if out.AuthChallenge == nil {
out.AuthChallenge = new(AuthChallenge)
}
(*out.AuthChallenge).UnmarshalEasyJSON(in)
}
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -4228,7 +4240,7 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer,
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"InterceptionId\":") out.RawString("\"interceptionId\":")
out.String(string(in.InterceptionID)) out.String(string(in.InterceptionID))
} }
if in.Request != nil { if in.Request != nil {
@ -4243,6 +4255,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer,
(*in.Request).MarshalEasyJSON(out) (*in.Request).MarshalEasyJSON(out)
} }
} }
if in.ResourceType != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"resourceType\":")
(in.ResourceType).MarshalEasyJSON(out)
}
if in.RedirectHeaders != nil { if in.RedirectHeaders != nil {
if !first { if !first {
out.RawByte(',') out.RawByte(',')
@ -4271,6 +4291,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer,
out.RawString("\"redirectUrl\":") out.RawString("\"redirectUrl\":")
out.String(string(in.RedirectURL)) out.String(string(in.RedirectURL))
} }
if in.AuthChallenge != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"authChallenge\":")
if in.AuthChallenge == nil {
out.RawString("null")
} else {
(*in.AuthChallenge).MarshalEasyJSON(out)
}
}
out.RawByte('}') out.RawByte('}')
} }
@ -5294,6 +5326,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork49(in *jlexer.Lexer, ou
} }
(*out.Headers).UnmarshalEasyJSON(in) (*out.Headers).UnmarshalEasyJSON(in)
} }
case "authChallengeResponse":
if in.IsNull() {
in.Skip()
out.AuthChallengeResponse = nil
} else {
if out.AuthChallengeResponse == nil {
out.AuthChallengeResponse = new(AuthChallengeResponse)
}
(*out.AuthChallengeResponse).UnmarshalEasyJSON(in)
}
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -5366,6 +5408,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork49(out *jwriter.Writer,
(*in.Headers).MarshalEasyJSON(out) (*in.Headers).MarshalEasyJSON(out)
} }
} }
if in.AuthChallengeResponse != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"authChallengeResponse\":")
if in.AuthChallengeResponse == nil {
out.RawString("null")
} else {
(*in.AuthChallengeResponse).MarshalEasyJSON(out)
}
}
out.RawByte('}') out.RawByte('}')
} }
@ -6005,3 +6059,191 @@ func (v *CachedResource) UnmarshalJSON(data []byte) error {
func (v *CachedResource) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CachedResource) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork58(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork58(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork59(in *jlexer.Lexer, out *AuthChallengeResponse) {
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 "response":
(out.Response).UnmarshalEasyJSON(in)
case "username":
out.Username = string(in.String())
case "password":
out.Password = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork59(out *jwriter.Writer, in AuthChallengeResponse) {
out.RawByte('{')
first := true
_ = first
if in.Response != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"response\":")
(in.Response).MarshalEasyJSON(out)
}
if in.Username != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"username\":")
out.String(string(in.Username))
}
if in.Password != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"password\":")
out.String(string(in.Password))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v AuthChallengeResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork59(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v AuthChallengeResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork59(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *AuthChallengeResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork59(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AuthChallengeResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork59(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork60(in *jlexer.Lexer, out *AuthChallenge) {
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 "source":
(out.Source).UnmarshalEasyJSON(in)
case "origin":
out.Origin = string(in.String())
case "scheme":
out.Scheme = string(in.String())
case "realm":
out.Realm = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork60(out *jwriter.Writer, in AuthChallenge) {
out.RawByte('{')
first := true
_ = first
if in.Source != "" {
if !first {
out.RawByte(',')
}
first = false
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 in.Scheme != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"scheme\":")
out.String(string(in.Scheme))
}
if in.Realm != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"realm\":")
out.String(string(in.Realm))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v AuthChallenge) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork60(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v AuthChallenge) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork60(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *AuthChallenge) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork60(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AuthChallenge) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork60(l, v)
}

View File

@ -133,11 +133,13 @@ type EventEventSourceMessageReceived struct {
// EventRequestIntercepted details of an intercepted HTTP request, which must // EventRequestIntercepted details of an intercepted HTTP request, which must
// be either allowed, blocked, modified or mocked. // be either allowed, blocked, modified or mocked.
type EventRequestIntercepted struct { 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. 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"` Request *Request `json:"request,omitempty"`
RedirectHeaders *Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted. ResourceType page.ResourceType `json:"resourceType,omitempty"` // How the requested resource will be used.
RedirectStatusCode int64 `json:"redirectStatusCode,omitempty"` // HTTP response code, only sent if a redirect was intercepted. RedirectHeaders *Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted.
RedirectURL string `json:"redirectUrl,omitempty"` // Redirect location, 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.
AuthChallenge *AuthChallenge `json:"authChallenge,omitempty"` // Details of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse.
} }
// EventTypes all event types in the domain. // EventTypes all event types in the domain.

View File

@ -683,13 +683,14 @@ func (p *EnableRequestInterceptionParams) Do(ctxt context.Context, h cdp.Handler
// fetch occurs as a result which encounters a redirect an additional // fetch occurs as a result which encounters a redirect an additional
// Network.requestIntercepted event will be sent with the same InterceptionId. // Network.requestIntercepted event will be sent with the same InterceptionId.
type ContinueInterceptedRequestParams struct { type ContinueInterceptedRequestParams struct {
InterceptionID InterceptionID `json:"interceptionId"` InterceptionID InterceptionID `json:"interceptionId"`
ErrorReason ErrorReason `json:"errorReason,omitempty"` // If set this causes the request to fail with the given reason. ErrorReason ErrorReason `json:"errorReason,omitempty"` // If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge.
RawResponse string `json:"rawResponse,omitempty"` // If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... RawResponse string `json:"rawResponse,omitempty"` // If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge.
URL string `json:"url,omitempty"` // If set the request url will be modified in a way that's not observable by page. URL string `json:"url,omitempty"` // If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge.
Method string `json:"method,omitempty"` // If set this allows the request method to be overridden. Method string `json:"method,omitempty"` // If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
PostData string `json:"postData,omitempty"` // If set this allows postData to be set. PostData string `json:"postData,omitempty"` // If set this allows postData to be set. Must not be set in response to an authChallenge.
Headers *Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed. Headers *Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse,omitempty"` // Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
} }
// ContinueInterceptedRequest response to Network.requestIntercepted which // ContinueInterceptedRequest response to Network.requestIntercepted which
@ -707,7 +708,7 @@ func ContinueInterceptedRequest(interceptionID InterceptionID) *ContinueIntercep
} }
// WithErrorReason if set this causes the request to fail with the given // WithErrorReason if set this causes the request to fail with the given
// reason. // reason. Must not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReason) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReason) *ContinueInterceptedRequestParams {
p.ErrorReason = errorReason p.ErrorReason = errorReason
return &p return &p
@ -715,36 +716,47 @@ func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReaso
// WithRawResponse if set the requests completes using with the provided // WithRawResponse if set the requests completes using with the provided
// base64 encoded raw response, including HTTP status line and headers etc... // base64 encoded raw response, including HTTP status line and headers etc...
// Must not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithRawResponse(rawResponse string) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithRawResponse(rawResponse string) *ContinueInterceptedRequestParams {
p.RawResponse = rawResponse p.RawResponse = rawResponse
return &p return &p
} }
// WithURL if set the request url will be modified in a way that's not // WithURL if set the request url will be modified in a way that's not
// observable by page. // observable by page. Must not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithURL(url string) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithURL(url string) *ContinueInterceptedRequestParams {
p.URL = url p.URL = url
return &p return &p
} }
// WithMethod if set this allows the request method to be overridden. // WithMethod if set this allows the request method to be overridden. Must
// not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithMethod(method string) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithMethod(method string) *ContinueInterceptedRequestParams {
p.Method = method p.Method = method
return &p return &p
} }
// WithPostData if set this allows postData to be set. // WithPostData if set this allows postData to be set. Must not be set in
// response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithPostData(postData string) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithPostData(postData string) *ContinueInterceptedRequestParams {
p.PostData = postData p.PostData = postData
return &p return &p
} }
// WithHeaders if set this allows the request headers to be changed. // WithHeaders if set this allows the request headers to be changed. Must not
// be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithHeaders(headers *Headers) *ContinueInterceptedRequestParams { func (p ContinueInterceptedRequestParams) WithHeaders(headers *Headers) *ContinueInterceptedRequestParams {
p.Headers = headers p.Headers = headers
return &p return &p
} }
// WithAuthChallengeResponse response to a requestIntercepted with an
// authChallenge. Must not be set otherwise.
func (p ContinueInterceptedRequestParams) WithAuthChallengeResponse(authChallengeResponse *AuthChallengeResponse) *ContinueInterceptedRequestParams {
p.AuthChallengeResponse = authChallengeResponse
return &p
}
// Do executes Network.continueInterceptedRequest against the provided context and // Do executes Network.continueInterceptedRequest against the provided context and
// target handler. // target handler.
func (p *ContinueInterceptedRequestParams) Do(ctxt context.Context, h cdp.Handler) (err error) { func (p *ContinueInterceptedRequestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {

View File

@ -452,6 +452,21 @@ type Cookie struct {
SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type. 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.
}
// 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.
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.
}
// MixedContentType the mixed content status of the request, as defined in // MixedContentType the mixed content status of the request, as defined in
// http://www.w3.org/TR/mixed-content/. // http://www.w3.org/TR/mixed-content/.
type MixedContentType string type MixedContentType string
@ -509,12 +524,14 @@ func (t ReferrerPolicy) String() string {
// ReferrerPolicy values. // ReferrerPolicy values.
const ( const (
ReferrerPolicyUnsafeURL ReferrerPolicy = "unsafe-url" ReferrerPolicyUnsafeURL ReferrerPolicy = "unsafe-url"
ReferrerPolicyNoReferrerWhenDowngrade ReferrerPolicy = "no-referrer-when-downgrade" ReferrerPolicyNoReferrerWhenDowngrade ReferrerPolicy = "no-referrer-when-downgrade"
ReferrerPolicyNoReferrer ReferrerPolicy = "no-referrer" ReferrerPolicyNoReferrer ReferrerPolicy = "no-referrer"
ReferrerPolicyOrigin ReferrerPolicy = "origin" ReferrerPolicyOrigin ReferrerPolicy = "origin"
ReferrerPolicyOriginWhenCrossOrigin ReferrerPolicy = "origin-when-cross-origin" ReferrerPolicyOriginWhenCrossOrigin ReferrerPolicy = "origin-when-cross-origin"
ReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin ReferrerPolicy = "no-referrer-when-downgrade-origin-when-cross-origin" ReferrerPolicySameOrigin ReferrerPolicy = "same-origin"
ReferrerPolicyStrictOrigin ReferrerPolicy = "strict-origin"
ReferrerPolicyStrictOriginWhenCrossOrigin ReferrerPolicy = "strict-origin-when-cross-origin"
) )
// MarshalEasyJSON satisfies easyjson.Marshaler. // MarshalEasyJSON satisfies easyjson.Marshaler.
@ -540,8 +557,12 @@ func (t *ReferrerPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = ReferrerPolicyOrigin *t = ReferrerPolicyOrigin
case ReferrerPolicyOriginWhenCrossOrigin: case ReferrerPolicyOriginWhenCrossOrigin:
*t = ReferrerPolicyOriginWhenCrossOrigin *t = ReferrerPolicyOriginWhenCrossOrigin
case ReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin: case ReferrerPolicySameOrigin:
*t = ReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin *t = ReferrerPolicySameOrigin
case ReferrerPolicyStrictOrigin:
*t = ReferrerPolicyStrictOrigin
case ReferrerPolicyStrictOriginWhenCrossOrigin:
*t = ReferrerPolicyStrictOriginWhenCrossOrigin
default: default:
in.AddError(errors.New("unknown ReferrerPolicy value")) in.AddError(errors.New("unknown ReferrerPolicy value"))
@ -600,3 +621,93 @@ func (t *InitiatorType) UnmarshalEasyJSON(in *jlexer.Lexer) {
func (t *InitiatorType) UnmarshalJSON(buf []byte) error { func (t *InitiatorType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t) return easyjson.Unmarshal(buf, t)
} }
// AuthChallengeSource source of the authentication challenge.
type AuthChallengeSource string
// String returns the AuthChallengeSource as string value.
func (t AuthChallengeSource) String() string {
return string(t)
}
// AuthChallengeSource values.
const (
AuthChallengeSourceServer AuthChallengeSource = "Server"
AuthChallengeSourceProxy AuthChallengeSource = "Proxy"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeSource) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeSource) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeSource(in.String()) {
case AuthChallengeSourceServer:
*t = AuthChallengeSourceServer
case AuthChallengeSourceProxy:
*t = AuthChallengeSourceProxy
default:
in.AddError(errors.New("unknown AuthChallengeSource value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AuthChallengeResponseResponse 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.
type AuthChallengeResponseResponse string
// String returns the AuthChallengeResponseResponse as string value.
func (t AuthChallengeResponseResponse) String() string {
return string(t)
}
// AuthChallengeResponseResponse values.
const (
AuthChallengeResponseResponseDefault AuthChallengeResponseResponse = "Default"
AuthChallengeResponseResponseCancelAuth AuthChallengeResponseResponse = "CancelAuth"
AuthChallengeResponseResponseProvideCredentials AuthChallengeResponseResponse = "ProvideCredentials"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeResponseResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeResponseResponse) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeResponseResponse(in.String()) {
case AuthChallengeResponseResponseDefault:
*t = AuthChallengeResponseResponseDefault
case AuthChallengeResponseResponseCancelAuth:
*t = AuthChallengeResponseResponseCancelAuth
case AuthChallengeResponseResponseProvideCredentials:
*t = AuthChallengeResponseResponseProvideCredentials
default:
in.AddError(errors.New("unknown AuthChallengeResponseResponse value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -2577,6 +2577,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime22(in *jlexer.Lexer, ou
} }
(*out.StackTrace).UnmarshalEasyJSON(in) (*out.StackTrace).UnmarshalEasyJSON(in)
} }
case "context":
out.Context = string(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -2650,6 +2652,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime22(out *jwriter.Writer,
(*in.StackTrace).MarshalEasyJSON(out) (*in.StackTrace).MarshalEasyJSON(out)
} }
} }
if in.Context != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"context\":")
out.String(string(in.Context))
}
out.RawByte('}') out.RawByte('}')
} }

View File

@ -40,6 +40,7 @@ type EventConsoleAPICalled struct {
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where the call was made. ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where the call was made.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Call timestamp. Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Call timestamp.
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made. 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, // EventInspectRequested issued when object should be inspected (for example,

View File

@ -17,7 +17,153 @@ var (
_ easyjson.Marshaler _ easyjson.Marshaler
) )
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(in *jlexer.Lexer, out *ClearDataForOriginParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(in *jlexer.Lexer, out *GetUsageAndQuotaReturns) {
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 "usage":
out.Usage = float64(in.Float64())
case "quota":
out.Quota = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(out *jwriter.Writer, in GetUsageAndQuotaReturns) {
out.RawByte('{')
first := true
_ = first
if in.Usage != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"usage\":")
out.Float64(float64(in.Usage))
}
if in.Quota != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"quota\":")
out.Float64(float64(in.Quota))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetUsageAndQuotaReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetUsageAndQuotaReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetUsageAndQuotaReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetUsageAndQuotaReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(in *jlexer.Lexer, out *GetUsageAndQuotaParams) {
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 "origin":
out.Origin = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(out *jwriter.Writer, in GetUsageAndQuotaParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"origin\":")
out.String(string(in.Origin))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetUsageAndQuotaParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetUsageAndQuotaParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetUsageAndQuotaParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetUsageAndQuotaParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(in *jlexer.Lexer, out *ClearDataForOriginParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -50,7 +196,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(in *jlexer.Lexer, out
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(out *jwriter.Writer, in ClearDataForOriginParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(out *jwriter.Writer, in ClearDataForOriginParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -72,23 +218,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(out *jwriter.Writer, i
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ClearDataForOriginParams) MarshalJSON() ([]byte, error) { func (v ClearDataForOriginParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDataForOriginParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ClearDataForOriginParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalJSON(data []byte) error { func (v *ClearDataForOriginParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ClearDataForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(l, v)
} }

View File

@ -35,3 +35,41 @@ func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginP
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) { func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, p, nil) return h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, p, nil)
} }
// GetUsageAndQuotaParams returns usage and quota in bytes.
type GetUsageAndQuotaParams struct {
Origin string `json:"origin"` // Security origin.
}
// GetUsageAndQuota returns usage and quota in bytes.
//
// parameters:
// origin - Security origin.
func GetUsageAndQuota(origin string) *GetUsageAndQuotaParams {
return &GetUsageAndQuotaParams{
Origin: origin,
}
}
// GetUsageAndQuotaReturns return values.
type GetUsageAndQuotaReturns struct {
Usage float64 `json:"usage,omitempty"` // Storage usage (bytes).
Quota float64 `json:"quota,omitempty"` // Storage quota (bytes).
}
// Do executes Storage.getUsageAndQuota against the provided context and
// target handler.
//
// returns:
// usage - Storage usage (bytes).
// quota - Storage quota (bytes).
func (p *GetUsageAndQuotaParams) Do(ctxt context.Context, h cdp.Handler) (usage float64, quota float64, err error) {
// execute
var res GetUsageAndQuotaReturns
err = h.Execute(ctxt, cdp.CommandStorageGetUsageAndQuota, p, &res)
if err != nil {
return 0, 0, err
}
return res.Usage, res.Quota, nil
}

View File

@ -450,7 +450,7 @@ func convertObjectProperties(params []*internal.Type, d *internal.Domain, name s
case p.Name == "nodeType": case p.Name == "nodeType":
r = append(r, &internal.Type{ r = append(r, &internal.Type{
Name: p.Name, Name: p.Name,
Ref: "NodeType", Ref: "DOM.NodeType",
Description: p.Description, Description: p.Description,
Optional: p.Optional, Optional: p.Optional,
}) })

View File

@ -2556,7 +2556,9 @@
"no-referrer", "no-referrer",
"origin", "origin",
"origin-when-cross-origin", "origin-when-cross-origin",
"no-referrer-when-downgrade-origin-when-cross-origin" "same-origin",
"strict-origin",
"strict-origin-when-cross-origin"
], ],
"description": "The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/" "description": "The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/"
}, },
@ -3018,6 +3020,69 @@
} }
], ],
"experimental": true "experimental": true
},
{
"id": "AuthChallenge",
"type": "object",
"description": "Authorization challenge for HTTP status code 401 or 407.",
"properties": [
{
"name": "source",
"type": "string",
"optional": true,
"enum": [
"Server",
"Proxy"
],
"description": "Source of the authentication challenge."
},
{
"name": "origin",
"type": "string",
"description": "Origin of the challenger."
},
{
"name": "scheme",
"type": "string",
"description": "The authentication scheme used, such as basic or digest"
},
{
"name": "realm",
"type": "string",
"description": "The realm of the challenge. May be empty."
}
],
"experimental": true
},
{
"id": "AuthChallengeResponse",
"type": "object",
"description": "Response to an AuthChallenge.",
"properties": [
{
"name": "response",
"type": "string",
"enum": [
"Default",
"CancelAuth",
"ProvideCredentials"
],
"description": "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."
},
{
"name": "username",
"type": "string",
"optional": true,
"description": "The username to provide, possibly empty. Should only be set if response is ProvideCredentials."
},
{
"name": "password",
"type": "string",
"optional": true,
"description": "The password to provide, possibly empty. Should only be set if response is ProvideCredentials."
}
],
"experimental": true
} }
], ],
"commands": [ "commands": [
@ -3398,37 +3463,43 @@
"name": "errorReason", "name": "errorReason",
"$ref": "ErrorReason", "$ref": "ErrorReason",
"optional": true, "optional": true,
"description": "If set this causes the request to fail with the given reason." "description": "If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge."
}, },
{ {
"name": "rawResponse", "name": "rawResponse",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc..." "description": "If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge."
}, },
{ {
"name": "url", "name": "url",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "If set the request url will be modified in a way that's not observable by page." "description": "If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge."
}, },
{ {
"name": "method", "name": "method",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "If set this allows the request method to be overridden." "description": "If set this allows the request method to be overridden. Must not be set in response to an authChallenge."
}, },
{ {
"name": "postData", "name": "postData",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "If set this allows postData to be set." "description": "If set this allows postData to be set. Must not be set in response to an authChallenge."
}, },
{ {
"name": "headers", "name": "headers",
"$ref": "Headers", "$ref": "Headers",
"optional": true, "optional": true,
"description": "If set this allows the request headers to be changed." "description": "If set this allows the request headers to be changed. Must not be set in response to an authChallenge."
},
{
"name": "authChallengeResponse",
"$ref": "AuthChallengeResponse",
"optional": true,
"description": "Response to a requestIntercepted with an authChallenge. Must not be set otherwise."
} }
], ],
"experimental": true "experimental": true
@ -3845,14 +3916,19 @@
"description": "Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked.", "description": "Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked.",
"parameters": [ "parameters": [
{ {
"name": "InterceptionId", "name": "interceptionId",
"$ref": "InterceptionId", "$ref": "InterceptionId",
"description": "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." "description": "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."
}, },
{ {
"name": "request", "name": "request",
"$ref": "Request" "$ref": "Request"
}, },
{
"name": "resourceType",
"$ref": "Page.ResourceType",
"description": "How the requested resource will be used."
},
{ {
"name": "redirectHeaders", "name": "redirectHeaders",
"$ref": "Headers", "$ref": "Headers",
@ -3870,6 +3946,12 @@
"optional": true, "optional": true,
"type": "string", "type": "string",
"description": "Redirect location, only sent if a redirect was intercepted." "description": "Redirect location, only sent if a redirect was intercepted."
},
{
"name": "authChallenge",
"$ref": "AuthChallenge",
"optional": true,
"description": "Details of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse."
} }
], ],
"experimental": true "experimental": true
@ -4399,7 +4481,12 @@
{ {
"name": "response", "name": "response",
"type": "string", "type": "string",
"description": "Response stataus text." "description": "Response status text."
},
{
"name": "responseTime",
"type": "number",
"description": "Number of seconds since epoch."
} }
] ]
}, },
@ -6822,60 +6909,6 @@
], ],
"description": "Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.", "description": "Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.",
"experimental": true "experimental": true
},
{
"id": "LayoutTreeNode",
"type": "object",
"properties": [
{
"name": "nodeId",
"$ref": "DOM.NodeId",
"description": "The id of the related DOM node matching one from DOM.GetDocument."
},
{
"name": "boundingBox",
"$ref": "DOM.Rect",
"description": "The absolute position bounding box."
},
{
"name": "layoutText",
"type": "string",
"optional": true,
"description": "Contents of the LayoutText if any"
},
{
"name": "inlineTextNodes",
"type": "array",
"optional": true,
"items": {
"$ref": "InlineTextBox"
},
"description": "The post layout inline text nodes, if any."
},
{
"name": "styleIndex",
"type": "integer",
"optional": true,
"description": "Index into the computedStyles array returned by getLayoutTreeAndStyles."
}
],
"description": "Details of an element in the DOM tree with a LayoutObject.",
"experimental": true
},
{
"id": "ComputedStyle",
"type": "object",
"properties": [
{
"name": "properties",
"type": "array",
"items": {
"$ref": "CSSComputedStyleProperty"
}
}
],
"description": "A subset of the full ComputedStyle as defined by the request whitelist.",
"experimental": true
} }
], ],
"commands": [ "commands": [
@ -7297,37 +7330,6 @@
], ],
"experimental": true "experimental": true
}, },
{
"name": "getLayoutTreeAndStyles",
"parameters": [
{
"name": "computedStyleWhitelist",
"type": "array",
"items": {
"type": "string"
},
"description": "Whitelist of computed styles to return."
}
],
"returns": [
{
"name": "layoutTreeNodes",
"type": "array",
"items": {
"$ref": "LayoutTreeNode"
}
},
{
"name": "computedStyles",
"type": "array",
"items": {
"$ref": "ComputedStyle"
}
}
],
"description": "For the main document and any content documents, return the LayoutTreeNodes and a whitelisted subset of the computed style. It only returns pushed nodes, on way to pull all nodes is to call DOM.getDocument with a depth of -1.",
"experimental": true
},
{ {
"name": "startRuleUsageTracking", "name": "startRuleUsageTracking",
"description": "Enables the selector recording.", "description": "Enables the selector recording.",
@ -7405,6 +7407,244 @@
} }
] ]
}, },
{
"domain": "DOMSnapshot",
"experimental": true,
"description": "This domain facilitates obtaining document snapshots with DOM, layout, and style information.",
"dependencies": [
"CSS",
"DOM",
"Page"
],
"types": [
{
"id": "DOMNode",
"type": "object",
"properties": [
{
"name": "nodeType",
"type": "integer",
"description": "<code>Node</code>'s nodeType."
},
{
"name": "nodeName",
"type": "string",
"description": "<code>Node</code>'s nodeName."
},
{
"name": "nodeValue",
"type": "string",
"description": "<code>Node</code>'s nodeValue."
},
{
"name": "backendNodeId",
"$ref": "DOM.BackendNodeId",
"description": "<code>Node</code>'s id, corresponds to DOM.Node.backendNodeId."
},
{
"name": "childNodeIndexes",
"type": "array",
"items": {
"type": "integer"
},
"optional": true,
"description": "The indexes of the node's child nodes in the <code>domNodes</code> array returned by <code>getSnapshot</code>, if any."
},
{
"name": "attributes",
"type": "array",
"items": {
"$ref": "NameValue"
},
"optional": true,
"description": "Attributes of an <code>Element</code> node."
},
{
"name": "pseudoElementIndexes",
"type": "array",
"items": {
"type": "integer"
},
"optional": true,
"description": "Indexes of pseudo elements associated with this node in the <code>domNodes</code> array returned by <code>getSnapshot</code>, if any."
},
{
"name": "layoutNodeIndex",
"type": "integer",
"optional": true,
"description": "The index of the node's related layout tree node in the <code>layoutTreeNodes</code> array returned by <code>getSnapshot</code>, if any."
},
{
"name": "documentURL",
"type": "string",
"optional": true,
"description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to."
},
{
"name": "baseURL",
"type": "string",
"optional": true,
"description": "Base URL that <code>Document</code> or <code>FrameOwner</code> node uses for URL completion."
},
{
"name": "publicId",
"type": "string",
"optional": true,
"description": "<code>DocumentType</code> node's publicId."
},
{
"name": "systemId",
"type": "string",
"optional": true,
"description": "<code>DocumentType</code> node's systemId."
},
{
"name": "frameId",
"$ref": "Page.FrameId",
"optional": true,
"description": "Frame ID for frame owner elements."
},
{
"name": "contentDocumentIndex",
"type": "integer",
"optional": true,
"description": "The index of a frame owner element's content document in the <code>domNodes</code> array returned by <code>getSnapshot</code>, if any."
},
{
"name": "importedDocumentIndex",
"type": "integer",
"optional": true,
"description": "Index of the imported document's node of a link element in the <code>domNodes</code> array returned by <code>getSnapshot</code>, if any."
},
{
"name": "templateContentIndex",
"type": "integer",
"optional": true,
"description": "Index of the content node of a template element in the <code>domNodes</code> array returned by <code>getSnapshot</code>."
},
{
"name": "pseudoType",
"$ref": "DOM.PseudoType",
"optional": true,
"description": "Type of a pseudo element node."
}
],
"description": "A Node in the DOM tree."
},
{
"id": "LayoutTreeNode",
"type": "object",
"properties": [
{
"name": "domNodeIndex",
"type": "integer",
"description": "The index of the related DOM node in the <code>domNodes</code> array returned by <code>getSnapshot</code>."
},
{
"name": "boundingBox",
"$ref": "DOM.Rect",
"description": "The absolute position bounding box."
},
{
"name": "layoutText",
"type": "string",
"optional": true,
"description": "Contents of the LayoutText, if any."
},
{
"name": "inlineTextNodes",
"type": "array",
"optional": true,
"items": {
"$ref": "CSS.InlineTextBox"
},
"description": "The post-layout inline text nodes, if any."
},
{
"name": "styleIndex",
"type": "integer",
"optional": true,
"description": "Index into the <code>computedStyles</code> array returned by <code>getSnapshot</code>."
}
],
"description": "Details of an element in the DOM tree with a LayoutObject."
},
{
"id": "ComputedStyle",
"type": "object",
"properties": [
{
"name": "properties",
"type": "array",
"items": {
"$ref": "NameValue"
},
"description": "Name/value pairs of computed style properties."
}
],
"description": "A subset of the full ComputedStyle as defined by the request whitelist."
},
{
"id": "NameValue",
"type": "object",
"properties": [
{
"name": "name",
"type": "string",
"description": "Attribute/property name."
},
{
"name": "value",
"type": "string",
"description": "Attribute/property value."
}
],
"description": "A name/value pair."
}
],
"commands": [
{
"name": "getSnapshot",
"parameters": [
{
"name": "computedStyleWhitelist",
"type": "array",
"items": {
"type": "string"
},
"description": "Whitelist of computed styles to return."
}
],
"returns": [
{
"name": "domNodes",
"type": "array",
"items": {
"$ref": "DOMNode"
},
"description": "The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document."
},
{
"name": "layoutTreeNodes",
"type": "array",
"items": {
"$ref": "LayoutTreeNode"
},
"description": "The nodes in the layout tree."
},
{
"name": "computedStyles",
"type": "array",
"items": {
"$ref": "ComputedStyle"
},
"description": "Whitelisted ComputedStyle properties for each node in the layout tree."
}
],
"description": "Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported 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 flattened. "
}
]
},
{ {
"domain": "IO", "domain": "IO",
"description": "Input/Output operations for streams produced by DevTools.", "description": "Input/Output operations for streams produced by DevTools.",
@ -10171,6 +10411,29 @@
} }
], ],
"description": "Clears storage for origin." "description": "Clears storage for origin."
},
{
"name": "getUsageAndQuota",
"parameters": [
{
"name": "origin",
"type": "string",
"description": "Security origin."
}
],
"returns": [
{
"name": "usage",
"type": "number",
"description": "Storage usage (bytes)."
},
{
"name": "quota",
"type": "number",
"description": "Storage quota (bytes)."
}
],
"description": "Returns usage and quota in bytes."
} }
] ]
}, },
@ -11698,6 +11961,13 @@
"$ref": "StackTrace", "$ref": "StackTrace",
"optional": true, "optional": true,
"description": "Stack trace captured when the call was made." "description": "Stack trace captured when the call was made."
},
{
"name": "context",
"type": "string",
"optional": true,
"experimental": true,
"description": "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."
} }
] ]
}, },