diff --git a/cdp/cachestorage/cachestorage.go b/cdp/cachestorage/cachestorage.go index 1245b03..c54b82d 100644 --- a/cdp/cachestorage/cachestorage.go +++ b/cdp/cachestorage/cachestorage.go @@ -136,3 +136,42 @@ func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams { func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) { 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 +} diff --git a/cdp/cachestorage/easyjson.go b/cdp/cachestorage/easyjson.go index b42370f..345f640 100644 --- a/cdp/cachestorage/easyjson.go +++ b/cdp/cachestorage/easyjson.go @@ -223,7 +223,163 @@ func (v *RequestEntriesParams) UnmarshalJSON(data []byte) error { func (v *RequestEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) { 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() if in.IsNull() { if isTopLevel { @@ -283,7 +439,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Writer, in RequestCacheNamesReturns) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in RequestCacheNamesReturns) { out.RawByte('{') first := true _ = first @@ -316,27 +472,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v RequestCacheNamesReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v RequestCacheNamesReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage2(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *RequestCacheNamesReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage2(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -367,7 +523,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Writer, in RequestCacheNamesParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in RequestCacheNamesParams) { out.RawByte('{') first := true _ = first @@ -383,27 +539,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v RequestCacheNamesParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v RequestCacheNamesParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage3(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage3(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -436,7 +592,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Writer, in DeleteEntryParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DeleteEntryParams) { out.RawByte('{') first := true _ = first @@ -458,27 +614,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v DeleteEntryParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage4(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage4(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -509,7 +665,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Writer, in DeleteCacheParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in DeleteCacheParams) { out.RawByte('{') first := true _ = first @@ -525,27 +681,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v DeleteCacheParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage5(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -580,7 +736,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DataEntry) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(out *jwriter.Writer, in DataEntry) { out.RawByte('{') first := true _ = first @@ -608,27 +764,102 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v DataEntry) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DataEntry) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -663,7 +894,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in Cache) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(out *jwriter.Writer, in Cache) { out.RawByte('{') first := true _ = first @@ -691,23 +922,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Wri // MarshalJSON supports json.Marshaler interface func (v Cache) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Cache) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Cache) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(l, v) } diff --git a/cdp/cachestorage/types.go b/cdp/cachestorage/types.go index 2c24645..c56a1f7 100644 --- a/cdp/cachestorage/types.go +++ b/cdp/cachestorage/types.go @@ -1,5 +1,7 @@ package cachestorage +import "github.com/mailru/easyjson" + // Code generated by chromedp-gen. DO NOT EDIT. // CacheID unique identifier of the Cache object. @@ -23,3 +25,9 @@ type Cache struct { SecurityOrigin string `json:"securityOrigin"` // Security origin 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. +} diff --git a/cdp/cdp.go b/cdp/cdp.go index faae4f2..3df01f2 100644 --- a/cdp/cdp.go +++ b/cdp/cdp.go @@ -193,6 +193,7 @@ const ( CommandCacheStorageRequestEntries MethodType = "CacheStorage.requestEntries" CommandCacheStorageDeleteCache MethodType = "CacheStorage.deleteCache" CommandCacheStorageDeleteEntry MethodType = "CacheStorage.deleteEntry" + CommandCacheStorageRequestCachedResponse MethodType = "CacheStorage.requestCachedResponse" EventDOMStorageDomStorageItemsCleared MethodType = "DOMStorage.domStorageItemsCleared" EventDOMStorageDomStorageItemRemoved MethodType = "DOMStorage.domStorageItemRemoved" EventDOMStorageDomStorageItemAdded MethodType = "DOMStorage.domStorageItemAdded" @@ -288,6 +289,7 @@ const ( CommandDOMSnapshotGetSnapshot MethodType = "DOMSnapshot.getSnapshot" CommandIORead MethodType = "IO.read" CommandIOClose MethodType = "IO.close" + CommandIOResolveBlob MethodType = "IO.resolveBlob" CommandDOMDebuggerSetDOMBreakpoint MethodType = "DOMDebugger.setDOMBreakpoint" CommandDOMDebuggerRemoveDOMBreakpoint MethodType = "DOMDebugger.removeDOMBreakpoint" CommandDOMDebuggerSetEventListenerBreakpoint MethodType = "DOMDebugger.setEventListenerBreakpoint" @@ -770,6 +772,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = CommandCacheStorageDeleteCache case CommandCacheStorageDeleteEntry: *t = CommandCacheStorageDeleteEntry + case CommandCacheStorageRequestCachedResponse: + *t = CommandCacheStorageRequestCachedResponse case EventDOMStorageDomStorageItemsCleared: *t = EventDOMStorageDomStorageItemsCleared case EventDOMStorageDomStorageItemRemoved: @@ -960,6 +964,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = CommandIORead case CommandIOClose: *t = CommandIOClose + case CommandIOResolveBlob: + *t = CommandIOResolveBlob case CommandDOMDebuggerSetDOMBreakpoint: *t = CommandDOMDebuggerSetDOMBreakpoint case CommandDOMDebuggerRemoveDOMBreakpoint: @@ -1435,16 +1441,17 @@ func (t *FrameID) UnmarshalJSON(buf []byte) error { // Frame information about the Frame on the page. type Frame struct { - ID FrameID `json:"id"` // Frame unique identifier. - ParentID FrameID `json:"parentId,omitempty"` // Parent frame identifier. - LoaderID LoaderID `json:"loaderId"` // Identifier of the loader associated with this frame. - Name string `json:"name,omitempty"` // Frame's name as specified in the tag. - URL string `json:"url"` // Frame document's URL. - SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin. - MimeType string `json:"mimeType"` // Frame document's mimeType as determined by the browser. - State FrameState `json:"-"` // Frame state. - Root *Node `json:"-"` // Frame document root. - Nodes map[NodeID]*Node `json:"-"` // Frame nodes. + ID FrameID `json:"id"` // Frame unique identifier. + ParentID FrameID `json:"parentId,omitempty"` // Parent frame identifier. + LoaderID LoaderID `json:"loaderId"` // Identifier of the loader associated with this frame. + Name string `json:"name,omitempty"` // Frame's name as specified in the tag. + URL string `json:"url"` // Frame document's URL. + SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin. + 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. + Root *Node `json:"-"` // Frame document root. + Nodes map[NodeID]*Node `json:"-"` // Frame nodes. sync.RWMutex `json:"-"` // Read write mutex. } diff --git a/cdp/cdputil/cdputil.go b/cdp/cdputil/cdputil.go index 6a2d4b9..a1beca4 100644 --- a/cdp/cdputil/cdputil.go +++ b/cdp/cdputil/cdputil.go @@ -482,6 +482,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) { case cdp.CommandCacheStorageDeleteEntry: return emptyVal, nil + case cdp.CommandCacheStorageRequestCachedResponse: + v = new(cachestorage.RequestCachedResponseReturns) + case cdp.CommandDOMStorageEnable: return emptyVal, nil @@ -767,6 +770,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) { case cdp.CommandIOClose: return emptyVal, nil + case cdp.CommandIOResolveBlob: + v = new(iodom.ResolveBlobReturns) + case cdp.CommandDOMDebuggerSetDOMBreakpoint: return emptyVal, nil diff --git a/cdp/easyjson.go b/cdp/easyjson.go index c8a346f..b5f7315 100644 --- a/cdp/easyjson.go +++ b/cdp/easyjson.go @@ -910,6 +910,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdp4(in *jlexer.Lexer, out *Frame out.SecurityOrigin = string(in.String()) case "mimeType": out.MimeType = string(in.String()) + case "unreachableUrl": + out.UnreachableURL = string(in.String()) default: in.SkipRecursive() } @@ -970,6 +972,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdp4(out *jwriter.Writer, in Fram first = false out.RawString("\"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('}') } diff --git a/cdp/emulation/easyjson.go b/cdp/emulation/easyjson.go index 7b5d7c4..9628c78 100644 --- a/cdp/emulation/easyjson.go +++ b/cdp/emulation/easyjson.go @@ -489,8 +489,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, o out.DeviceScaleFactor = float64(in.Float64()) case "mobile": out.Mobile = bool(in.Bool()) - case "fitWindow": - out.FitWindow = bool(in.Bool()) case "scale": out.Scale = float64(in.Float64()) case "screenWidth": @@ -501,6 +499,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, o out.PositionX = int64(in.Int64()) case "positionY": out.PositionY = int64(in.Int64()) + case "dontSetVisibleSize": + out.DontSetVisibleSize = bool(in.Bool()) case "screenOrientation": if in.IsNull() { in.Skip() @@ -549,14 +549,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer first = false out.RawString("\"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 !first { out.RawByte(',') @@ -597,6 +589,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer out.RawString("\"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 !first { out.RawByte(',') diff --git a/cdp/emulation/emulation.go b/cdp/emulation/emulation.go index de79e9a..db052a2 100644 --- a/cdp/emulation/emulation.go +++ b/cdp/emulation/emulation.go @@ -19,17 +19,17 @@ import ( // window.innerHeight, and "device-width"/"device-height"-related CSS media // query results). type SetDeviceMetricsOverrideParams struct { - Width int64 `json:"width"` // Overriding width 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. - 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. - 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|. - 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|. - ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override. + Width int64 `json:"width"` // Overriding width 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. + Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more. + 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|. + 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|. + 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. } // SetDeviceMetricsOverride overrides the values of device screen dimensions @@ -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| // mode. func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams { @@ -93,6 +86,13 @@ func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDevic 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. func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams { p.ScreenOrientation = screenOrientation diff --git a/cdp/io/easyjson.go b/cdp/io/easyjson.go index 0f3b820..30230bd 100644 --- a/cdp/io/easyjson.go +++ b/cdp/io/easyjson.go @@ -4,6 +4,7 @@ package io import ( json "encoding/json" + runtime "github.com/knq/chromedp/cdp/runtime" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,7 +18,143 @@ var ( _ 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() if in.IsNull() { if isTopLevel { @@ -50,7 +187,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *Read in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ReadReturns) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in ReadReturns) { out.RawByte('{') first := true _ = first @@ -76,27 +213,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in Rea // MarshalJSON supports json.Marshaler interface func (v ReadReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ReadReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -131,7 +268,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *Rea in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ReadParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(out *jwriter.Writer, in ReadParams) { out.RawByte('{') first := true _ = first @@ -163,27 +300,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in Re // MarshalJSON supports json.Marshaler interface func (v ReadParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ReadParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -214,7 +351,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *Clo in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in CloseParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(out *jwriter.Writer, in CloseParams) { out.RawByte('{') first := true _ = first @@ -230,23 +367,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in Cl // MarshalJSON supports json.Marshaler interface func (v CloseParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CloseParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(l, v) } diff --git a/cdp/io/io.go b/cdp/io/io.go index 30db0df..19f65fd 100644 --- a/cdp/io/io.go +++ b/cdp/io/io.go @@ -12,6 +12,7 @@ import ( "context" cdp "github.com/knq/chromedp/cdp" + "github.com/knq/chromedp/cdp/runtime" ) // 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) { 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 +} diff --git a/cdp/page/easyjson.go b/cdp/page/easyjson.go index f891104..90d81a9 100644 --- a/cdp/page/easyjson.go +++ b/cdp/page/easyjson.go @@ -1473,6 +1473,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage17(in *jlexer.Lexer, out * out.MarginRight = float64(in.Float64()) case "pageRanges": out.PageRanges = string(in.String()) + case "ignoreInvalidPageRanges": + out.IgnoreInvalidPageRanges = bool(in.Bool()) default: in.SkipRecursive() } @@ -1575,6 +1577,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage17(out *jwriter.Writer, in out.RawString("\"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('}') } diff --git a/cdp/page/page.go b/cdp/page/page.go index 1370558..3a002c1 100644 --- a/cdp/page/page.go +++ b/cdp/page/page.go @@ -511,17 +511,18 @@ func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.Handler) (data // PrintToPDFParams print page as PDF. type PrintToPDFParams struct { - Landscape bool `json:"landscape,omitempty"` // Paper orientation. Defaults to false. - DisplayHeaderFooter bool `json:"displayHeaderFooter,omitempty"` // Display header and footer. Defaults to false. - PrintBackground bool `json:"printBackground,omitempty"` // Print background graphics. Defaults to false. - Scale float64 `json:"scale,omitempty"` // Scale of the webpage rendering. Defaults to 1. - PaperWidth float64 `json:"paperWidth,omitempty"` // Paper width in inches. Defaults to 8.5 inches. - PaperHeight float64 `json:"paperHeight,omitempty"` // Paper height in inches. Defaults to 11 inches. - MarginTop float64 `json:"marginTop,omitempty"` // Top margin in inches. Defaults to 1cm (~0.4 inches). - MarginBottom float64 `json:"marginBottom,omitempty"` // Bottom 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). - 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. + Landscape bool `json:"landscape,omitempty"` // Paper orientation. Defaults to false. + DisplayHeaderFooter bool `json:"displayHeaderFooter,omitempty"` // Display header and footer. Defaults to false. + PrintBackground bool `json:"printBackground,omitempty"` // Print background graphics. Defaults to false. + Scale float64 `json:"scale,omitempty"` // Scale of the webpage rendering. Defaults to 1. + PaperWidth float64 `json:"paperWidth,omitempty"` // Paper width in inches. Defaults to 8.5 inches. + PaperHeight float64 `json:"paperHeight,omitempty"` // Paper height in inches. Defaults to 11 inches. + MarginTop float64 `json:"marginTop,omitempty"` // Top margin in inches. Defaults to 1cm (~0.4 inches). + MarginBottom float64 `json:"marginBottom,omitempty"` // Bottom 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). + 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. @@ -598,6 +599,13 @@ func (p PrintToPDFParams) WithPageRanges(pageRanges string) *PrintToPDFParams { 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. type PrintToPDFReturns struct { Data string `json:"data,omitempty"` // Base64-encoded pdf data. diff --git a/cdp/target/easyjson.go b/cdp/target/easyjson.go index 9214d97..cad8d2d 100644 --- a/cdp/target/easyjson.go +++ b/cdp/target/easyjson.go @@ -356,10 +356,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget4(in *jlexer.Lexer, out continue } switch key { - case "targetId": - out.TargetID = ID(in.String()) case "message": out.Message = string(in.String()) + case "sessionId": + out.SessionID = SessionID(in.String()) default: in.SkipRecursive() } @@ -378,14 +378,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget4(out *jwriter.Writer, i out.RawByte(',') } first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) - if !first { - out.RawByte(',') - } - first = false out.RawString("\"message\":") out.String(string(in.Message)) + if in.SessionID != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) + } out.RawByte('}') } @@ -1150,8 +1152,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget14(in *jlexer.Lexer, out continue } switch key { - case "targetId": - out.TargetID = ID(in.String()) + case "sessionId": + out.SessionID = SessionID(in.String()) case "message": out.Message = string(in.String()) default: @@ -1172,8 +1174,8 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget14(out *jwriter.Writer, out.RawByte(',') } first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) if !first { out.RawByte(',') } @@ -1225,8 +1227,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget15(in *jlexer.Lexer, out continue } switch key { - case "targetId": - out.TargetID = ID(in.String()) + case "sessionId": + out.SessionID = SessionID(in.String()) default: in.SkipRecursive() } @@ -1245,8 +1247,8 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget15(out *jwriter.Writer, out.RawByte(',') } first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) out.RawByte('}') } @@ -1292,6 +1294,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget16(in *jlexer.Lexer, out continue } switch key { + case "sessionId": + out.SessionID = SessionID(in.String()) case "targetInfo": if in.IsNull() { in.Skip() @@ -1322,6 +1326,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget16(out *jwriter.Writer, out.RawByte(',') } first = false + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) + if !first { + out.RawByte(',') + } + first = false out.RawString("\"targetInfo\":") if in.TargetInfo == nil { out.RawString("null") @@ -1515,8 +1525,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget19(in *jlexer.Lexer, out continue } switch key { - case "targetId": - out.TargetID = ID(in.String()) + case "sessionId": + out.SessionID = SessionID(in.String()) default: in.SkipRecursive() } @@ -1531,12 +1541,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget19(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if !first { - out.RawByte(',') + if in.SessionID != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) } - first = false - out.RawString("\"targetId\":") - out.String(string(in.TargetID)) out.RawByte('}') } @@ -2012,8 +2024,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTarget26(in *jlexer.Lexer, out continue } switch key { - case "success": - out.Success = bool(in.Bool()) + case "sessionId": + out.SessionID = SessionID(in.String()) default: in.SkipRecursive() } @@ -2028,13 +2040,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTarget26(out *jwriter.Writer, out.RawByte('{') first := true _ = first - if in.Success { + if in.SessionID != "" { if !first { out.RawByte(',') } first = false - out.RawString("\"success\":") - out.Bool(bool(in.Success)) + out.RawString("\"sessionId\":") + out.String(string(in.SessionID)) } out.RawByte('}') } diff --git a/cdp/target/events.go b/cdp/target/events.go index 135aa57..434ed31 100644 --- a/cdp/target/events.go +++ b/cdp/target/events.go @@ -25,21 +25,23 @@ type EventTargetDestroyed struct { // EventAttachedToTarget issued when attached to target because of // auto-attach or attachToTarget command. type EventAttachedToTarget struct { - TargetInfo *Info `json:"targetInfo"` - WaitingForDebugger bool `json:"waitingForDebugger"` + SessionID SessionID `json:"sessionId"` // Identifier assigned to the session used to send/receive messages. + TargetInfo *Info `json:"targetInfo"` + WaitingForDebugger bool `json:"waitingForDebugger"` } // 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 { - TargetID ID `json:"targetId"` + SessionID SessionID `json:"sessionId"` // Detached session identifier. } -// EventReceivedMessageFromTarget notifies about new protocol message from -// attached target. +// EventReceivedMessageFromTarget notifies about a new protocol message +// received from the session (as reported in attachedToTarget event). type EventReceivedMessageFromTarget struct { - TargetID ID `json:"targetId"` - Message string `json:"message"` + SessionID SessionID `json:"sessionId"` // Identifier of a session which sends a message. + Message string `json:"message"` } // EventTypes all event types in the domain. diff --git a/cdp/target/target.go b/cdp/target/target.go index 01c2bd4..5c163d3 100644 --- a/cdp/target/target.go +++ b/cdp/target/target.go @@ -111,25 +111,29 @@ func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err 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. 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: -// targetID // message -func SendMessageToTarget(targetID ID, message string) *SendMessageToTargetParams { +func SendMessageToTarget(message string) *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 // target handler. func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) { @@ -248,38 +252,41 @@ func AttachToTarget(targetID ID) *AttachToTargetParams { // AttachToTargetReturns return values. 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 // target handler. // // returns: -// success - Whether attach succeeded. -func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) { +// sessionID - Id assigned to the session. +func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (sessionID SessionID, err error) { // execute var res AttachToTargetReturns err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res) 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 { - 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: -// targetID -func DetachFromTarget(targetID ID) *DetachFromTargetParams { - return &DetachFromTargetParams{ - TargetID: targetID, - } +func DetachFromTarget() *DetachFromTargetParams { + return &DetachFromTargetParams{} +} + +// 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 diff --git a/cdp/target/types.go b/cdp/target/types.go index 3dcf6ad..887ebdc 100644 --- a/cdp/target/types.go +++ b/cdp/target/types.go @@ -10,6 +10,14 @@ func (t ID) String() string { 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]. type BrowserContextID string diff --git a/cmd/chromedp-gen/protocol.json b/cmd/chromedp-gen/protocol.json index ab5ce68..e106c7d 100644 --- a/cmd/chromedp-gen/protocol.json +++ b/cmd/chromedp-gen/protocol.json @@ -167,6 +167,13 @@ "name": "mimeType", "type": "string", "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", "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", "type": "number", "optional": true, "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", "type": "integer", @@ -890,6 +879,12 @@ "optional": 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", "$ref": "Emulation.ScreenOrientation", @@ -1101,6 +1096,12 @@ "type": "string", "optional": true, "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": [ @@ -1939,35 +1940,12 @@ "type": "boolean", "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", "type": "number", "optional": true, - "experimental": true, "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", "type": "integer", @@ -1996,6 +1974,13 @@ "experimental": 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", "$ref": "ScreenOrientation", @@ -2027,7 +2012,7 @@ }, { "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, "deprecated": true, "parameters": [ @@ -4585,6 +4570,23 @@ "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": [ @@ -4671,6 +4673,29 @@ } ], "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", "description": "Input/Output operations for streams produced by DevTools.", + "dependencies": [ + "Runtime" + ], "experimental": true, "types": [ { @@ -7857,6 +7885,24 @@ "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", "type": "string" }, + { + "id": "SessionID", + "type": "string", + "description": "Unique identifier of attached debugging session." + }, { "id": "BrowserContextID", "type": "string" @@ -8202,15 +8253,24 @@ }, { "name": "sendMessageToTarget", - "description": "Sends protocol message to the target with given id.", + "description": "Sends protocol message over session with given id.", "parameters": [ - { - "name": "targetId", - "$ref": "TargetID" - }, { "name": "message", "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": [ { - "name": "success", - "type": "boolean", - "description": "Whether attach succeeded." + "name": "sessionId", + "$ref": "SessionID", + "description": "Id assigned to the session." } ] }, { "name": "detachFromTarget", - "description": "Detaches from the target with given id.", + "description": "Detaches session with given id.", "parameters": [ + { + "name": "sessionId", + "$ref": "SessionID", + "optional": true, + "description": "Session to detach." + }, { "name": "targetId", - "$ref": "TargetID" + "$ref": "TargetID", + "optional": true, + "deprecated": true, + "description": "Deprecated." } ] }, @@ -8396,6 +8465,11 @@ "name": "attachedToTarget", "description": "Issued when attached to target because of auto-attach or attachToTarget command.", "parameters": [ + { + "name": "sessionId", + "$ref": "SessionID", + "description": "Identifier assigned to the session used to send/receive messages." + }, { "name": "targetInfo", "$ref": "TargetInfo" @@ -8408,25 +8482,41 @@ }, { "name": "detachedFromTarget", - "description": "Issued when detached from target for any reason (including detachFromTarget command).", + "description": "Issued when detached from target for any reason (including detachFromTarget command). Can be issued multiple times per target if multiple sessions have been attached to it.", "parameters": [ + { + "name": "sessionId", + "$ref": "SessionID", + "description": "Detached session identifier." + }, { "name": "targetId", - "$ref": "TargetID" + "$ref": "TargetID", + "optional": true, + "deprecated": true, + "description": "Deprecated." } ] }, { "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 attachedToTarget event).", "parameters": [ { - "name": "targetId", - "$ref": "TargetID" + "name": "sessionId", + "$ref": "SessionID", + "description": "Identifier of a session which sends a message." }, { "name": "message", "type": "string" + }, + { + "name": "targetId", + "$ref": "TargetID", + "optional": true, + "deprecated": true, + "description": "Deprecated." } ] }