Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-03-25 05:51:18 +07:00
parent 568cab6121
commit 3892722188
17 changed files with 1420 additions and 688 deletions

View File

@ -124,9 +124,12 @@ const (
CommandEmulationSetVirtualTimePolicy MethodType = "Emulation.setVirtualTimePolicy"
CommandEmulationSetDefaultBackgroundColorOverride MethodType = "Emulation.setDefaultBackgroundColorOverride"
EventSecuritySecurityStateChanged MethodType = "Security.securityStateChanged"
EventSecurityCertificateError MethodType = "Security.certificateError"
CommandSecurityEnable MethodType = "Security.enable"
CommandSecurityDisable MethodType = "Security.disable"
CommandSecurityShowCertificateViewer MethodType = "Security.showCertificateViewer"
CommandSecurityHandleCertificateError MethodType = "Security.handleCertificateError"
CommandSecuritySetOverrideCertificateErrors MethodType = "Security.setOverrideCertificateErrors"
EventNetworkResourceChangedPriority MethodType = "Network.resourceChangedPriority"
EventNetworkRequestWillBeSent MethodType = "Network.requestWillBeSent"
EventNetworkRequestServedFromCache MethodType = "Network.requestServedFromCache"
@ -280,6 +283,7 @@ const (
CommandCSSGetBackgroundColors MethodType = "CSS.getBackgroundColors"
CommandCSSGetLayoutTreeAndStyles MethodType = "CSS.getLayoutTreeAndStyles"
CommandCSSStartRuleUsageTracking MethodType = "CSS.startRuleUsageTracking"
CommandCSSTakeCoverageDelta MethodType = "CSS.takeCoverageDelta"
CommandCSSStopRuleUsageTracking MethodType = "CSS.stopRuleUsageTracking"
CommandIORead MethodType = "IO.read"
CommandIOClose MethodType = "IO.close"
@ -621,12 +625,18 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandEmulationSetDefaultBackgroundColorOverride
case EventSecuritySecurityStateChanged:
*t = EventSecuritySecurityStateChanged
case EventSecurityCertificateError:
*t = EventSecurityCertificateError
case CommandSecurityEnable:
*t = CommandSecurityEnable
case CommandSecurityDisable:
*t = CommandSecurityDisable
case CommandSecurityShowCertificateViewer:
*t = CommandSecurityShowCertificateViewer
case CommandSecurityHandleCertificateError:
*t = CommandSecurityHandleCertificateError
case CommandSecuritySetOverrideCertificateErrors:
*t = CommandSecuritySetOverrideCertificateErrors
case EventNetworkResourceChangedPriority:
*t = EventNetworkResourceChangedPriority
case EventNetworkRequestWillBeSent:
@ -933,6 +943,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandCSSGetLayoutTreeAndStyles
case CommandCSSStartRuleUsageTracking:
*t = CommandCSSStartRuleUsageTracking
case CommandCSSTakeCoverageDelta:
*t = CommandCSSTakeCoverageDelta
case CommandCSSStopRuleUsageTracking:
*t = CommandCSSStopRuleUsageTracking
case CommandIORead:

View File

@ -277,9 +277,18 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandSecurityShowCertificateViewer:
return emptyVal, nil
case cdp.CommandSecurityHandleCertificateError:
return emptyVal, nil
case cdp.CommandSecuritySetOverrideCertificateErrors:
return emptyVal, nil
case cdp.EventSecuritySecurityStateChanged:
v = new(security.EventSecurityStateChanged)
case cdp.EventSecurityCertificateError:
v = new(security.EventCertificateError)
case cdp.CommandNetworkEnable:
return emptyVal, nil
@ -724,6 +733,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandCSSStartRuleUsageTracking:
return emptyVal, nil
case cdp.CommandCSSTakeCoverageDelta:
v = new(css.TakeCoverageDeltaReturns)
case cdp.CommandCSSStopRuleUsageTracking:
v = new(css.StopRuleUsageTrackingReturns)

View File

@ -758,6 +758,37 @@ func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (
return h.Execute(ctxt, cdp.CommandCSSStartRuleUsageTracking, nil, nil)
}
// TakeCoverageDeltaParams obtain list of rules that became used since last
// call to this method (or since start of coverage instrumentation).
type TakeCoverageDeltaParams struct{}
// TakeCoverageDelta obtain list of rules that became used since last call to
// this method (or since start of coverage instrumentation).
func TakeCoverageDelta() *TakeCoverageDeltaParams {
return &TakeCoverageDeltaParams{}
}
// TakeCoverageDeltaReturns return values.
type TakeCoverageDeltaReturns struct {
Coverage []*RuleUsage `json:"coverage,omitempty"`
}
// Do executes CSS.takeCoverageDelta against the provided context and
// target handler.
//
// returns:
// coverage
func (p *TakeCoverageDeltaParams) Do(ctxt context.Context, h cdp.Handler) (coverage []*RuleUsage, err error) {
// execute
var res TakeCoverageDeltaReturns
err = h.Execute(ctxt, cdp.CommandCSSTakeCoverageDelta, nil, &res)
if err != nil {
return nil, err
}
return res.Coverage, nil
}
// StopRuleUsageTrackingParams the list of rules with an indication of
// whether these were used.
type StopRuleUsageTrackingParams struct{}

File diff suppressed because it is too large Load Diff

View File

@ -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.
}
// RuleUsage cSS rule usage information.
// RuleUsage cSS coverage information.
type RuleUsage struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
StartOffset float64 `json:"startOffset,omitempty"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet.

View File

@ -1318,8 +1318,9 @@ func (p *GetBoxModelParams) Do(ctxt context.Context, h cdp.Handler) (model *BoxM
// GetNodeForLocationParams returns node id at given location.
type GetNodeForLocationParams struct {
X int64 `json:"x"` // X coordinate.
Y int64 `json:"y"` // Y coordinate.
X int64 `json:"x"` // X coordinate.
Y int64 `json:"y"` // Y coordinate.
IncludeUserAgentShadowDOM bool `json:"includeUserAgentShadowDOM,omitempty"` // False to skip to the nearest non-UA shadow root ancestor (default: false).
}
// GetNodeForLocation returns node id at given location.
@ -1334,6 +1335,13 @@ func GetNodeForLocation(x int64, y int64) *GetNodeForLocationParams {
}
}
// WithIncludeUserAgentShadowDOM false to skip to the nearest non-UA shadow
// root ancestor (default: false).
func (p GetNodeForLocationParams) WithIncludeUserAgentShadowDOM(includeUserAgentShadowDOM bool) *GetNodeForLocationParams {
p.IncludeUserAgentShadowDOM = includeUserAgentShadowDOM
return &p
}
// GetNodeForLocationReturns return values.
type GetNodeForLocationReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node at given coordinates.

View File

@ -4062,6 +4062,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDom46(in *jlexer.Lexer, out *G
out.X = int64(in.Int64())
case "y":
out.Y = int64(in.Int64())
case "includeUserAgentShadowDOM":
out.IncludeUserAgentShadowDOM = bool(in.Bool())
default:
in.SkipRecursive()
}
@ -4088,6 +4090,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom46(out *jwriter.Writer, in
first = false
out.RawString("\"y\":")
out.Int64(int64(in.Y))
if in.IncludeUserAgentShadowDOM {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"includeUserAgentShadowDOM\":")
out.Bool(bool(in.IncludeUserAgentShadowDOM))
}
out.RawByte('}')
}

View File

@ -7,6 +7,7 @@ import (
cdp "github.com/knq/chromedp/cdp"
debugger "github.com/knq/chromedp/cdp/debugger"
dom "github.com/knq/chromedp/cdp/dom"
runtime "github.com/knq/chromedp/cdp/runtime"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
@ -4242,6 +4243,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage51(in *jlexer.Lexer, out *
(out.FrameID).UnmarshalEasyJSON(in)
case "parentFrameId":
(out.ParentFrameID).UnmarshalEasyJSON(in)
case "stack":
if in.IsNull() {
in.Skip()
out.Stack = nil
} else {
if out.Stack == nil {
out.Stack = new(runtime.StackTrace)
}
(*out.Stack).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
@ -4272,6 +4283,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage51(out *jwriter.Writer, in
out.RawString("\"parentFrameId\":")
out.String(string(in.ParentFrameID))
}
if in.Stack != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"stack\":")
if in.Stack == nil {
out.RawString("null")
} else {
(*in.Stack).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}

View File

@ -4,6 +4,7 @@ package page
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// EventDomContentEventFired [no description].
@ -18,8 +19,9 @@ type EventLoadEventFired struct {
// EventFrameAttached fired when frame has been attached to its parent.
type EventFrameAttached struct {
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been attached.
ParentFrameID cdp.FrameID `json:"parentFrameId,omitempty"` // Parent frame identifier.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Id of the frame that has been attached.
ParentFrameID cdp.FrameID `json:"parentFrameId,omitempty"` // Parent frame identifier.
Stack *runtime.StackTrace `json:"stack,omitempty"` // JavaScript stack trace of when frame was attached, only set if frame initiated from script.
}
// EventFrameNavigated fired once navigation of the frame has completed.

View File

@ -409,6 +409,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpProfiler5(in *jlexer.Lexer, ou
continue
}
switch key {
case "callCount":
out.CallCount = bool(in.Bool())
default:
in.SkipRecursive()
}
@ -423,6 +425,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler5(out *jwriter.Writer,
out.RawByte('{')
first := true
_ = first
if in.CallCount {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"callCount\":")
out.Bool(bool(in.CallCount))
}
out.RawByte('}')
}

View File

@ -109,19 +109,30 @@ func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile,
// StartPreciseCoverageParams enable precise code coverage. Coverage data for
// JavaScript executed before enabling precise code coverage may be incomplete.
// Enabling prevents running optimized code and resets execution counters.
type StartPreciseCoverageParams struct{}
type StartPreciseCoverageParams struct {
CallCount bool `json:"callCount,omitempty"` // Collect accurate call counts beyond simple 'covered' or 'not covered'.
}
// StartPreciseCoverage enable precise code coverage. Coverage data for
// JavaScript executed before enabling precise code coverage may be incomplete.
// Enabling prevents running optimized code and resets execution counters.
//
// parameters:
func StartPreciseCoverage() *StartPreciseCoverageParams {
return &StartPreciseCoverageParams{}
}
// WithCallCount collect accurate call counts beyond simple 'covered' or 'not
// covered'.
func (p StartPreciseCoverageParams) WithCallCount(callCount bool) *StartPreciseCoverageParams {
p.CallCount = callCount
return &p
}
// Do executes Profiler.startPreciseCoverage against the provided context and
// target handler.
func (p *StartPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandProfilerStartPreciseCoverage, nil, nil)
return h.Execute(ctxt, cdp.CommandProfilerStartPreciseCoverage, p, nil)
}
// StopPreciseCoverageParams disable precise code coverage. Disabling

View File

@ -283,6 +283,8 @@ const (
SubtypeDate Subtype = "date"
SubtypeMap Subtype = "map"
SubtypeSet Subtype = "set"
SubtypeWeakmap Subtype = "weakmap"
SubtypeWeakset Subtype = "weakset"
SubtypeIterator Subtype = "iterator"
SubtypeGenerator Subtype = "generator"
SubtypeError Subtype = "error"
@ -318,6 +320,10 @@ func (t *Subtype) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = SubtypeMap
case SubtypeSet:
*t = SubtypeSet
case SubtypeWeakmap:
*t = SubtypeWeakmap
case SubtypeWeakset:
*t = SubtypeWeakset
case SubtypeIterator:
*t = SubtypeIterator
case SubtypeGenerator:

View File

@ -175,7 +175,74 @@ func (v *ShowCertificateViewerParams) UnmarshalJSON(data []byte) error {
func (v *ShowCertificateViewerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, out *InsecureContentStatus) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, out *SetOverrideCertificateErrorsParams) {
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 "override":
out.Override = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer, in SetOverrideCertificateErrorsParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"override\":")
out.Bool(bool(in.Override))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetOverrideCertificateErrorsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetOverrideCertificateErrorsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetOverrideCertificateErrorsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetOverrideCertificateErrorsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, out *InsecureContentStatus) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -216,7 +283,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(in *jlexer.Lexer, ou
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer, in InsecureContentStatus) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in InsecureContentStatus) {
out.RawByte('{')
first := true
_ = first
@ -274,27 +341,102 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v InsecureContentStatus) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v InsecureContentStatus) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity2(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *InsecureContentStatus) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *InsecureContentStatus) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity2(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, out *EventSecurityStateChanged) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(in *jlexer.Lexer, out *HandleCertificateErrorParams) {
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 "eventId":
out.EventID = int64(in.Int64())
case "action":
(out.Action).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(out *jwriter.Writer, in HandleCertificateErrorParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"eventId\":")
out.Int64(int64(in.EventID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"action\":")
(in.Action).MarshalEasyJSON(out)
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v HandleCertificateErrorParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v HandleCertificateErrorParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *HandleCertificateErrorParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *HandleCertificateErrorParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(in *jlexer.Lexer, out *EventSecurityStateChanged) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -370,7 +512,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(in *jlexer.Lexer, ou
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer, in EventSecurityStateChanged) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer, in EventSecurityStateChanged) {
out.RawByte('{')
first := true
_ = first
@ -439,27 +581,116 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v EventSecurityStateChanged) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventSecurityStateChanged) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity3(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventSecurityStateChanged) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventSecurityStateChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity3(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(in *jlexer.Lexer, out *EnableParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity6(in *jlexer.Lexer, out *EventCertificateError) {
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 "eventId":
out.EventID = int64(in.Int64())
case "errorType":
out.ErrorType = string(in.String())
case "requestURL":
out.RequestURL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity6(out *jwriter.Writer, in EventCertificateError) {
out.RawByte('{')
first := true
_ = first
if in.EventID != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"eventId\":")
out.Int64(int64(in.EventID))
}
if in.ErrorType != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"errorType\":")
out.String(string(in.ErrorType))
}
if in.RequestURL != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"requestURL\":")
out.String(string(in.RequestURL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventCertificateError) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventCertificateError) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventCertificateError) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventCertificateError) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity7(in *jlexer.Lexer, out *EnableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -488,7 +719,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(in *jlexer.Lexer, ou
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(out *jwriter.Writer, in EnableParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity7(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
@ -498,27 +729,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity4(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity4(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(in *jlexer.Lexer, out *DisableParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity8(in *jlexer.Lexer, out *DisableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -547,7 +778,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(in *jlexer.Lexer, ou
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer, in DisableParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity8(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
@ -557,23 +788,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity5(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity5(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity8(l, v)
}

View File

@ -15,7 +15,18 @@ type EventSecurityStateChanged struct {
Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state.
}
// EventCertificateError there is a certificate error. If overriding
// certificate errors is enabled, then it should be handled with the
// handleCertificateError command. Note: this event does not fire if the
// certificate error has been allowed internally.
type EventCertificateError struct {
EventID int64 `json:"eventId,omitempty"` // The ID of the event.
ErrorType string `json:"errorType,omitempty"` // The type of the error.
RequestURL string `json:"requestURL,omitempty"` // The url that was requested.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventSecuritySecurityStateChanged,
cdp.EventSecurityCertificateError,
}

View File

@ -56,3 +56,54 @@ func ShowCertificateViewer() *ShowCertificateViewerParams {
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandSecurityShowCertificateViewer, nil, nil)
}
// HandleCertificateErrorParams handles a certificate error that fired a
// certificateError event.
type HandleCertificateErrorParams struct {
EventID int64 `json:"eventId"` // The ID of the event.
Action CertificateErrorAction `json:"action"` // The action to take on the certificate error.
}
// HandleCertificateError handles a certificate error that fired a
// certificateError event.
//
// parameters:
// eventID - The ID of the event.
// action - The action to take on the certificate error.
func HandleCertificateError(eventID int64, action CertificateErrorAction) *HandleCertificateErrorParams {
return &HandleCertificateErrorParams{
EventID: eventID,
Action: action,
}
}
// Do executes Security.handleCertificateError against the provided context and
// target handler.
func (p *HandleCertificateErrorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandSecurityHandleCertificateError, p, nil)
}
// SetOverrideCertificateErrorsParams enable/disable overriding certificate
// errors. If enabled, all certificate error events need to be handled by the
// DevTools client and should be answered with handleCertificateError commands.
type SetOverrideCertificateErrorsParams struct {
Override bool `json:"override"` // If true, certificate errors will be overridden.
}
// SetOverrideCertificateErrors enable/disable overriding certificate errors.
// If enabled, all certificate error events need to be handled by the DevTools
// client and should be answered with handleCertificateError commands.
//
// parameters:
// override - If true, certificate errors will be overridden.
func SetOverrideCertificateErrors(override bool) *SetOverrideCertificateErrorsParams {
return &SetOverrideCertificateErrorsParams{
Override: override,
}
}
// Do executes Security.setOverrideCertificateErrors against the provided context and
// target handler.
func (p *SetOverrideCertificateErrorsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandSecuritySetOverrideCertificateErrors, p, nil)
}

View File

@ -90,3 +90,47 @@ type InsecureContentStatus struct {
RanInsecureContentStyle State `json:"ranInsecureContentStyle,omitempty"` // Security state representing a page that ran insecure content.
DisplayedInsecureContentStyle State `json:"displayedInsecureContentStyle,omitempty"` // Security state representing a page that displayed insecure content.
}
// CertificateErrorAction the action to take when a certificate error occurs.
// continue will continue processing the request and cancel will cancel the
// request.
type CertificateErrorAction string
// String returns the CertificateErrorAction as string value.
func (t CertificateErrorAction) String() string {
return string(t)
}
// CertificateErrorAction values.
const (
CertificateErrorActionContinue CertificateErrorAction = "continue"
CertificateErrorActionCancel CertificateErrorAction = "cancel"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t CertificateErrorAction) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t CertificateErrorAction) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *CertificateErrorAction) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch CertificateErrorAction(in.String()) {
case CertificateErrorActionContinue:
*t = CertificateErrorActionContinue
case CertificateErrorActionCancel:
*t = CertificateErrorActionCancel
default:
in.AddError(errors.New("unknown CertificateErrorAction value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *CertificateErrorAction) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1147,6 +1147,13 @@
"name": "parentFrameId",
"$ref": "FrameId",
"description": "Parent frame identifier."
},
{
"name": "stack",
"$ref": "Runtime.StackTrace",
"optional": true,
"description": "JavaScript stack trace of when frame was attached, only set if frame initiated from script.",
"experimental": true
}
]
},
@ -1818,6 +1825,15 @@
}
],
"description": "Information about insecure content on the page."
},
{
"id": "CertificateErrorAction",
"type": "string",
"enum": [
"continue",
"cancel"
],
"description": "The action to take when a certificate error occurs. continue will continue processing the request and cancel will cancel the request."
}
],
"commands": [
@ -1832,6 +1848,33 @@
{
"name": "showCertificateViewer",
"description": "Displays native dialog with the certificate details."
},
{
"name": "handleCertificateError",
"description": "Handles a certificate error that fired a certificateError event.",
"parameters": [
{
"name": "eventId",
"type": "integer",
"description": "The ID of the event."
},
{
"name": "action",
"$ref": "CertificateErrorAction",
"description": "The action to take on the certificate error."
}
]
},
{
"name": "setOverrideCertificateErrors",
"description": "Enable/disable overriding certificate errors. If enabled, all certificate error events need to be handled by the DevTools client and should be answered with handleCertificateError commands.",
"parameters": [
{
"name": "override",
"type": "boolean",
"description": "If true, certificate errors will be overridden."
}
]
}
],
"events": [
@ -1869,6 +1912,27 @@
"optional": true
}
]
},
{
"name": "certificateError",
"description": "There is a certificate error. If overriding certificate errors is enabled, then it should be handled with the handleCertificateError command. Note: this event does not fire if the certificate error has been allowed internally.",
"parameters": [
{
"name": "eventId",
"type": "integer",
"description": "The ID of the event."
},
{
"name": "errorType",
"type": "string",
"description": "The type of the error."
},
{
"name": "requestURL",
"type": "string",
"description": "The url that was requested."
}
]
}
]
},
@ -5557,6 +5621,12 @@
"name": "y",
"type": "integer",
"description": "Y coordinate."
},
{
"name": "includeUserAgentShadowDOM",
"type": "boolean",
"optional": true,
"description": "False to skip to the nearest non-UA shadow root ancestor (default: false)."
}
],
"returns": [
@ -6125,7 +6195,7 @@
"description": "Indicates whether the rule was actually used by some element in the page."
}
],
"description": "CSS rule usage information.",
"description": "CSS coverage information.",
"experimental": true
},
{
@ -7020,6 +7090,20 @@
"description": "Enables the selector recording.",
"experimental": true
},
{
"name": "takeCoverageDelta",
"description": "Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)",
"returns": [
{
"name": "coverage",
"type": "array",
"items": {
"$ref": "RuleUsage"
}
}
],
"experimental": true
},
{
"name": "stopRuleUsageTracking",
"returns": [
@ -10233,6 +10317,8 @@
"date",
"map",
"set",
"weakmap",
"weakset",
"iterator",
"generator",
"error",
@ -10347,6 +10433,8 @@
"date",
"map",
"set",
"weakmap",
"weakset",
"iterator",
"generator",
"error"
@ -10432,6 +10520,8 @@
"date",
"map",
"set",
"weakmap",
"weakset",
"iterator",
"generator",
"error"
@ -12503,6 +12593,14 @@
},
{
"name": "startPreciseCoverage",
"parameters": [
{
"name": "callCount",
"type": "boolean",
"optional": true,
"description": "Collect accurate call counts beyond simple 'covered' or 'not covered'."
}
],
"description": "Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.",
"experimental": true
},