Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-07-22 07:37:02 +07:00
parent 2d46c88024
commit b9e4c14157
17 changed files with 830 additions and 217 deletions

View File

@ -136,3 +136,42 @@ func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) { func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil) return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
} }
// RequestCachedResponseParams fetches cache entry.
type RequestCachedResponseParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache that contains the enty.
RequestURL string `json:"requestURL"` // URL spec of the request.
}
// RequestCachedResponse fetches cache entry.
//
// parameters:
// cacheID - Id of cache that contains the enty.
// requestURL - URL spec of the request.
func RequestCachedResponse(cacheID CacheID, requestURL string) *RequestCachedResponseParams {
return &RequestCachedResponseParams{
CacheID: cacheID,
RequestURL: requestURL,
}
}
// RequestCachedResponseReturns return values.
type RequestCachedResponseReturns struct {
Response *CachedResponse `json:"response,omitempty"` // Response read from the cache.
}
// Do executes CacheStorage.requestCachedResponse against the provided context and
// target handler.
//
// returns:
// response - Response read from the cache.
func (p *RequestCachedResponseParams) Do(ctxt context.Context, h cdp.Handler) (response *CachedResponse, err error) {
// execute
var res RequestCachedResponseReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCachedResponse, p, &res)
if err != nil {
return nil, err
}
return res.Response, nil
}

View File

