Updating to latest chrome protocol.json

This commit is contained in:
Kenneth Shaw 2017-01-27 10:29:53 +07:00
parent 58283934b9
commit 4ff7580243
11 changed files with 324 additions and 34 deletions

View File

@ -174,6 +174,7 @@ const (
CommandIndexedDBRequestDatabase MethodType = "IndexedDB.requestDatabase"
CommandIndexedDBRequestData MethodType = "IndexedDB.requestData"
CommandIndexedDBClearObjectStore MethodType = "IndexedDB.clearObjectStore"
CommandIndexedDBDeleteDatabase MethodType = "IndexedDB.deleteDatabase"
CommandCacheStorageRequestCacheNames MethodType = "CacheStorage.requestCacheNames"
CommandCacheStorageRequestEntries MethodType = "CacheStorage.requestEntries"
CommandCacheStorageDeleteCache MethodType = "CacheStorage.deleteCache"
@ -713,6 +714,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandIndexedDBRequestData
case CommandIndexedDBClearObjectStore:
*t = CommandIndexedDBClearObjectStore
case CommandIndexedDBDeleteDatabase:
*t = CommandIndexedDBDeleteDatabase
case CommandCacheStorageRequestCacheNames:
*t = CommandCacheStorageRequestCacheNames
case CommandCacheStorageRequestEntries:

View File

@ -1355,7 +1355,82 @@ func (v *DisableParams) UnmarshalJSON(data []byte) error {
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb12(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer, out *DatabaseWithObjectStores) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer, out *DeleteDatabaseParams) {
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 "securityOrigin":
out.SecurityOrigin = string(in.String())
case "databaseName":
out.DatabaseName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Writer, in DeleteDatabaseParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"securityOrigin\":")
out.String(string(in.SecurityOrigin))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"databaseName\":")
out.String(string(in.DatabaseName))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DeleteDatabaseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DeleteDatabaseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DeleteDatabaseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DeleteDatabaseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer, out *DatabaseWithObjectStores) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1415,7 +1490,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Writer, in DatabaseWithObjectStores) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Writer, in DatabaseWithObjectStores) {
out.RawByte('{')
first := true
_ = first
@ -1464,27 +1539,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v DatabaseWithObjectStores) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DatabaseWithObjectStores) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DatabaseWithObjectStores) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DatabaseWithObjectStores) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer, out *DataEntry) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer, out *DataEntry) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1543,7 +1618,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Writer, in DataEntry) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Writer, in DataEntry) {
out.RawByte('{')
first := true
_ = first
@ -1589,27 +1664,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v DataEntry) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DataEntry) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer, out *ClearObjectStoreParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(in *jlexer.Lexer, out *ClearObjectStoreParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1644,7 +1719,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Writer, in ClearObjectStoreParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(out *jwriter.Writer, in ClearObjectStoreParams) {
out.RawByte('{')
first := true
_ = first
@ -1672,23 +1747,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ClearObjectStoreParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearObjectStoreParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearObjectStoreParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearObjectStoreParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(l, v)
}

View File

@ -377,3 +377,58 @@ func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
return cdp.ErrUnknownResult
}
// DeleteDatabaseParams deletes a database.
type DeleteDatabaseParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
DatabaseName string `json:"databaseName"` // Database name.
}
// DeleteDatabase deletes a database.
//
// parameters:
// securityOrigin - Security origin.
// databaseName - Database name.
func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseParams {
return &DeleteDatabaseParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
}
}
// Do executes IndexedDB.deleteDatabase.
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// marshal
buf, err := easyjson.Marshal(p)
if err != nil {
return err
}
// execute
ch := h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, easyjson.RawMessage(buf))
// read response
select {
case res := <-ch:
if res == nil {
return cdp.ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return cdp.ErrContextDone
}
return cdp.ErrUnknownResult
}

View File

