Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-09-03 08:15:59 +07:00
parent 4e57103faa
commit 89b40f20af
10 changed files with 498 additions and 119 deletions

View File

@ -1,7 +1,7 @@
language: go
go:
- 1.7
- 1.8
- 1.9
- tip
addons:
apt:

View File

@ -559,7 +559,82 @@ func (v *RequestCacheNamesParams) UnmarshalJSON(data []byte) error {
func (v *RequestCacheNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *DeleteEntryParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer, out *Header) {
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 "name":
out.Name = string(in.String())
case "value":
out.Value = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in Header) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"name\":")
out.String(string(in.Name))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"value\":")
out.String(string(in.Value))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Header) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Header) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Header) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Header) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *DeleteEntryParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -592,7 +667,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(in *jlexer.Lexer
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Writer, in DeleteEntryParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in DeleteEntryParams) {
out.RawByte('{')
first := true
_ = first
@ -614,27 +689,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface
func (v DeleteEntryParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DeleteEntryParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage6(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DeleteEntryParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DeleteEntryParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage6(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer, out *DeleteCacheParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(in *jlexer.Lexer, out *DeleteCacheParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -665,7 +740,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(in *jlexer.Lexer
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Writer, in DeleteCacheParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(out *jwriter.Writer, in DeleteCacheParams) {
out.RawByte('{')
first := true
_ = first
@ -681,27 +756,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface
func (v DeleteCacheParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DeleteCacheParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage7(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DeleteCacheParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DeleteCacheParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage7(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(in *jlexer.Lexer, out *DataEntry) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(in *jlexer.Lexer, out *DataEntry) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -720,12 +795,78 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(in *jlexer.Lexer
continue
}
switch key {
case "request":
out.Request = string(in.String())
case "response":
out.Response = string(in.String())
case "requestURL":
out.RequestURL = string(in.String())
case "requestMethod":
out.RequestMethod = string(in.String())
case "requestHeaders":
if in.IsNull() {
in.Skip()
out.RequestHeaders = nil
} else {
in.Delim('[')
if out.RequestHeaders == nil {
if !in.IsDelim(']') {
out.RequestHeaders = make([]*Header, 0, 8)
} else {
out.RequestHeaders = []*Header{}
}
} else {
out.RequestHeaders = (out.RequestHeaders)[:0]
}
for !in.IsDelim(']') {
var v7 *Header
if in.IsNull() {
in.Skip()
v7 = nil
} else {
if v7 == nil {
v7 = new(Header)
}
(*v7).UnmarshalEasyJSON(in)
}
out.RequestHeaders = append(out.RequestHeaders, v7)
in.WantComma()
}
in.Delim(']')
}
case "responseTime":
out.ResponseTime = float64(in.Float64())
case "responseStatus":
out.ResponseStatus = int64(in.Int64())
case "responseStatusText":
out.ResponseStatusText = string(in.String())
case "responseHeaders":
if in.IsNull() {
in.Skip()
out.ResponseHeaders = nil
} else {
in.Delim('[')
if out.ResponseHeaders == nil {
if !in.IsDelim(']') {
out.ResponseHeaders = make([]*Header, 0, 8)
} else {
out.ResponseHeaders = []*Header{}
}
} else {
out.ResponseHeaders = (out.ResponseHeaders)[:0]
}
for !in.IsDelim(']') {
var v8 *Header
if in.IsNull() {
in.Skip()
v8 = nil
} else {
if v8 == nil {
v8 = new(Header)
}
(*v8).UnmarshalEasyJSON(in)
}
out.ResponseHeaders = append(out.ResponseHeaders, v8)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
@ -736,7 +877,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(in *jlexer.Lexer
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(out *jwriter.Writer, in DataEntry) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(out *jwriter.Writer, in DataEntry) {
out.RawByte('{')
first := true
_ = first
@ -744,47 +885,101 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(out *jwriter.Wri
out.RawByte(',')
}
first = false
out.RawString("\"request\":")
out.String(string(in.Request))
out.RawString("\"requestURL\":")
out.String(string(in.RequestURL))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"response\":")
out.String(string(in.Response))
out.RawString("\"requestMethod\":")
out.String(string(in.RequestMethod))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"requestHeaders\":")
if in.RequestHeaders == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v9, v10 := range in.RequestHeaders {
if v9 > 0 {
out.RawByte(',')
}
if v10 == nil {
out.RawString("null")
} else {
(*v10).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"responseTime\":")
out.Float64(float64(in.ResponseTime))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"responseStatus\":")
out.Int64(int64(in.ResponseStatus))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"responseStatusText\":")
out.String(string(in.ResponseStatusText))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"responseHeaders\":")
if in.ResponseHeaders == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v11, v12 := range in.ResponseHeaders {
if v11 > 0 {
out.RawByte(',')
}
if v12 == nil {
out.RawString("null")
} else {
(*v12).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DataEntry) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage8(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DataEntry) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage8(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(in *jlexer.Lexer, out *CachedResponse) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(in *jlexer.Lexer, out *CachedResponse) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -803,8 +998,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(in *jlexer.Lexer
continue
}
switch key {
case "headers":
(out.Headers).UnmarshalEasyJSON(in)
case "body":
out.Body = string(in.String())
default:
@ -817,7 +1010,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(in *jlexer.Lexer
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(out *jwriter.Writer, in CachedResponse) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(out *jwriter.Writer, in CachedResponse) {
out.RawByte('{')
first := true
_ = first
@ -825,12 +1018,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(out *jwriter.Wri
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('}')
@ -839,27 +1026,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(out *jwriter.Wri
// MarshalJSON supports json.Marshaler interface
func (v CachedResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CachedResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage9(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CachedResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CachedResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage9(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(in *jlexer.Lexer, out *Cache) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage11(in *jlexer.Lexer, out *Cache) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -894,7 +1081,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(in *jlexer.Lexe
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(out *jwriter.Writer, in Cache) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage11(out *jwriter.Writer, in Cache) {
out.RawByte('{')
first := true
_ = first
@ -922,23 +1109,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(out *jwriter.Wr
// MarshalJSON supports json.Marshaler interface
func (v Cache) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage11(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Cache) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage10(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCachestorage11(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Cache) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage11(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Cache) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage10(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCachestorage11(l, v)
}

View File

@ -1,7 +1,5 @@
package cachestorage
import "github.com/mailru/easyjson"
// Code generated by chromedp-gen. DO NOT EDIT.
// CacheID unique identifier of the Cache object.
@ -14,9 +12,13 @@ func (t CacheID) String() string {
// DataEntry data entry.
type DataEntry struct {
Request string `json:"request"` // Request url spec.
Response string `json:"response"` // Response status text.
RequestURL string `json:"requestURL"` // Request URL.
RequestMethod string `json:"requestMethod"` // Request method.
RequestHeaders []*Header `json:"requestHeaders"` // Request headers
ResponseTime float64 `json:"responseTime"` // Number of seconds since epoch.
ResponseStatus int64 `json:"responseStatus"` // HTTP response status code.
ResponseStatusText string `json:"responseStatusText"` // HTTP response status text.
ResponseHeaders []*Header `json:"responseHeaders"` // Response headers
}
// Cache cache identifier.
@ -26,8 +28,13 @@ type Cache struct {
CacheName string `json:"cacheName"` // The name of the cache.
}
// Header [no description].
type Header struct {
Name string `json:"name"`
Value string `json:"value"`
}
// CachedResponse cached response.
type CachedResponse struct {
Headers easyjson.RawMessage `json:"headers"`
Body string `json:"body"` // Entry content, base64-encoded.
}

View File

@ -125,6 +125,7 @@ const (
CommandOverlayHideHighlight MethodType = "Overlay.hideHighlight"
CommandOverlayGetHighlightObjectForTest MethodType = "Overlay.getHighlightObjectForTest"
EventEmulationVirtualTimeBudgetExpired MethodType = "Emulation.virtualTimeBudgetExpired"
EventEmulationVirtualTimePaused MethodType = "Emulation.virtualTimePaused"
CommandEmulationSetDeviceMetricsOverride MethodType = "Emulation.setDeviceMetricsOverride"
CommandEmulationClearDeviceMetricsOverride MethodType = "Emulation.clearDeviceMetricsOverride"
CommandEmulationResetPageScaleFactor MethodType = "Emulation.resetPageScaleFactor"
@ -652,6 +653,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandOverlayGetHighlightObjectForTest
case EventEmulationVirtualTimeBudgetExpired:
*t = EventEmulationVirtualTimeBudgetExpired
case EventEmulationVirtualTimePaused:
*t = EventEmulationVirtualTimePaused
case CommandEmulationSetDeviceMetricsOverride:
*t = CommandEmulationSetDeviceMetricsOverride
case CommandEmulationClearDeviceMetricsOverride:

View File

@ -322,6 +322,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventEmulationVirtualTimeBudgetExpired:
v = new(emulation.EventVirtualTimeBudgetExpired)
case cdp.EventEmulationVirtualTimePaused:
v = new(emulation.EventVirtualTimePaused)
case cdp.CommandSecurityEnable:
return emptyVal, nil

View File

@ -994,7 +994,74 @@ func (v *ResetPageScaleFactorParams) UnmarshalJSON(data []byte) error {
func (v *ResetPageScaleFactorParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *EventVirtualTimePaused) {
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 "virtualTimeElapsed":
out.VirtualTimeElapsed = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in EventVirtualTimePaused) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"virtualTimeElapsed\":")
out.Int64(int64(in.VirtualTimeElapsed))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventVirtualTimePaused) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventVirtualTimePaused) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventVirtualTimePaused) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventVirtualTimePaused) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1023,7 +1090,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) {
out.RawByte('{')
first := true
_ = first
@ -1033,27 +1100,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1082,7 +1149,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in ClearGeolocationOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in ClearGeolocationOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -1092,27 +1159,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1141,7 +1208,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -1151,27 +1218,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *CanEmulateReturns) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, out *CanEmulateReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1202,7 +1269,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in CanEmulateReturns) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in CanEmulateReturns) {
out.RawByte('{')
first := true
_ = first
@ -1220,27 +1287,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v CanEmulateReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, out *CanEmulateParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(in *jlexer.Lexer, out *CanEmulateParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1269,7 +1336,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in CanEmulateParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Writer, in CanEmulateParams) {
out.RawByte('{')
first := true
_ = first
@ -1279,23 +1346,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v CanEmulateParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(l, v)
}

View File

@ -6,11 +6,18 @@ import (
cdp "github.com/knq/chromedp/cdp"
)
// EventVirtualTimeBudgetExpired notification sent after the virual time
// EventVirtualTimeBudgetExpired notification sent after the virtual time
// budget for the current VirtualTimePolicy has run out.
type EventVirtualTimeBudgetExpired struct{}
// EventVirtualTimePaused notification sent after the virtual time has
// paused.
type EventVirtualTimePaused struct {
VirtualTimeElapsed int64 `json:"virtualTimeElapsed"` // The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventEmulationVirtualTimeBudgetExpired,
cdp.EventEmulationVirtualTimePaused,
}

View File

@ -3733,10 +3733,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime35(in *jlexer.Lexer, ou
continue
}
switch key {
case "objectId":
out.ObjectID = RemoteObjectID(in.String())
case "functionDeclaration":
out.FunctionDeclaration = string(in.String())
case "objectId":
out.ObjectID = RemoteObjectID(in.String())
case "arguments":
if in.IsNull() {
in.Skip()
@ -3778,6 +3778,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime35(in *jlexer.Lexer, ou
out.UserGesture = bool(in.Bool())
case "awaitPromise":
out.AwaitPromise = bool(in.Bool())
case "executionContextId":
out.ExecutionContextID = ExecutionContextID(in.Int64())
case "objectGroup":
out.ObjectGroup = string(in.String())
default:
in.SkipRecursive()
}
@ -3796,14 +3800,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime35(out *jwriter.Writer,
out.RawByte(',')
}
first = false
out.RawString("\"objectId\":")
out.String(string(in.ObjectID))
out.RawString("\"functionDeclaration\":")
out.String(string(in.FunctionDeclaration))
if in.ObjectID != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"functionDeclaration\":")
out.String(string(in.FunctionDeclaration))
out.RawString("\"objectId\":")
out.String(string(in.ObjectID))
}
if len(in.Arguments) != 0 {
if !first {
out.RawByte(',')
@ -3867,6 +3873,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime35(out *jwriter.Writer,
out.RawString("\"awaitPromise\":")
out.Bool(bool(in.AwaitPromise))
}
if in.ExecutionContextID != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"executionContextId\":")
out.Int64(int64(in.ExecutionContextID))
}
if in.ObjectGroup != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"objectGroup\":")
out.String(string(in.ObjectGroup))
}
out.RawByte('}')
}

View File

@ -177,29 +177,36 @@ func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.Handler) (result *Re
// CallFunctionOnParams calls function with given declaration on the given
// object. Object group of the result is inherited from the target object.
type CallFunctionOnParams struct {
ObjectID RemoteObjectID `json:"objectId"` // Identifier of the object to call function on.
FunctionDeclaration string `json:"functionDeclaration"` // Declaration of the function to call.
ObjectID RemoteObjectID `json:"objectId,omitempty"` // Identifier of the object to call function on. Either objectId or executionContextId should be specified.
Arguments []*CallArgument `json:"arguments,omitempty"` // Call arguments. All call arguments must belong to the same JavaScript world as the target object.
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object which should be sent by value.
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
}
// CallFunctionOn calls function with given declaration on the given object.
// Object group of the result is inherited from the target object.
//
// parameters:
// objectID - Identifier of the object to call function on.
// functionDeclaration - Declaration of the function to call.
func CallFunctionOn(objectID RemoteObjectID, functionDeclaration string) *CallFunctionOnParams {
func CallFunctionOn(functionDeclaration string) *CallFunctionOnParams {
return &CallFunctionOnParams{
ObjectID: objectID,
FunctionDeclaration: functionDeclaration,
}
}
// WithObjectID identifier of the object to call function on. Either objectId
// or executionContextId should be specified.
func (p CallFunctionOnParams) WithObjectID(objectID RemoteObjectID) *CallFunctionOnParams {
p.ObjectID = objectID
return &p
}
// WithArguments call arguments. All call arguments must belong to the same
// JavaScript world as the target object.
func (p CallFunctionOnParams) WithArguments(arguments []*CallArgument) *CallFunctionOnParams {
@ -241,6 +248,22 @@ func (p CallFunctionOnParams) WithAwaitPromise(awaitPromise bool) *CallFunctionO
return &p
}
// WithExecutionContextID specifies execution context which global object
// will be used to call function on. Either executionContextId or objectId
// should be specified.
func (p CallFunctionOnParams) WithExecutionContextID(executionContextID ExecutionContextID) *CallFunctionOnParams {
p.ExecutionContextID = executionContextID
return &p
}
// WithObjectGroup symbolic group name that can be used to release multiple
// objects. If objectGroup is not specified and objectId is, objectGroup will be
// inherited from object.
func (p CallFunctionOnParams) WithObjectGroup(objectGroup string) *CallFunctionOnParams {
p.ObjectGroup = objectGroup
return &p
}
// CallFunctionOnReturns return values.
type CallFunctionOnReturns struct {
Result *RemoteObject `json:"result,omitempty"` // Call result.

View File

@ -2304,7 +2304,19 @@
{
"name": "virtualTimeBudgetExpired",
"experimental": true,
"description": "Notification sent after the virual time budget for the current VirtualTimePolicy has run out."
"description": "Notification sent after the virtual time budget for the current VirtualTimePolicy has run out."
},
{
"name": "virtualTimePaused",
"experimental": true,
"parameters": [
{
"name": "virtualTimeElapsed",
"type": "integer",
"description": "The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled."
}
],
"description": "Notification sent after the virtual time has paused."
}
]
},
@ -4839,19 +4851,45 @@
"description": "Data entry.",
"properties": [
{
"name": "request",
"name": "requestURL",
"type": "string",
"description": "Request url spec."
"description": "Request URL."
},
{
"name": "response",
"name": "requestMethod",
"type": "string",
"description": "Response status text."
"description": "Request method."
},
{
"name": "requestHeaders",
"type": "array",
"items": {
"$ref": "Header"
},
"description": "Request headers"
},
{
"name": "responseTime",
"type": "number",
"description": "Number of seconds since epoch."
},
{
"name": "responseStatus",
"type": "integer",
"description": "HTTP response status code."
},
{
"name": "responseStatusText",
"type": "string",
"description": "HTTP response status text."
},
{
"name": "responseHeaders",
"type": "array",
"items": {
"$ref": "Header"
},
"description": "Response headers"
}
]
},
@ -4877,16 +4915,25 @@
}
]
},
{
"id": "Header",
"type": "object",
"properties": [
{
"name": "name",
"type": "string"
},
{
"name": "value",
"type": "string"
}
]
},
{
"id": "CachedResponse",
"type": "object",
"description": "Cached response",
"properties": [
{
"name": "headers",
"type": "object",
"description": "Response headers"
},
{
"name": "body",
"type": "string",
@ -12374,16 +12421,17 @@
{
"name": "callFunctionOn",
"parameters": [
{
"name": "objectId",
"$ref": "RemoteObjectId",
"description": "Identifier of the object to call function on."
},
{
"name": "functionDeclaration",
"type": "string",
"description": "Declaration of the function to call."
},
{
"name": "objectId",
"$ref": "RemoteObjectId",
"optional": true,
"description": "Identifier of the object to call function on. Either objectId or executionContextId should be specified."
},
{
"name": "arguments",
"type": "array",
@ -12425,6 +12473,18 @@
"type": "boolean",
"optional": true,
"description": "Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved."
},
{
"name": "executionContextId",
"$ref": "ExecutionContextId",
"optional": true,
"description": "Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified."
},
{
"name": "objectGroup",
"type": "string",
"optional": true,
"description": "Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object."
}
],
"returns": [