@ -223,7 +223,163 @@ func (v *RequestEntriesParams) UnmarshalJSON(data []byte) error {
func (v *RequestEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *RequestEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage1(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer, out *RequestCacheNamesReturns) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer, out *RequestCachedResponseReturns) {
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":
if in.IsNull() {
in.Skip()
out.Response = nil
} else {
if out.Response == nil {
out.Response = new(CachedResponse)
}
(*out.Response).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in RequestCachedResponseReturns) {
out.RawByte('{')
first := true
_ = first
if in.Response != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"response\":")
if in.Response == nil {
out.RawString("null")
} else {
(*in.Response).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RequestCachedResponseReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RequestCachedResponseReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RequestCachedResponseReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RequestCachedResponseReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer, out *RequestCachedResponseParams) {
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 "cacheId":
out.CacheID = CacheID(in.String())
case "requestURL":
out.RequestURL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in RequestCachedResponseParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"cacheId\":")
out.String(string(in.CacheID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"requestURL\":")
out.String(string(in.RequestURL))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RequestCachedResponseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RequestCachedResponseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RequestCachedResponseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RequestCachedResponseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer, out *RequestCacheNamesReturns) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -283,7 +439,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in RequestCacheNamesReturns) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in RequestCacheNamesReturns) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -316,27 +472,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) { func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&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 RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) { func (v RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error { func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RequestCacheNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *RequestCacheNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer, out *RequestCacheNamesParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer, out *RequestCacheNamesParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -367,7 +523,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in RequestCacheNamesParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in RequestCacheNamesParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -383,27 +539,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v RequestCacheNamesParams) MarshalJSON() ([]byte, error) { func (v RequestCacheNamesParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&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 RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) { func (v RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error { func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer, out *DeleteEntryParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *DeleteEntryParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -436,7 +592,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in DeleteEntryParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DeleteEntryParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -458,27 +614,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v DeleteEntryParams) MarshalJSON() ([]byte, error) { func (v DeleteEntryParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&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 DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) { func (v DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error { func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DeleteEntryParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *DeleteEntryParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer, out *DeleteCacheParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *DeleteCacheParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -509,7 +665,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in DeleteCacheParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in DeleteCacheParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -525,27 +681,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v DeleteCacheParams) MarshalJSON() ([]byte, error) { func (v DeleteCacheParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&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 DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) { func (v DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error { func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DeleteCacheParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *DeleteCacheParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *DataEntry) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(in *jlexer.Lexer, out *DataEntry) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -580,7 +736,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DataEntry) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(out *jwriter.Writer, in DataEntry) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -608,27 +764,102 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v DataEntry) MarshalJSON() ([]byte, error) { func (v DataEntry) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(&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 DataEntry) MarshalEasyJSON(w *jwriter.Writer) { func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *DataEntry) UnmarshalJSON(data []byte) error { func (v *DataEntry) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *Cache) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(in *jlexer.Lexer, out *CachedResponse) {
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 "headers":
(out.Headers).UnmarshalEasyJSON(in)
case "body":
out.Body = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(out *jwriter.Writer, in CachedResponse) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"headers\":")
(in.Headers).MarshalEasyJSON(out)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"body\":")
out.String(string(in.Body))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v CachedResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CachedResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CachedResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CachedResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(in *jlexer.Lexer, out *Cache) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -663,7 +894,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in Cache) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(out *jwriter.Writer, in Cache) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -691,23 +922,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v Cache) MarshalJSON() ([]byte, error) { func (v Cache) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(&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 Cache) MarshalEasyJSON(w *jwriter.Writer) { func (v Cache) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *Cache) UnmarshalJSON(data []byte) error { func (v *Cache) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(l, v)
} }

View File

@ -1,5 +1,7 @@
package cachestorage package cachestorage
import "github.com/mailru/easyjson"
// Code generated by chromedp-gen. DO NOT EDIT. // Code generated by chromedp-gen. DO NOT EDIT.
// CacheID unique identifier of the Cache object. // CacheID unique identifier of the Cache object.
@ -23,3 +25,9 @@ type Cache struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin of the cache. SecurityOrigin string `json:"securityOrigin"` // Security origin of the cache.
CacheName string `json:"cacheName"` // The name of the cache. CacheName string `json:"cacheName"` // The name of the cache.
} }
// CachedResponse cached response.
type CachedResponse struct {
Headers easyjson.RawMessage `json:"headers"`
Body string `json:"body"` // Entry content, base64-encoded.
}

View File

@ -193,6 +193,7 @@ const (
CommandCacheStorageRequestEntries MethodType = "CacheStorage.requestEntries" CommandCacheStorageRequestEntries MethodType = "CacheStorage.requestEntries"
CommandCacheStorageDeleteCache MethodType = "CacheStorage.deleteCache" CommandCacheStorageDeleteCache MethodType = "CacheStorage.deleteCache"
CommandCacheStorageDeleteEntry MethodType = "CacheStorage.deleteEntry" CommandCacheStorageDeleteEntry MethodType = "CacheStorage.deleteEntry"
CommandCacheStorageRequestCachedResponse MethodType = "CacheStorage.requestCachedResponse"
EventDOMStorageDomStorageItemsCleared MethodType = "DOMStorage.domStorageItemsCleared" EventDOMStorageDomStorageItemsCleared MethodType = "DOMStorage.domStorageItemsCleared"
EventDOMStorageDomStorageItemRemoved MethodType = "DOMStorage.domStorageItemRemoved" EventDOMStorageDomStorageItemRemoved MethodType = "DOMStorage.domStorageItemRemoved"
EventDOMStorageDomStorageItemAdded MethodType = "DOMStorage.domStorageItemAdded" EventDOMStorageDomStorageItemAdded MethodType = "DOMStorage.domStorageItemAdded"
@ -288,6 +289,7 @@ const (
CommandDOMSnapshotGetSnapshot MethodType = "DOMSnapshot.getSnapshot" CommandDOMSnapshotGetSnapshot MethodType = "DOMSnapshot.getSnapshot"
CommandIORead MethodType = "IO.read" CommandIORead MethodType = "IO.read"
CommandIOClose MethodType = "IO.close" CommandIOClose MethodType = "IO.close"
CommandIOResolveBlob MethodType = "IO.resolveBlob"
CommandDOMDebuggerSetDOMBreakpoint MethodType = "DOMDebugger.setDOMBreakpoint" CommandDOMDebuggerSetDOMBreakpoint MethodType = "DOMDebugger.setDOMBreakpoint"
CommandDOMDebuggerRemoveDOMBreakpoint MethodType = "DOMDebugger.removeDOMBreakpoint" CommandDOMDebuggerRemoveDOMBreakpoint MethodType = "DOMDebugger.removeDOMBreakpoint"
CommandDOMDebuggerSetEventListenerBreakpoint MethodType = "DOMDebugger.setEventListenerBreakpoint" CommandDOMDebuggerSetEventListenerBreakpoint MethodType = "DOMDebugger.setEventListenerBreakpoint"
@ -770,6 +772,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandCacheStorageDeleteCache *t = CommandCacheStorageDeleteCache
case CommandCacheStorageDeleteEntry: case CommandCacheStorageDeleteEntry:
*t = CommandCacheStorageDeleteEntry *t = CommandCacheStorageDeleteEntry
case CommandCacheStorageRequestCachedResponse:
*t = CommandCacheStorageRequestCachedResponse
case EventDOMStorageDomStorageItemsCleared: case EventDOMStorageDomStorageItemsCleared:
*t = EventDOMStorageDomStorageItemsCleared *t = EventDOMStorageDomStorageItemsCleared
case EventDOMStorageDomStorageItemRemoved: case EventDOMStorageDomStorageItemRemoved:
@ -960,6 +964,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandIORead *t = CommandIORead
case CommandIOClose: case CommandIOClose:
*t = CommandIOClose *t = CommandIOClose
case CommandIOResolveBlob:
*t = CommandIOResolveBlob
case CommandDOMDebuggerSetDOMBreakpoint: case CommandDOMDebuggerSetDOMBreakpoint:
*t = CommandDOMDebuggerSetDOMBreakpoint *t = CommandDOMDebuggerSetDOMBreakpoint
case CommandDOMDebuggerRemoveDOMBreakpoint: case CommandDOMDebuggerRemoveDOMBreakpoint:
@ -1442,6 +1448,7 @@ type Frame struct {
URL string `json:"url"` // Frame document's URL. URL string `json:"url"` // Frame document's URL.
SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin. SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin.
MimeType string `json:"mimeType"` // Frame document's mimeType as determined by the browser. MimeType string `json:"mimeType"` // Frame document's mimeType as determined by the browser.
UnreachableURL string `json:"unreachableUrl,omitempty"` // If the frame failed to load, this contains the URL that could not be loaded.
State FrameState `json:"-"` // Frame state. State FrameState `json:"-"` // Frame state.
Root *Node `json:"-"` // Frame document root. Root *Node `json:"-"` // Frame document root.
Nodes map[NodeID]*Node `json:"-"` // Frame nodes. Nodes map[NodeID]*Node `json:"-"` // Frame nodes.

View File

@ -482,6 +482,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandCacheStorageDeleteEntry: case cdp.CommandCacheStorageDeleteEntry:
return emptyVal, nil return emptyVal, nil
case cdp.CommandCacheStorageRequestCachedResponse:
v = new(cachestorage.RequestCachedResponseReturns)
case cdp.CommandDOMStorageEnable: case cdp.CommandDOMStorageEnable:
return emptyVal, nil return emptyVal, nil
@ -767,6 +770,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandIOClose: case cdp.CommandIOClose:
return emptyVal, nil return emptyVal, nil
case cdp.CommandIOResolveBlob:
v = new(iodom.ResolveBlobReturns)
case cdp.CommandDOMDebuggerSetDOMBreakpoint: case cdp.CommandDOMDebuggerSetDOMBreakpoint:
return emptyVal, nil return emptyVal, nil

View File

@ -910,6 +910,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Frame
out.SecurityOrigin = string(in.String()) out.SecurityOrigin = string(in.String())
case "mimeType": case "mimeType":
out.MimeType = string(in.String()) out.MimeType = string(in.String())
case "unreachableUrl":
out.UnreachableURL = string(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -970,6 +972,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram
first = false first = false
out.RawString("\"mimeType\":") out.RawString("\"mimeType\":")
out.String(string(in.MimeType)) out.String(string(in.MimeType))
if in.UnreachableURL != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"unreachableUrl\":")
out.String(string(in.UnreachableURL))
}
out.RawByte('}') out.RawByte('}')
} }

View File

@ -489,8 +489,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, o
out.DeviceScaleFactor = float64(in.Float64()) out.DeviceScaleFactor = float64(in.Float64())
case "mobile": case "mobile":
out.Mobile = bool(in.Bool()) out.Mobile = bool(in.Bool())
case "fitWindow":
out.FitWindow = bool(in.Bool())
case "scale": case "scale":
out.Scale = float64(in.Float64()) out.Scale = float64(in.Float64())
case "screenWidth": case "screenWidth":
@ -501,6 +499,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, o
out.PositionX = int64(in.Int64()) out.PositionX = int64(in.Int64())
case "positionY": case "positionY":
out.PositionY = int64(in.Int64()) out.PositionY = int64(in.Int64())
case "dontSetVisibleSize":
out.DontSetVisibleSize = bool(in.Bool())
case "screenOrientation": case "screenOrientation":
if in.IsNull() { if in.IsNull() {
in.Skip() in.Skip()
@ -549,14 +549,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer
first = false first = false
out.RawString("\"mobile\":") out.RawString("\"mobile\":")
out.Bool(bool(in.Mobile)) out.Bool(bool(in.Mobile))
if in.FitWindow {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"fitWindow\":")
out.Bool(bool(in.FitWindow))
}
if in.Scale != 0 { if in.Scale != 0 {
if !first { if !first {
out.RawByte(',') out.RawByte(',')
@ -597,6 +589,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer
out.RawString("\"positionY\":") out.RawString("\"positionY\":")
out.Int64(int64(in.PositionY)) out.Int64(int64(in.PositionY))
} }
if in.DontSetVisibleSize {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"dontSetVisibleSize\":")
out.Bool(bool(in.DontSetVisibleSize))
}
if in.ScreenOrientation != nil { if in.ScreenOrientation != nil {
if !first { if !first {
out.RawByte(',') out.RawByte(',')

View File

@ -23,12 +23,12 @@ type SetDeviceMetricsOverrideParams struct {
Height int64 `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. Height int64 `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override. DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override.
Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more. Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
FitWindow bool `json:"fitWindow,omitempty"` // Whether a view that exceeds the available browser window area should be scaled down to fit.
Scale float64 `json:"scale,omitempty"` // Scale to apply to resulting view image. Ignored in |fitWindow| mode. Scale float64 `json:"scale,omitempty"` // Scale to apply to resulting view image. Ignored in |fitWindow| mode.
ScreenWidth int64 `json:"screenWidth,omitempty"` // Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. ScreenWidth int64 `json:"screenWidth,omitempty"` // Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
ScreenHeight int64 `json:"screenHeight,omitempty"` // Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. ScreenHeight int64 `json:"screenHeight,omitempty"` // Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
PositionX int64 `json:"positionX,omitempty"` // Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. PositionX int64 `json:"positionX,omitempty"` // Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
PositionY int64 `json:"positionY,omitempty"` // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. PositionY int64 `json:"positionY,omitempty"` // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
DontSetVisibleSize bool `json:"dontSetVisibleSize,omitempty"` // Do not set visible view size, rely upon explicit setVisibleSize call.
ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override. ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override.
} }
@ -51,13 +51,6 @@ func SetDeviceMetricsOverride(width int64, height int64, deviceScaleFactor float
} }
} }
// WithFitWindow whether a view that exceeds the available browser window
// area should be scaled down to fit.
func (p SetDeviceMetricsOverrideParams) WithFitWindow(fitWindow bool) *SetDeviceMetricsOverrideParams {
p.FitWindow = fitWindow
return &p
}
// WithScale scale to apply to resulting view image. Ignored in |fitWindow| // WithScale scale to apply to resulting view image. Ignored in |fitWindow|
// mode. // mode.
func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams { func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams {
@ -93,6 +86,13 @@ func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDevic
return &p return &p
} }
// WithDontSetVisibleSize do not set visible view size, rely upon explicit
// setVisibleSize call.
func (p SetDeviceMetricsOverrideParams) WithDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideParams {
p.DontSetVisibleSize = dontSetVisibleSize
return &p
}
// WithScreenOrientation screen orientation override. // WithScreenOrientation screen orientation override.
func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams { func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams {
p.ScreenOrientation = screenOrientation p.ScreenOrientation = screenOrientation

View File

@ -4,6 +4,7 @@ package io
import ( import (
json "encoding/json" json "encoding/json"
runtime "github.com/knq/chromedp/cdp/runtime"
easyjson "github.com/mailru/easyjson" easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
@ -17,7 +18,143 @@ var (
_ easyjson.Marshaler _ easyjson.Marshaler
) )
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *ReadReturns) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *ResolveBlobReturns) {
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 "uuid":
out.UUID = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ResolveBlobReturns) {
out.RawByte('{')
first := true
_ = first
if in.UUID != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"uuid\":")
out.String(string(in.UUID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ResolveBlobReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResolveBlobReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResolveBlobReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResolveBlobReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *ResolveBlobParams) {
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 "objectId":
out.ObjectID = runtime.RemoteObjectID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ResolveBlobParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"objectId\":")
out.String(string(in.ObjectID))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ResolveBlobParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResolveBlobParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResolveBlobParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResolveBlobParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *ReadReturns) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -50,7 +187,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *Read
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ReadReturns) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in ReadReturns) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -76,27 +213,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in Rea
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ReadReturns) MarshalJSON() ([]byte, error) { func (v ReadReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&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 ReadReturns) MarshalEasyJSON(w *jwriter.Writer) { func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ReadReturns) UnmarshalJSON(data []byte) error { func (v *ReadReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ReadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ReadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *ReadParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(in *jlexer.Lexer, out *ReadParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -131,7 +268,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *Rea
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(out *jwriter.Writer, in ReadParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -163,27 +300,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in Re
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ReadParams) MarshalJSON() ([]byte, error) { func (v ReadParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(&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 ReadParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ReadParams) UnmarshalJSON(data []byte) error { func (v *ReadParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *CloseParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(in *jlexer.Lexer, out *CloseParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -214,7 +351,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *Clo
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in CloseParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(out *jwriter.Writer, in CloseParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -230,23 +367,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in Cl
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v CloseParams) MarshalJSON() ([]byte, error) { func (v CloseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(&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 CloseParams) MarshalEasyJSON(w *jwriter.Writer) { func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *CloseParams) UnmarshalJSON(data []byte) error { func (v *CloseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(l, v)
} }

View File

@ -12,6 +12,7 @@ import (
"context" "context"
cdp "github.com/knq/chromedp/cdp" cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
) )
// ReadParams read a chunk of the stream. // ReadParams read a chunk of the stream.
@ -88,3 +89,40 @@ func Close(handle StreamHandle) *CloseParams {
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) { func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIOClose, p, nil) return h.Execute(ctxt, cdp.CommandIOClose, p, nil)
} }
// ResolveBlobParams return UUID of Blob object specified by a remote object
// id.
type ResolveBlobParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Object id of a Blob object wrapper.
}
// ResolveBlob return UUID of Blob object specified by a remote object id.
//
// parameters:
// objectID - Object id of a Blob object wrapper.
func ResolveBlob(objectID runtime.RemoteObjectID) *ResolveBlobParams {
return &ResolveBlobParams{
ObjectID: objectID,
}
}
// ResolveBlobReturns return values.
type ResolveBlobReturns struct {
UUID string `json:"uuid,omitempty"` // UUID of the specified Blob.
}
// Do executes IO.resolveBlob against the provided context and
// target handler.
//
// returns:
// uuid - UUID of the specified Blob.
func (p *ResolveBlobParams) Do(ctxt context.Context, h cdp.Handler) (uuid string, err error) {
// execute
var res ResolveBlobReturns
err = h.Execute(ctxt, cdp.CommandIOResolveBlob, p, &res)
if err != nil {
return "", err
}
return res.UUID, nil
}

View File

@ -1473,6 +1473,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage17(in *jlexer.Lexer, out *
out.MarginRight = float64(in.Float64()) out.MarginRight = float64(in.Float64())
case "pageRanges": case "pageRanges":
out.PageRanges = string(in.String()) out.PageRanges = string(in.String())
case "ignoreInvalidPageRanges":
out.IgnoreInvalidPageRanges = bool(in.Bool())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -1575,6 +1577,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage17(out *jwriter.Writer, in
out.RawString("\"pageRanges\":") out.RawString("\"pageRanges\":")
out.String(string(in.PageRanges)) out.String(string(in.PageRanges))
} }
if in.IgnoreInvalidPageRanges {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"ignoreInvalidPageRanges\":")
out.Bool(bool(in.IgnoreInvalidPageRanges))
}
out.RawByte('}') out.RawByte('}')
} }

View File

@ -522,6 +522,7 @@ type PrintToPDFParams struct {
MarginLeft float64 `json:"marginLeft,omitempty"` // Left margin in inches. Defaults to 1cm (~0.4 inches). MarginLeft float64 `json:"marginLeft,omitempty"` // Left margin in inches. Defaults to 1cm (~0.4 inches).
MarginRight float64 `json:"marginRight,omitempty"` // Right margin in inches. Defaults to 1cm (~0.4 inches). MarginRight float64 `json:"marginRight,omitempty"` // Right margin in inches. Defaults to 1cm (~0.4 inches).
PageRanges string `json:"pageRanges,omitempty"` // Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. PageRanges string `json:"pageRanges,omitempty"` // Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
IgnoreInvalidPageRanges bool `json:"ignoreInvalidPageRanges,omitempty"` // Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
} }
// PrintToPDF print page as PDF. // PrintToPDF print page as PDF.
@ -598,6 +599,13 @@ func (p PrintToPDFParams) WithPageRanges(pageRanges string) *PrintToPDFParams {
return &p return &p
} }
// WithIgnoreInvalidPageRanges whether to silently ignore invalid but
// successfully parsed page ranges, such as '3-2'. Defaults to false.
func (p PrintToPDFParams) WithIgnoreInvalidPageRanges(ignoreInvalidPageRanges bool) *PrintToPDFParams {
p.IgnoreInvalidPageRanges = ignoreInvalidPageRanges
return &p
}
// PrintToPDFReturns return values. // PrintToPDFReturns return values.
type PrintToPDFReturns struct { type PrintToPDFReturns struct {
Data string `json:"data,omitempty"` // Base64-encoded pdf data. Data string `json:"data,omitempty"` // Base64-encoded pdf data.

View File

@ -356,10 +356,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "targetId":
out.TargetID = ID(in.String())
case "message": case "message":
out.Message = string(in.String()) out.Message = string(in.String())
case "sessionId":
out.SessionID = SessionID(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -378,14 +378,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(out *jwriter.Writer, i
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"targetId\":") out.RawString("\"message\":")
out.String(string(in.TargetID)) out.String(string(in.Message))
if in.SessionID != "" {
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"message\":") out.RawString("\"sessionId\":")
out.String(string(in.Message)) out.String(string(in.SessionID))
}
out.RawByte('}') out.RawByte('}')
} }
@ -1150,8 +1152,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget14(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "targetId": case "sessionId":
out.TargetID = ID(in.String()) out.SessionID = SessionID(in.String())
case "message": case "message":
out.Message = string(in.String()) out.Message = string(in.String())
default: default:
@ -1172,8 +1174,8 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget14(out *jwriter.Writer,
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"targetId\":") out.RawString("\"sessionId\":")
out.String(string(in.TargetID)) out.String(string(in.SessionID))
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }
@ -1225,8 +1227,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget15(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "targetId": case "sessionId":
out.TargetID = ID(in.String()) out.SessionID = SessionID(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -1245,8 +1247,8 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget15(out *jwriter.Writer,
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"targetId\":") out.RawString("\"sessionId\":")
out.String(string(in.TargetID)) out.String(string(in.SessionID))
out.RawByte('}') out.RawByte('}')
} }
@ -1292,6 +1294,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget16(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "sessionId":
out.SessionID = SessionID(in.String())
case "targetInfo": case "targetInfo":
if in.IsNull() { if in.IsNull() {
in.Skip() in.Skip()
@ -1322,6 +1326,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget16(out *jwriter.Writer,
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"sessionId\":")
out.String(string(in.SessionID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"targetInfo\":") out.RawString("\"targetInfo\":")
if in.TargetInfo == nil { if in.TargetInfo == nil {
out.RawString("null") out.RawString("null")
@ -1515,8 +1525,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget19(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "targetId": case "sessionId":
out.TargetID = ID(in.String()) out.SessionID = SessionID(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -1531,12 +1541,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget19(out *jwriter.Writer,
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
if in.SessionID != "" {
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"targetId\":") out.RawString("\"sessionId\":")
out.String(string(in.TargetID)) out.String(string(in.SessionID))
}
out.RawByte('}') out.RawByte('}')
} }
@ -2012,8 +2024,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget26(in *jlexer.Lexer, out
continue continue
} }
switch key { switch key {
case "success": case "sessionId":
out.Success = bool(in.Bool()) out.SessionID = SessionID(in.String())
default: default:
in.SkipRecursive() in.SkipRecursive()
} }
@ -2028,13 +2040,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget26(out *jwriter.Writer,
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
if in.Success { if in.SessionID != "" {
if !first { if !first {
out.RawByte(',') out.RawByte(',')
} }
first = false first = false
out.RawString("\"success\":") out.RawString("\"sessionId\":")
out.Bool(bool(in.Success)) out.String(string(in.SessionID))
} }
out.RawByte('}') out.RawByte('}')
} }

View File

@ -25,20 +25,22 @@ type EventTargetDestroyed struct {
// EventAttachedToTarget issued when attached to target because of // EventAttachedToTarget issued when attached to target because of
// auto-attach or attachToTarget command. // auto-attach or attachToTarget command.
type EventAttachedToTarget struct { type EventAttachedToTarget struct {
SessionID SessionID `json:"sessionId"` // Identifier assigned to the session used to send/receive messages.
TargetInfo *Info `json:"targetInfo"` TargetInfo *Info `json:"targetInfo"`
WaitingForDebugger bool `json:"waitingForDebugger"` WaitingForDebugger bool `json:"waitingForDebugger"`
} }
// EventDetachedFromTarget issued when detached from target for any reason // EventDetachedFromTarget issued when detached from target for any reason
// (including detachFromTarget command). // (including detachFromTarget command). Can be issued multiple times per target
// if multiple sessions have been attached to it.
type EventDetachedFromTarget struct { type EventDetachedFromTarget struct {
TargetID ID `json:"targetId"` SessionID SessionID `json:"sessionId"` // Detached session identifier.
} }
// EventReceivedMessageFromTarget notifies about new protocol message from // EventReceivedMessageFromTarget notifies about a new protocol message
// attached target. // received from the session (as reported in attachedToTarget event).
type EventReceivedMessageFromTarget struct { type EventReceivedMessageFromTarget struct {
TargetID ID `json:"targetId"` SessionID SessionID `json:"sessionId"` // Identifier of a session which sends a message.
Message string `json:"message"` Message string `json:"message"`
} }

View File

@ -111,25 +111,29 @@ func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err
return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil) return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil)
} }
// SendMessageToTargetParams sends protocol message to the target with given // SendMessageToTargetParams sends protocol message over session with given
// id. // id.
type SendMessageToTargetParams struct { type SendMessageToTargetParams struct {
TargetID ID `json:"targetId"`
Message string `json:"message"` Message string `json:"message"`
SessionID SessionID `json:"sessionId,omitempty"` // Identifier of the session.
} }
// SendMessageToTarget sends protocol message to the target with given id. // SendMessageToTarget sends protocol message over session with given id.
// //
// parameters: // parameters:
// targetID
// message // message
func SendMessageToTarget(targetID ID, message string) *SendMessageToTargetParams { func SendMessageToTarget(message string) *SendMessageToTargetParams {
return &SendMessageToTargetParams{ return &SendMessageToTargetParams{
TargetID: targetID,
Message: message, Message: message,
} }
} }
// WithSessionID identifier of the session.
func (p SendMessageToTargetParams) WithSessionID(sessionID SessionID) *SendMessageToTargetParams {
p.SessionID = sessionID
return &p
}
// Do executes Target.sendMessageToTarget against the provided context and // Do executes Target.sendMessageToTarget against the provided context and
// target handler. // target handler.
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) { func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
@ -248,38 +252,41 @@ func AttachToTarget(targetID ID) *AttachToTargetParams {
// AttachToTargetReturns return values. // AttachToTargetReturns return values.
type AttachToTargetReturns struct { type AttachToTargetReturns struct {
Success bool `json:"success,omitempty"` // Whether attach succeeded. SessionID SessionID `json:"sessionId,omitempty"` // Id assigned to the session.
} }
// Do executes Target.attachToTarget against the provided context and // Do executes Target.attachToTarget against the provided context and
// target handler. // target handler.
// //
// returns: // returns:
// success - Whether attach succeeded. // sessionID - Id assigned to the session.
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) { func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (sessionID SessionID, err error) {
// execute // execute
var res AttachToTargetReturns var res AttachToTargetReturns
err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res) err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res)
if err != nil { if err != nil {
return false, err return "", err
} }
return res.Success, nil return res.SessionID, nil
} }
// DetachFromTargetParams detaches from the target with given id. // DetachFromTargetParams detaches session with given id.
type DetachFromTargetParams struct { type DetachFromTargetParams struct {
TargetID ID `json:"targetId"` SessionID SessionID `json:"sessionId,omitempty"` // Session to detach.
} }
// DetachFromTarget detaches from the target with given id. // DetachFromTarget detaches session with given id.
// //
// parameters: // parameters:
// targetID func DetachFromTarget() *DetachFromTargetParams {
func DetachFromTarget(targetID ID) *DetachFromTargetParams { return &DetachFromTargetParams{}
return &DetachFromTargetParams{ }
TargetID: targetID,
} // WithSessionID session to detach.
func (p DetachFromTargetParams) WithSessionID(sessionID SessionID) *DetachFromTargetParams {
p.SessionID = sessionID
return &p
} }
// Do executes Target.detachFromTarget against the provided context and // Do executes Target.detachFromTarget against the provided context and

View File

@ -10,6 +10,14 @@ func (t ID) String() string {
return string(t) return string(t)
} }
// SessionID unique identifier of attached debugging session.
type SessionID string
// String returns the SessionID as string value.
func (t SessionID) String() string {
return string(t)
}
// BrowserContextID [no description]. // BrowserContextID [no description].
type BrowserContextID string type BrowserContextID string

View File

@ -167,6 +167,13 @@
"name": "mimeType", "name": "mimeType",
"type": "string", "type": "string",
"description": "Frame document's mimeType as determined by the browser." "description": "Frame document's mimeType as determined by the browser."
},
{
"name": "unreachableUrl",
"type": "string",
"optional": true,
"experimental": true,
"description": "If the frame failed to load, this contains the URL that could not be loaded."
} }
] ]
}, },
@ -842,30 +849,12 @@
"type": "boolean", "type": "boolean",
"description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more." "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more."
}, },
{
"name": "fitWindow",
"type": "boolean",
"optional": true,
"description": "Whether a view that exceeds the available browser window area should be scaled down to fit."
},
{ {
"name": "scale", "name": "scale",
"type": "number", "type": "number",
"optional": true, "optional": true,
"description": "Scale to apply to resulting view image. Ignored in |fitWindow| mode." "description": "Scale to apply to resulting view image. Ignored in |fitWindow| mode."
}, },
{
"name": "offsetX",
"type": "number",
"optional": true,
"description": "X offset to shift resulting view image by. Ignored in |fitWindow| mode."
},
{
"name": "offsetY",
"type": "number",
"optional": true,
"description": "Y offset to shift resulting view image by. Ignored in |fitWindow| mode."
},
{ {
"name": "screenWidth", "name": "screenWidth",
"type": "integer", "type": "integer",
@ -890,6 +879,12 @@
"optional": true, "optional": true,
"description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|." "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|."
}, },
{
"name": "dontSetVisibleSize",
"type": "boolean",
"optional": true,
"description": "Do not set visible view size, rely upon explicit setVisibleSize call."
},
{ {
"name": "screenOrientation", "name": "screenOrientation",
"$ref": "Emulation.ScreenOrientation", "$ref": "Emulation.ScreenOrientation",
@ -1101,6 +1096,12 @@
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages." "description": "Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages."
},
{
"name": "ignoreInvalidPageRanges",
"type": "boolean",
"optional": true,
"description": "Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false."
} }
], ],
"returns": [ "returns": [
@ -1939,35 +1940,12 @@
"type": "boolean", "type": "boolean",
"description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more." "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more."
}, },
{
"name": "fitWindow",
"type": "boolean",
"optional": true,
"description": "Whether a view that exceeds the available browser window area should be scaled down to fit."
},
{ {
"name": "scale", "name": "scale",
"type": "number", "type": "number",
"optional": true, "optional": true,
"experimental": true,
"description": "Scale to apply to resulting view image. Ignored in |fitWindow| mode." "description": "Scale to apply to resulting view image. Ignored in |fitWindow| mode."
}, },
{
"name": "offsetX",
"type": "number",
"optional": true,
"deprecated": true,
"experimental": true,
"description": "Not used."
},
{
"name": "offsetY",
"type": "number",
"optional": true,
"deprecated": true,
"experimental": true,
"description": "Not used."
},
{ {
"name": "screenWidth", "name": "screenWidth",
"type": "integer", "type": "integer",
@ -1996,6 +1974,13 @@
"experimental": true, "experimental": true,
"description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|." "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|."
}, },
{
"name": "dontSetVisibleSize",
"type": "boolean",
"optional": true,
"experimental": true,
"description": "Do not set visible view size, rely upon explicit setVisibleSize call."
},
{ {
"name": "screenOrientation", "name": "screenOrientation",
"$ref": "ScreenOrientation", "$ref": "ScreenOrientation",
@ -2027,7 +2012,7 @@
}, },
{ {
"name": "setVisibleSize", "name": "setVisibleSize",
"description": "Deprecated, does nothing. Please use setDeviceMetricsOverride instead.", "description": "Resizes the frame/viewport of the page. Note that this does not affect the frame's container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android.",
"experimental": true, "experimental": true,
"deprecated": true, "deprecated": true,
"parameters": [ "parameters": [
@ -4585,6 +4570,23 @@
"description": "The name of the cache." "description": "The name of the cache."
} }
] ]
},
{
"id": "CachedResponse",
"type": "object",
"description": "Cached response",
"properties": [
{
"name": "headers",
"type": "object",
"description": "Response headers"
},
{
"name": "body",
"type": "string",
"description": "Entry content, base64-encoded."
}
]
} }
], ],
"commands": [ "commands": [
@ -4671,6 +4673,29 @@
} }
], ],
"description": "Deletes a cache entry." "description": "Deletes a cache entry."
},
{
"name": "requestCachedResponse",
"parameters": [
{
"name": "cacheId",
"$ref": "CacheId",
"description": "Id of cache that contains the enty."
},
{
"name": "requestURL",
"type": "string",
"description": "URL spec of the request."
}
],
"returns": [
{
"name": "response",
"$ref": "CachedResponse",
"description": "Response read from the cache."
}
],
"description": "Fetches cache entry."
} }
] ]
}, },
@ -7804,6 +7829,9 @@
{ {
"domain": "IO", "domain": "IO",
"description": "Input/Output operations for streams produced by DevTools.", "description": "Input/Output operations for streams produced by DevTools.",
"dependencies": [
"Runtime"
],
"experimental": true, "experimental": true,
"types": [ "types": [
{ {
@ -7857,6 +7885,24 @@
"description": "Handle of the stream to close." "description": "Handle of the stream to close."
} }
] ]
},
{
"name": "resolveBlob",
"parameters": [
{
"name": "objectId",
"$ref": "Runtime.RemoteObjectId",
"description": "Object id of a Blob object wrapper."
}
],
"returns": [
{
"name": "uuid",
"type": "string",
"description": "UUID of the specified Blob."
}
],
"description": "Return UUID of Blob object specified by a remote object id."
} }
] ]
}, },
@ -8102,6 +8148,11 @@
"id": "TargetID", "id": "TargetID",
"type": "string" "type": "string"
}, },
{
"id": "SessionID",
"type": "string",
"description": "Unique identifier of attached debugging session."
},
{ {
"id": "BrowserContextID", "id": "BrowserContextID",
"type": "string" "type": "string"
@ -8202,15 +8253,24 @@
}, },
{ {
"name": "sendMessageToTarget", "name": "sendMessageToTarget",
"description": "Sends protocol message to the target with given id.", "description": "Sends protocol message over session with given id.",
"parameters": [ "parameters": [
{
"name": "targetId",
"$ref": "TargetID"
},
{ {
"name": "message", "name": "message",
"type": "string" "type": "string"
},
{
"name": "sessionId",
"$ref": "SessionID",
"optional": true,
"description": "Identifier of the session."
},
{
"name": "targetId",
"$ref": "TargetID",
"optional": true,
"deprecated": true,
"description": "Deprecated."
} }
] ]
}, },
@ -8267,19 +8327,28 @@
], ],
"returns": [ "returns": [
{ {
"name": "success", "name": "sessionId",
"type": "boolean", "$ref": "SessionID",
"description": "Whether attach succeeded." "description": "Id assigned to the session."
} }
] ]
}, },
{ {
"name": "detachFromTarget", "name": "detachFromTarget",
"description": "Detaches from the target with given id.", "description": "Detaches session with given id.",
"parameters": [ "parameters": [
{
"name": "sessionId",
"$ref": "SessionID",
"optional": true,
"description": "Session to detach."
},
{ {
"name": "targetId", "name": "targetId",
"$ref": "TargetID" "$ref": "TargetID",
"optional": true,
"deprecated": true,
"description": "Deprecated."
} }
] ]
}, },
@ -8396,6 +8465,11 @@
"name": "attachedToTarget", "name": "attachedToTarget",
"description": "Issued when attached to target because of auto-attach or <code>attachToTarget</code> command.", "description": "Issued when attached to target because of auto-attach or <code>attachToTarget</code> command.",
"parameters": [ "parameters": [
{
"name": "sessionId",
"$ref": "SessionID",
"description": "Identifier assigned to the session used to send/receive messages."
},
{ {
"name": "targetInfo", "name": "targetInfo",
"$ref": "TargetInfo" "$ref": "TargetInfo"
@ -8408,25 +8482,41 @@
}, },
{ {
"name": "detachedFromTarget", "name": "detachedFromTarget",
"description": "Issued when detached from target for any reason (including <code>detachFromTarget</code> command).", "description": "Issued when detached from target for any reason (including <code>detachFromTarget</code> command). Can be issued multiple times per target if multiple sessions have been attached to it.",
"parameters": [ "parameters": [
{
"name": "sessionId",
"$ref": "SessionID",
"description": "Detached session identifier."
},
{ {
"name": "targetId", "name": "targetId",
"$ref": "TargetID" "$ref": "TargetID",
"optional": true,
"deprecated": true,
"description": "Deprecated."
} }
] ]
}, },
{ {
"name": "receivedMessageFromTarget", "name": "receivedMessageFromTarget",
"description": "Notifies about new protocol message from attached target.", "description": "Notifies about a new protocol message received from the session (as reported in <code>attachedToTarget</code> event).",
"parameters": [ "parameters": [
{ {
"name": "targetId", "name": "sessionId",
"$ref": "TargetID" "$ref": "SessionID",
"description": "Identifier of a session which sends a message."
}, },
{ {
"name": "message", "name": "message",
"type": "string" "type": "string"
},
{
"name": "targetId",
"$ref": "TargetID",
"optional": true,
"deprecated": true,
"description": "Deprecated."
} }
] ]
} }