@ -484,7 +484,6 @@ func (t InitiatorType) String() string {
const (
InitiatorTypeParser InitiatorType = "parser"
InitiatorTypeScript InitiatorType = "script"
InitiatorTypePreload InitiatorType = "preload"
InitiatorTypeOther InitiatorType = "other"
)
@ -505,8 +504,6 @@ func (t *InitiatorType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = InitiatorTypeParser
case InitiatorTypeScript:
*t = InitiatorTypeScript
case InitiatorTypePreload:
*t = InitiatorTypePreload
case InitiatorTypeOther:
*t = InitiatorTypeOther

View File

@ -4552,6 +4552,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *
continue
}
switch key {
case "format":
(out.Format).UnmarshalEasyJSON(in)
case "quality":
out.Quality = int64(in.Int64())
default:
in.SkipRecursive()
}
@ -4566,6 +4570,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in
out.RawByte('{')
first := true
_ = first
if in.Format != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"format\":")
(in.Format).MarshalEasyJSON(out)
}
if in.Quality != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"quality\":")
out.Int64(int64(in.Quality))
}
out.RawByte('}')
}

View File

@ -830,29 +830,52 @@ func (p *SetDocumentContentParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
// CaptureScreenshotParams capture page screenshot.
type CaptureScreenshotParams struct{}
type CaptureScreenshotParams struct {
Format CaptureScreenshotFormat `json:"format,omitempty"` // Image compression format (defaults to png).
Quality int64 `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
}
// CaptureScreenshot capture page screenshot.
//
// parameters:
func CaptureScreenshot() *CaptureScreenshotParams {
return &CaptureScreenshotParams{}
}
// WithFormat image compression format (defaults to png).
func (p CaptureScreenshotParams) WithFormat(format CaptureScreenshotFormat) *CaptureScreenshotParams {
p.Format = format
return &p
}
// WithQuality compression quality from range [0..100] (jpeg only).
func (p CaptureScreenshotParams) WithQuality(quality int64) *CaptureScreenshotParams {
p.Quality = quality
return &p
}
// CaptureScreenshotReturns return values.
type CaptureScreenshotReturns struct {
Data string `json:"data,omitempty"` // Base64-encoded image data (PNG).
Data string `json:"data,omitempty"` // Base64-encoded image data.
}
// Do executes Page.captureScreenshot.
//
// returns:
// data - Base64-encoded image data (PNG).
// data - Base64-encoded image data.
func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (data []byte, err error) {
if ctxt == nil {
ctxt = context.Background()
}
// marshal
buf, err := easyjson.Marshal(p)
if err != nil {
return nil, err
}
// execute
ch := h.Execute(ctxt, cdp.CommandPageCaptureScreenshot, cdp.Empty)
ch := h.Execute(ctxt, cdp.CommandPageCaptureScreenshot, easyjson.RawMessage(buf))
// read response
select {

View File

@ -253,6 +253,48 @@ type VisualViewport struct {
Scale float64 `json:"scale,omitempty"` // Scale relative to the ideal viewport (size at width=device-width).
}
// CaptureScreenshotFormat image compression format (defaults to png).
type CaptureScreenshotFormat string
// String returns the CaptureScreenshotFormat as string value.
func (t CaptureScreenshotFormat) String() string {
return string(t)
}
// CaptureScreenshotFormat values.
const (
CaptureScreenshotFormatJpeg CaptureScreenshotFormat = "jpeg"
CaptureScreenshotFormatPng CaptureScreenshotFormat = "png"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t CaptureScreenshotFormat) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t CaptureScreenshotFormat) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *CaptureScreenshotFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch CaptureScreenshotFormat(in.String()) {
case CaptureScreenshotFormatJpeg:
*t = CaptureScreenshotFormatJpeg
case CaptureScreenshotFormatPng:
*t = CaptureScreenshotFormatPng
default:
in.AddError(errors.New("unknown CaptureScreenshotFormat value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *CaptureScreenshotFormat) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ScreencastFormat image compression format.
type ScreencastFormat string

View File

@ -75,6 +75,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime(in *jlexer.Lexer, out
}
(*out.Parent).UnmarshalEasyJSON(in)
}
case "promiseCreationFrame":
if in.IsNull() {
in.Skip()
out.PromiseCreationFrame = nil
} else {
if out.PromiseCreationFrame == nil {
out.PromiseCreationFrame = new(CallFrame)
}
(*out.PromiseCreationFrame).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
@ -132,6 +142,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime(out *jwriter.Writer, i
(*in.Parent).MarshalEasyJSON(out)
}
}
if in.PromiseCreationFrame != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"promiseCreationFrame\":")
if in.PromiseCreationFrame == nil {
out.RawString("null")
} else {
(*in.PromiseCreationFrame).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}

View File

@ -195,6 +195,7 @@ type StackTrace struct {
Description string `json:"description,omitempty"` // String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
CallFrames []*CallFrame `json:"callFrames,omitempty"` // JavaScript function name.
Parent *StackTrace `json:"parent,omitempty"` // Asynchronous JavaScript stack trace that preceded this stack, if available.
PromiseCreationFrame *CallFrame `json:"promiseCreationFrame,omitempty"` // Creation frame of the Promise which produced the next synchronous trace when resolved, if available.
}
// Type object type.
@ -358,6 +359,8 @@ const (
APITypeAssert APIType = "assert"
APITypeProfile APIType = "profile"
APITypeProfileEnd APIType = "profileEnd"
APITypeCount APIType = "count"
APITypeTimeEnd APIType = "timeEnd"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
@ -405,6 +408,10 @@ func (t *APIType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = APITypeProfile
case APITypeProfileEnd:
*t = APITypeProfileEnd
case APITypeCount:
*t = APITypeCount
case APITypeTimeEnd:
*t = APITypeTimeEnd
default:
in.AddError(errors.New("unknown APIType value"))

View File

@ -421,6 +421,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandIndexedDBClearObjectStore:
return emptyVal, nil
case cdp.CommandIndexedDBDeleteDatabase:
return emptyVal, nil
case cdp.CommandCacheStorageRequestCacheNames:
v = new(cachestorage.RequestCacheNamesReturns)

View File

@ -879,11 +879,29 @@
{
"name": "captureScreenshot",
"description": "Capture page screenshot.",
"parameters": [
{
"name": "format",
"type": "string",
"optional": true,
"enum": [
"jpeg",
"png"
],
"description": "Image compression format (defaults to png)."
},
{
"name": "quality",
"type": "integer",
"optional": true,
"description": "Compression quality from range [0..100] (jpeg only)."
}
],
"returns": [
{
"name": "data",
"type": "string",
"description": "Base64-encoded image data (PNG)."
"description": "Base64-encoded image data."
}
],
"experimental": true
@ -2387,7 +2405,6 @@
"enum": [
"parser",
"script",
"preload",
"other"
],
"description": "Type of this initiator."
@ -3738,6 +3755,23 @@
],
"returns": [],
"description": "Clears all entries from an object store."
},
{
"name": "deleteDatabase",
"parameters": [
{
"name": "securityOrigin",
"type": "string",
"description": "Security origin."
},
{
"name": "databaseName",
"type": "string",
"description": "Database name."
}
],
"returns": [],
"description": "Deletes a database."
}
]
},
@ -10575,6 +10609,13 @@
"$ref": "StackTrace",
"optional": true,
"description": "Asynchronous JavaScript stack trace that preceded this stack, if available."
},
{
"name": "promiseCreationFrame",
"$ref": "CallFrame",
"optional": true,
"experimental": true,
"description": "Creation frame of the Promise which produced the next synchronous trace when resolved, if available."
}
]
}
@ -11054,7 +11095,9 @@
"endGroup",
"assert",
"profile",
"profileEnd"
"profileEnd",
"count",
"timeEnd"
],
"description": "Type of the call."
},