Updating to latest chrome protocol.json

This commit is contained in:
Kenneth Shaw 2017-01-24 22:21:23 +07:00
parent 20d575fece
commit a733b57f8d
4 changed files with 90 additions and 21 deletions

View File

@ -2588,6 +2588,25 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork23(in *jlexer.Lexer, ou
continue continue
} }
switch key { switch key {
case "urls":
if in.IsNull() {
in.Skip()
out.Urls = nil
} else {
in.Delim('[')
if !in.IsDelim(']') {
out.Urls = make([]string, 0, 4)
} else {
out.Urls = []string{}
}
for !in.IsDelim(']') {
var v10 string
v10 = string(in.String())
out.Urls = append(out.Urls, v10)
in.WantComma()
}
in.Delim(']')
}
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -2602,6 +2621,25 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork23(out *jwriter.Writer,
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
if len(in.Urls) != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"urls\":")
if in.Urls == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v11, v12 := range in.Urls {
if v11 > 0 {
out.RawByte(',')
}
out.String(string(v12))
}
out.RawByte(']')
}
}
out.RawByte('}') out.RawByte('}')
} }
@ -2659,9 +2697,9 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork24(in *jlexer.Lexer, ou
out.TableNames = []string{} out.TableNames = []string{}
} }
for !in.IsDelim(']') { for !in.IsDelim(']') {
var v10 string var v13 string
v10 = string(in.String()) v13 = string(in.String())
out.TableNames = append(out.TableNames, v10) out.TableNames = append(out.TableNames, v13)
in.WantComma() in.WantComma()
} }
in.Delim(']') in.Delim(']')
@ -2690,11 +2728,11 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork24(out *jwriter.Writer,
out.RawString("null") out.RawString("null")
} else { } else {
out.RawByte('[') out.RawByte('[')
for v11, v12 := range in.TableNames { for v14, v15 := range in.TableNames {
if v11 > 0 { if v14 > 0 {
out.RawByte(',') out.RawByte(',')
} }
out.String(string(v12)) out.String(string(v15))
} }
out.RawByte(']') out.RawByte(']')
} }
@ -2823,17 +2861,17 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork26(in *jlexer.Lexer, ou
out.Cookies = []*Cookie{} out.Cookies = []*Cookie{}
} }
for !in.IsDelim(']') { for !in.IsDelim(']') {
var v13 *Cookie var v16 *Cookie
if in.IsNull() { if in.IsNull() {
in.Skip() in.Skip()
v13 = nil v16 = nil
} else { } else {
if v13 == nil { if v16 == nil {
v13 = new(Cookie) v16 = new(Cookie)
} }
(*v13).UnmarshalEasyJSON(in) (*v16).UnmarshalEasyJSON(in)
} }
out.Cookies = append(out.Cookies, v13) out.Cookies = append(out.Cookies, v16)
in.WantComma() in.WantComma()
} }
in.Delim(']') in.Delim(']')
@ -2862,14 +2900,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork26(out *jwriter.Writer,
out.RawString("null") out.RawString("null")
} else { } else {
out.RawByte('[') out.RawByte('[')
for v14, v15 := range in.Cookies { for v17, v18 := range in.Cookies {
if v14 > 0 { if v17 > 0 {
out.RawByte(',') out.RawByte(',')
} }
if v15 == nil { if v18 == nil {
out.RawString("null") out.RawString("null")
} else { } else {
(*v15).MarshalEasyJSON(out) (*v18).MarshalEasyJSON(out)
} }
} }
out.RawByte(']') out.RawByte(']')

View File

@ -739,15 +739,25 @@ func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h FrameHandler) (er
// GetCookiesParams returns all browser cookies for the current URL. // GetCookiesParams returns all browser cookies for the current URL.
// Depending on the backend support, will return detailed cookie information in // Depending on the backend support, will return detailed cookie information in
// the cookies field. // the cookies field.
type GetCookiesParams struct{} type GetCookiesParams struct {
Urls []string `json:"urls,omitempty"` // The list of URLs for which applicable cookies will be fetched
}
// GetCookies returns all browser cookies for the current URL. Depending on // GetCookies returns all browser cookies for the current URL. Depending on
// the backend support, will return detailed cookie information in the cookies // the backend support, will return detailed cookie information in the cookies
// field. // field.
//
// parameters:
func GetCookies() *GetCookiesParams { func GetCookies() *GetCookiesParams {
return &GetCookiesParams{} return &GetCookiesParams{}
} }
// WithUrls the list of URLs for which applicable cookies will be fetched.
func (p GetCookiesParams) WithUrls(urls []string) *GetCookiesParams {
p.Urls = urls
return &p
}
// GetCookiesReturns return values. // GetCookiesReturns return values.
type GetCookiesReturns struct { type GetCookiesReturns struct {
Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects. Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects.
@ -762,8 +772,14 @@ func (p *GetCookiesParams) Do(ctxt context.Context, h FrameHandler) (cookies []*
ctxt = context.Background() ctxt = context.Background()
} }
// marshal
buf, err := easyjson.Marshal(p)
if err != nil {
return nil, err
}
// execute // execute
ch := h.Execute(ctxt, CommandNetworkGetCookies, Empty) ch := h.Execute(ctxt, CommandNetworkGetCookies, easyjson.RawMessage(buf))
// read response // read response
select { select {

View File

@ -502,9 +502,10 @@ func (t InitiatorType) String() string {
// InitiatorType values. // InitiatorType values.
const ( const (
InitiatorTypeParser InitiatorType = "parser" InitiatorTypeParser InitiatorType = "parser"
InitiatorTypeScript InitiatorType = "script" InitiatorTypeScript InitiatorType = "script"
InitiatorTypeOther InitiatorType = "other" InitiatorTypePreload InitiatorType = "preload"
InitiatorTypeOther InitiatorType = "other"
) )
// MarshalEasyJSON satisfies easyjson.Marshaler. // MarshalEasyJSON satisfies easyjson.Marshaler.
@ -524,6 +525,8 @@ func (t *InitiatorType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = InitiatorTypeParser *t = InitiatorTypeParser
case InitiatorTypeScript: case InitiatorTypeScript:
*t = InitiatorTypeScript *t = InitiatorTypeScript
case InitiatorTypePreload:
*t = InitiatorTypePreload
case InitiatorTypeOther: case InitiatorTypeOther:
*t = InitiatorTypeOther *t = InitiatorTypeOther

View File

@ -2387,6 +2387,7 @@
"enum": [ "enum": [
"parser", "parser",
"script", "script",
"preload",
"other" "other"
], ],
"description": "Type of this initiator." "description": "Type of this initiator."
@ -2621,6 +2622,17 @@
}, },
{ {
"name": "getCookies", "name": "getCookies",
"parameters": [
{
"name": "urls",
"type": "array",
"items": {
"type": "string"
},
"optional": true,
"description": "The list of URLs for which applicable cookies will be fetched"
}
],
"returns": [ "returns": [
{ {
"name": "cookies", "name": "cookies",