Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-05-24 09:36:12 +07:00
parent dff2331810
commit 0603a8acd9
8 changed files with 283 additions and 29 deletions

View File

@ -330,6 +330,7 @@ const (
CommandServiceWorkerSetForceUpdateOnPageLoad MethodType = "ServiceWorker.setForceUpdateOnPageLoad"
CommandServiceWorkerDeliverPushMessage MethodType = "ServiceWorker.deliverPushMessage"
CommandServiceWorkerDispatchSyncEvent MethodType = "ServiceWorker.dispatchSyncEvent"
CommandInputSetIgnoreInputEvents MethodType = "Input.setIgnoreInputEvents"
CommandInputDispatchKeyEvent MethodType = "Input.dispatchKeyEvent"
CommandInputDispatchMouseEvent MethodType = "Input.dispatchMouseEvent"
CommandInputDispatchTouchEvent MethodType = "Input.dispatchTouchEvent"
@ -1041,6 +1042,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandServiceWorkerDeliverPushMessage
case CommandServiceWorkerDispatchSyncEvent:
*t = CommandServiceWorkerDispatchSyncEvent
case CommandInputSetIgnoreInputEvents:
*t = CommandInputSetIgnoreInputEvents
case CommandInputDispatchKeyEvent:
*t = CommandInputDispatchKeyEvent
case CommandInputDispatchMouseEvent:

View File

@ -891,6 +891,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventServiceWorkerWorkerErrorReported:
v = new(serviceworker.EventWorkerErrorReported)
case cdp.CommandInputSetIgnoreInputEvents:
return emptyVal, nil
case cdp.CommandInputDispatchKeyEvent:
return emptyVal, nil

View File

@ -539,7 +539,74 @@ func (v *SynthesizePinchGestureParams) UnmarshalJSON(data []byte) error {
func (v *SynthesizePinchGestureParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(in *jlexer.Lexer, out *EmulateTouchFromMouseEventParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(in *jlexer.Lexer, out *SetIgnoreInputEventsParams) {
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 "ignore":
out.Ignore = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(out *jwriter.Writer, in SetIgnoreInputEventsParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"ignore\":")
out.Bool(bool(in.Ignore))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetIgnoreInputEventsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetIgnoreInputEventsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetIgnoreInputEventsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetIgnoreInputEventsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(in *jlexer.Lexer, out *EmulateTouchFromMouseEventParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -586,7 +653,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(out *jwriter.Writer, in EmulateTouchFromMouseEventParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(out *jwriter.Writer, in EmulateTouchFromMouseEventParams) {
out.RawByte('{')
first := true
_ = first
@ -658,27 +725,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface
func (v EmulateTouchFromMouseEventParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EmulateTouchFromMouseEventParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput4(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EmulateTouchFromMouseEventParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EmulateTouchFromMouseEventParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput4(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(in *jlexer.Lexer, out *DispatchTouchEventParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(in *jlexer.Lexer, out *DispatchTouchEventParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -744,7 +811,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(out *jwriter.Writer, in DispatchTouchEventParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(out *jwriter.Writer, in DispatchTouchEventParams) {
out.RawByte('{')
first := true
_ = first
@ -797,27 +864,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface
func (v DispatchTouchEventParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DispatchTouchEventParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput5(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DispatchTouchEventParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DispatchTouchEventParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(in *jlexer.Lexer, out *DispatchMouseEventParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(in *jlexer.Lexer, out *DispatchMouseEventParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -860,7 +927,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(out *jwriter.Writer, in DispatchMouseEventParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(out *jwriter.Writer, in DispatchMouseEventParams) {
out.RawByte('{')
first := true
_ = first
@ -920,27 +987,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface
func (v DispatchMouseEventParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DispatchMouseEventParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput6(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DispatchMouseEventParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DispatchMouseEventParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(in *jlexer.Lexer, out *DispatchKeyEventParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput8(in *jlexer.Lexer, out *DispatchKeyEventParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -995,7 +1062,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(out *jwriter.Writer, in DispatchKeyEventParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput8(out *jwriter.Writer, in DispatchKeyEventParams) {
out.RawByte('{')
first := true
_ = first
@ -1107,23 +1174,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(out *jwriter.Writer, in
// MarshalJSON supports json.Marshaler interface
func (v DispatchKeyEventParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DispatchKeyEventParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DispatchKeyEventParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DispatchKeyEventParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput8(l, v)
}

View File

@ -12,6 +12,28 @@ import (
cdp "github.com/knq/chromedp/cdp"
)
// SetIgnoreInputEventsParams ignores input events (useful while auditing
// page).
type SetIgnoreInputEventsParams struct {
Ignore bool `json:"ignore"` // Ignores input events processing when set to true.
}
// SetIgnoreInputEvents ignores input events (useful while auditing page).
//
// parameters:
// ignore - Ignores input events processing when set to true.
func SetIgnoreInputEvents(ignore bool) *SetIgnoreInputEventsParams {
return &SetIgnoreInputEventsParams{
Ignore: ignore,
}
}
// Do executes Input.setIgnoreInputEvents against the provided context and
// target handler.
func (p *SetIgnoreInputEventsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputSetIgnoreInputEvents, p, nil)
}
// DispatchKeyEventParams dispatches a key event to the page.
type DispatchKeyEventParams struct {
Type KeyType `json:"type"` // Type of the key event.

View File

@ -1539,8 +1539,12 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage17(in *jlexer.Lexer, out *
out.ID = int64(in.Int64())
case "url":
out.URL = string(in.String())
case "userTypedURL":
out.UserTypedURL = string(in.String())
case "title":
out.Title = string(in.String())
case "transitionType":
(out.TransitionType).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
@ -1571,6 +1575,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage17(out *jwriter.Writer, in
out.RawString("\"url\":")
out.String(string(in.URL))
}
if in.UserTypedURL != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"userTypedURL\":")
out.String(string(in.UserTypedURL))
}
if in.Title != "" {
if !first {
out.RawByte(',')
@ -1579,6 +1591,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage17(out *jwriter.Writer, in
out.RawString("\"title\":")
out.String(string(in.Title))
}
if in.TransitionType != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"transitionType\":")
(in.TransitionType).MarshalEasyJSON(out)
}
out.RawByte('}')
}
@ -1764,6 +1784,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage20(in *jlexer.Lexer, out *
out.URL = string(in.String())
case "referrer":
out.Referrer = string(in.String())
case "transitionType":
(out.TransitionType).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
@ -1792,6 +1814,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage20(out *jwriter.Writer, in
out.RawString("\"referrer\":")
out.String(string(in.Referrer))
}
if in.TransitionType != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"transitionType\":")
(in.TransitionType).MarshalEasyJSON(out)
}
out.RawByte('}')
}

View File

@ -163,6 +163,7 @@ func (p *ReloadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
type NavigateParams struct {
URL string `json:"url"` // URL to navigate the page to.
Referrer string `json:"referrer,omitempty"` // Referrer URL.
TransitionType TransitionType `json:"transitionType,omitempty"` // Intended transition type.
}
// Navigate navigates current page to the given URL.
@ -181,6 +182,12 @@ func (p NavigateParams) WithReferrer(referrer string) *NavigateParams {
return &p
}
// WithTransitionType intended transition type.
func (p NavigateParams) WithTransitionType(transitionType TransitionType) *NavigateParams {
p.TransitionType = transitionType
return &p
}
// NavigateReturns return values.
type NavigateReturns struct {
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame id that will be navigated.

View File

@ -113,11 +113,85 @@ func (t ScriptIdentifier) String() string {
return string(t)
}
// TransitionType transition type.
type TransitionType string
// String returns the TransitionType as string value.
func (t TransitionType) String() string {
return string(t)
}
// TransitionType values.
const (
TransitionTypeLink TransitionType = "link"
TransitionTypeTyped TransitionType = "typed"
TransitionTypeAutoBookmark TransitionType = "auto_bookmark"
TransitionTypeAutoSubframe TransitionType = "auto_subframe"
TransitionTypeManualSubframe TransitionType = "manual_subframe"
TransitionTypeGenerated TransitionType = "generated"
TransitionTypeAutoToplevel TransitionType = "auto_toplevel"
TransitionTypeFormSubmit TransitionType = "form_submit"
TransitionTypeReload TransitionType = "reload"
TransitionTypeKeyword TransitionType = "keyword"
TransitionTypeKeywordGenerated TransitionType = "keyword_generated"
TransitionTypeOther TransitionType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TransitionType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t TransitionType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TransitionType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch TransitionType(in.String()) {
case TransitionTypeLink:
*t = TransitionTypeLink
case TransitionTypeTyped:
*t = TransitionTypeTyped
case TransitionTypeAutoBookmark:
*t = TransitionTypeAutoBookmark
case TransitionTypeAutoSubframe:
*t = TransitionTypeAutoSubframe
case TransitionTypeManualSubframe:
*t = TransitionTypeManualSubframe
case TransitionTypeGenerated:
*t = TransitionTypeGenerated
case TransitionTypeAutoToplevel:
*t = TransitionTypeAutoToplevel
case TransitionTypeFormSubmit:
*t = TransitionTypeFormSubmit
case TransitionTypeReload:
*t = TransitionTypeReload
case TransitionTypeKeyword:
*t = TransitionTypeKeyword
case TransitionTypeKeywordGenerated:
*t = TransitionTypeKeywordGenerated
case TransitionTypeOther:
*t = TransitionTypeOther
default:
in.AddError(errors.New("unknown TransitionType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TransitionType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// NavigationEntry navigation history entry.
type NavigationEntry struct {
ID int64 `json:"id,omitempty"` // Unique id of the navigation history entry.
URL string `json:"url,omitempty"` // URL of the navigation history entry.
UserTypedURL string `json:"userTypedURL,omitempty"` // URL that the user typed in the url bar.
Title string `json:"title,omitempty"` // Title of the navigation history entry.
TransitionType TransitionType `json:"transitionType,omitempty"` // Transition type.
}
// ScreencastFrameMetadata screencast frame metadata.

View File

@ -252,6 +252,26 @@
"description": "Unique script identifier.",
"experimental": true
},
{
"id": "TransitionType",
"type": "string",
"description": "Transition type.",
"experimental": true,
"enum": [
"link",
"typed",
"auto_bookmark",
"auto_subframe",
"manual_subframe",
"generated",
"auto_toplevel",
"form_submit",
"reload",
"keyword",
"keyword_generated",
"other"
]
},
{
"id": "NavigationEntry",
"type": "object",
@ -267,10 +287,20 @@
"type": "string",
"description": "URL of the navigation history entry."
},
{
"name": "userTypedURL",
"type": "string",
"description": "URL that the user typed in the url bar."
},
{
"name": "title",
"type": "string",
"description": "Title of the navigation history entry."
},
{
"name": "transitionType",
"$ref": "TransitionType",
"description": "Transition type."
}
],
"experimental": true
@ -529,6 +559,13 @@
"optional": true,
"experimental": true,
"description": "Referrer URL."
},
{
"name": "transitionType",
"$ref": "TransitionType",
"optional": true,
"experimental": true,
"description": "Intended transition type."
}
],
"returns": [
@ -8216,6 +8253,17 @@
}
],
"commands": [
{
"name": "setIgnoreInputEvents",
"parameters": [
{
"name": "ignore",
"type": "boolean",
"description": "Ignores input events processing when set to true."
}
],
"description": "Ignores input events (useful while auditing page)."
},
{
"name": "dispatchKeyEvent",
"parameters": [