Update chromedp to fix console errors (#1521)

This commit is contained in:
peolic
2021-06-23 01:05:58 +03:00
committed by GitHub
parent ae3400a9b1
commit be2fe1de26
526 changed files with 55061 additions and 30300 deletions

View File

@@ -125,6 +125,7 @@ type SetDownloadBehaviorParams struct {
Behavior SetDownloadBehaviorBehavior `json:"behavior"` // Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their dowmload guids.
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // BrowserContext to set download behavior. When omitted, default browser context is used.
DownloadPath string `json:"downloadPath,omitempty"` // The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
EventsEnabled bool `json:"eventsEnabled,omitempty"` // Whether to emit download events (defaults to false).
}
// SetDownloadBehavior set the behavior when downloading a file.
@@ -153,11 +154,47 @@ func (p SetDownloadBehaviorParams) WithDownloadPath(downloadPath string) *SetDow
return &p
}
// WithEventsEnabled whether to emit download events (defaults to false).
func (p SetDownloadBehaviorParams) WithEventsEnabled(eventsEnabled bool) *SetDownloadBehaviorParams {
p.EventsEnabled = eventsEnabled
return &p
}
// Do executes Browser.setDownloadBehavior against the provided context.
func (p *SetDownloadBehaviorParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDownloadBehavior, p, nil)
}
// CancelDownloadParams cancel a download if in progress.
type CancelDownloadParams struct {
GUID string `json:"guid"` // Global unique identifier of the download.
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // BrowserContext to perform the action in. When omitted, default browser context is used.
}
// CancelDownload cancel a download if in progress.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-cancelDownload
//
// parameters:
// guid - Global unique identifier of the download.
func CancelDownload(guid string) *CancelDownloadParams {
return &CancelDownloadParams{
GUID: guid,
}
}
// WithBrowserContextID browserContext to perform the action in. When
// omitted, default browser context is used.
func (p CancelDownloadParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *CancelDownloadParams {
p.BrowserContextID = browserContextID
return &p
}
// Do executes Browser.cancelDownload against the provided context.
func (p *CancelDownloadParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandCancelDownload, p, nil)
}
// CloseParams close browser gracefully.
type CloseParams struct{}
@@ -505,12 +542,36 @@ func (p *SetDockTileParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDockTile, p, nil)
}
// ExecuteBrowserCommandParams invoke custom browser commands used by
// telemetry.
type ExecuteBrowserCommandParams struct {
CommandID CommandID `json:"commandId"`
}
// ExecuteBrowserCommand invoke custom browser commands used by telemetry.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-executeBrowserCommand
//
// parameters:
// commandID
func ExecuteBrowserCommand(commandID CommandID) *ExecuteBrowserCommandParams {
return &ExecuteBrowserCommandParams{
CommandID: commandID,
}
}
// Do executes Browser.executeBrowserCommand against the provided context.
func (p *ExecuteBrowserCommandParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandExecuteBrowserCommand, p, nil)
}
// Command names.
const (
CommandSetPermission = "Browser.setPermission"
CommandGrantPermissions = "Browser.grantPermissions"
CommandResetPermissions = "Browser.resetPermissions"
CommandSetDownloadBehavior = "Browser.setDownloadBehavior"
CommandCancelDownload = "Browser.cancelDownload"
CommandClose = "Browser.close"
CommandCrash = "Browser.crash"
CommandCrashGpuProcess = "Browser.crashGpuProcess"
@@ -522,4 +583,5 @@ const (
CommandGetWindowForTarget = "Browser.getWindowForTarget"
CommandSetWindowBounds = "Browser.setWindowBounds"
CommandSetDockTile = "Browser.setDockTile"
CommandExecuteBrowserCommand = "Browser.executeBrowserCommand"
)

View File

@@ -30,7 +30,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser(in *jlexer.Lexer, out
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -115,7 +115,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser1(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -214,7 +214,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser2(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -228,6 +228,8 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser2(in *jlexer.Lexer, ou
out.BrowserContextID = cdp.BrowserContextID(in.String())
case "downloadPath":
out.DownloadPath = string(in.String())
case "eventsEnabled":
out.EventsEnabled = bool(in.Bool())
default:
in.SkipRecursive()
}
@@ -257,6 +259,11 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser2(out *jwriter.Writer,
out.RawString(prefix)
out.String(string(in.DownloadPath))
}
if in.EventsEnabled {
const prefix string = ",\"eventsEnabled\":"
out.RawString(prefix)
out.Bool(bool(in.EventsEnabled))
}
out.RawByte('}')
}
@@ -294,7 +301,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser3(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -373,7 +380,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser4(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -440,7 +447,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser5(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -454,10 +461,10 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser5(in *jlexer.Lexer, ou
out.Sysex = bool(in.Bool())
case "userVisibleOnly":
out.UserVisibleOnly = bool(in.Bool())
case "type":
out.Type = string(in.String())
case "allowWithoutSanitization":
out.AllowWithoutSanitization = bool(in.Bool())
case "panTiltZoom":
out.PanTiltZoom = bool(in.Bool())
default:
in.SkipRecursive()
}
@@ -487,16 +494,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser5(out *jwriter.Writer,
out.RawString(prefix)
out.Bool(bool(in.UserVisibleOnly))
}
if in.Type != "" {
const prefix string = ",\"type\":"
out.RawString(prefix)
out.String(string(in.Type))
}
if in.AllowWithoutSanitization {
const prefix string = ",\"allowWithoutSanitization\":"
out.RawString(prefix)
out.Bool(bool(in.AllowWithoutSanitization))
}
if in.PanTiltZoom {
const prefix string = ",\"panTiltZoom\":"
out.RawString(prefix)
out.Bool(bool(in.PanTiltZoom))
}
out.RawByte('}')
}
@@ -534,7 +541,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser6(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -665,7 +672,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser7(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -777,7 +784,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser8(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -864,7 +871,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser9(in *jlexer.Lexer, ou
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -931,7 +938,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser10(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1006,7 +1013,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser11(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1072,7 +1079,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser12(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1187,7 +1194,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser13(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1246,7 +1253,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser14(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1355,7 +1362,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser15(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1434,7 +1441,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser16(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1509,7 +1516,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser17(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1582,7 +1589,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser18(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1679,7 +1686,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser19(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1727,7 +1734,7 @@ func (v *GetBrowserCommandLineParams) UnmarshalJSON(data []byte) error {
func (v *GetBrowserCommandLineParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser19(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(in *jlexer.Lexer, out *CrashParams) {
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(in *jlexer.Lexer, out *ExecuteBrowserCommandParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@@ -1738,7 +1745,247 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "commandId":
(out.CommandID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(out *jwriter.Writer, in ExecuteBrowserCommandParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"commandId\":"
out.RawString(prefix[1:])
(in.CommandID).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ExecuteBrowserCommandParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ExecuteBrowserCommandParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ExecuteBrowserCommandParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ExecuteBrowserCommandParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(in *jlexer.Lexer, out *EventDownloadWillBegin) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
case "guid":
out.GUID = string(in.String())
case "url":
out.URL = string(in.String())
case "suggestedFilename":
out.SuggestedFilename = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(out *jwriter.Writer, in EventDownloadWillBegin) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"frameId\":"
out.RawString(prefix[1:])
out.String(string(in.FrameID))
}
{
const prefix string = ",\"guid\":"
out.RawString(prefix)
out.String(string(in.GUID))
}
{
const prefix string = ",\"url\":"
out.RawString(prefix)
out.String(string(in.URL))
}
{
const prefix string = ",\"suggestedFilename\":"
out.RawString(prefix)
out.String(string(in.SuggestedFilename))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventDownloadWillBegin) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventDownloadWillBegin) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventDownloadWillBegin) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventDownloadWillBegin) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(in *jlexer.Lexer, out *EventDownloadProgress) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "guid":
out.GUID = string(in.String())
case "totalBytes":
out.TotalBytes = float64(in.Float64())
case "receivedBytes":
out.ReceivedBytes = float64(in.Float64())
case "state":
(out.State).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(out *jwriter.Writer, in EventDownloadProgress) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"guid\":"
out.RawString(prefix[1:])
out.String(string(in.GUID))
}
{
const prefix string = ",\"totalBytes\":"
out.RawString(prefix)
out.Float64(float64(in.TotalBytes))
}
{
const prefix string = ",\"receivedBytes\":"
out.RawString(prefix)
out.Float64(float64(in.ReceivedBytes))
}
{
const prefix string = ",\"state\":"
out.RawString(prefix)
(in.State).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventDownloadProgress) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventDownloadProgress) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventDownloadProgress) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventDownloadProgress) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(in *jlexer.Lexer, out *CrashParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1756,7 +2003,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(out *jwriter.Writer, in CrashParams) {
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(out *jwriter.Writer, in CrashParams) {
out.RawByte('{')
first := true
_ = first
@@ -1766,27 +2013,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v CrashParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(&w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CrashParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20(w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CrashParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(&r, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CrashParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20(l, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(in *jlexer.Lexer, out *CrashGpuProcessParams) {
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(in *jlexer.Lexer, out *CrashGpuProcessParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@@ -1797,7 +2044,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1815,7 +2062,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(out *jwriter.Writer, in CrashGpuProcessParams) {
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(out *jwriter.Writer, in CrashGpuProcessParams) {
out.RawByte('{')
first := true
_ = first
@@ -1825,27 +2072,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v CrashGpuProcessParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(&w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CrashGpuProcessParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser21(w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CrashGpuProcessParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(&r, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CrashGpuProcessParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21(l, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(in *jlexer.Lexer, out *CloseParams) {
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser25(in *jlexer.Lexer, out *CloseParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@@ -1856,7 +2103,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1874,7 +2121,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(out *jwriter.Writer, in CloseParams) {
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser25(out *jwriter.Writer, in CloseParams) {
out.RawByte('{')
first := true
_ = first
@@ -1884,27 +2131,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v CloseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(&w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser25(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser22(w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser25(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CloseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(&r, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser25(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser22(l, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser25(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(in *jlexer.Lexer, out *Bucket) {
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser26(in *jlexer.Lexer, out *CancelDownloadParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@@ -1915,7 +2162,80 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "guid":
out.GUID = string(in.String())
case "browserContextId":
out.BrowserContextID = cdp.BrowserContextID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser26(out *jwriter.Writer, in CancelDownloadParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"guid\":"
out.RawString(prefix[1:])
out.String(string(in.GUID))
}
if in.BrowserContextID != "" {
const prefix string = ",\"browserContextId\":"
out.RawString(prefix)
out.String(string(in.BrowserContextID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v CancelDownloadParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser26(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CancelDownloadParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser26(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CancelDownloadParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser26(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CancelDownloadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser26(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser27(in *jlexer.Lexer, out *Bucket) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -1939,7 +2259,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(out *jwriter.Writer, in Bucket) {
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser27(out *jwriter.Writer, in Bucket) {
out.RawByte('{')
first := true
_ = first
@@ -1964,27 +2284,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v Bucket) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(&w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser27(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Bucket) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser23(w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser27(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Bucket) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(&r, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser27(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Bucket) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser23(l, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser27(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(in *jlexer.Lexer, out *Bounds) {
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser28(in *jlexer.Lexer, out *Bounds) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@@ -1995,7 +2315,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(in *jlexer.Lexer, o
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
@@ -2023,7 +2343,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(out *jwriter.Writer, in Bounds) {
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser28(out *jwriter.Writer, in Bounds) {
out.RawByte('{')
first := true
_ = first
@@ -2079,23 +2399,23 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v Bounds) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(&w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser28(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Bounds) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser24(w, v)
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser28(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Bounds) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(&r, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser28(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Bounds) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser24(l, v)
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser28(l, v)
}

28
vendor/github.com/chromedp/cdproto/browser/events.go generated vendored Normal file
View File

@@ -0,0 +1,28 @@
package browser
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
)
// EventDownloadWillBegin fired when page is about to start a download.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadWillBegin
type EventDownloadWillBegin struct {
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that caused the download to begin.
GUID string `json:"guid"` // Global unique identifier of the download.
URL string `json:"url"` // URL of the resource being downloaded.
SuggestedFilename string `json:"suggestedFilename"` // Suggested file name of the resource (the actual name of the file saved on disk may differ).
}
// EventDownloadProgress fired when download makes progress. Last call has
// |done| == true.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadProgress
type EventDownloadProgress struct {
GUID string `json:"guid"` // Global unique identifier of the download.
TotalBytes float64 `json:"totalBytes"` // Total expected bytes to download.
ReceivedBytes float64 `json:"receivedBytes"` // Total bytes received.
State DownloadProgressState `json:"state"` // Download status.
}

View File

@@ -99,6 +99,7 @@ const (
PermissionTypeBackgroundFetch PermissionType = "backgroundFetch"
PermissionTypeClipboardReadWrite PermissionType = "clipboardReadWrite"
PermissionTypeClipboardSanitizedWrite PermissionType = "clipboardSanitizedWrite"
PermissionTypeDisplayCapture PermissionType = "displayCapture"
PermissionTypeDurableStorage PermissionType = "durableStorage"
PermissionTypeFlash PermissionType = "flash"
PermissionTypeGeolocation PermissionType = "geolocation"
@@ -111,6 +112,7 @@ const (
PermissionTypeProtectedMediaIdentifier PermissionType = "protectedMediaIdentifier"
PermissionTypeSensors PermissionType = "sensors"
PermissionTypeVideoCapture PermissionType = "videoCapture"
PermissionTypeVideoCapturePanTiltZoom PermissionType = "videoCapturePanTiltZoom"
PermissionTypeIdleDetection PermissionType = "idleDetection"
PermissionTypeWakeLockScreen PermissionType = "wakeLockScreen"
PermissionTypeWakeLockSystem PermissionType = "wakeLockSystem"
@@ -141,6 +143,8 @@ func (t *PermissionType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = PermissionTypeClipboardReadWrite
case PermissionTypeClipboardSanitizedWrite:
*t = PermissionTypeClipboardSanitizedWrite
case PermissionTypeDisplayCapture:
*t = PermissionTypeDisplayCapture
case PermissionTypeDurableStorage:
*t = PermissionTypeDurableStorage
case PermissionTypeFlash:
@@ -165,6 +169,8 @@ func (t *PermissionType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = PermissionTypeSensors
case PermissionTypeVideoCapture:
*t = PermissionTypeVideoCapture
case PermissionTypeVideoCapturePanTiltZoom:
*t = PermissionTypeVideoCapturePanTiltZoom
case PermissionTypeIdleDetection:
*t = PermissionTypeIdleDetection
case PermissionTypeWakeLockScreen:
@@ -238,8 +244,52 @@ type PermissionDescriptor struct {
Name string `json:"name"` // Name of permission. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
Sysex bool `json:"sysex,omitempty"` // For "midi" permission, may also specify sysex control.
UserVisibleOnly bool `json:"userVisibleOnly,omitempty"` // For "push" permission, may specify userVisibleOnly. Note that userVisibleOnly = true is the only currently supported type.
Type string `json:"type,omitempty"` // For "wake-lock" permission, must specify type as either "screen" or "system".
AllowWithoutSanitization bool `json:"allowWithoutSanitization,omitempty"` // For "clipboard" permission, may specify allowWithoutSanitization.
PanTiltZoom bool `json:"panTiltZoom,omitempty"` // For "camera" permission, may specify panTiltZoom.
}
// CommandID browser command ids used by executeBrowserCommand.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-BrowserCommandId
type CommandID string
// String returns the CommandID as string value.
func (t CommandID) String() string {
return string(t)
}
// CommandID values.
const (
CommandIDOpenTabSearch CommandID = "openTabSearch"
CommandIDCloseTabSearch CommandID = "closeTabSearch"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t CommandID) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t CommandID) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *CommandID) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch CommandID(in.String()) {
case CommandIDOpenTabSearch:
*t = CommandIDOpenTabSearch
case CommandIDCloseTabSearch:
*t = CommandIDCloseTabSearch
default:
in.AddError(errors.New("unknown CommandID value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *CommandID) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Bucket chrome histogram bucket.
@@ -261,6 +311,53 @@ type Histogram struct {
Buckets []*Bucket `json:"buckets"` // Buckets.
}
// DownloadProgressState download status.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadProgress
type DownloadProgressState string
// String returns the DownloadProgressState as string value.
func (t DownloadProgressState) String() string {
return string(t)
}
// DownloadProgressState values.
const (
DownloadProgressStateInProgress DownloadProgressState = "inProgress"
DownloadProgressStateCompleted DownloadProgressState = "completed"
DownloadProgressStateCanceled DownloadProgressState = "canceled"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DownloadProgressState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DownloadProgressState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DownloadProgressState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch DownloadProgressState(in.String()) {
case DownloadProgressStateInProgress:
*t = DownloadProgressStateInProgress
case DownloadProgressStateCompleted:
*t = DownloadProgressStateCompleted
case DownloadProgressStateCanceled:
*t = DownloadProgressStateCanceled
default:
in.AddError(errors.New("unknown DownloadProgressState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DownloadProgressState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SetDownloadBehaviorBehavior whether to allow all or deny all download
// requests, or use default Chrome behavior if available (otherwise deny).
// |allowAndName| allows download and names files according to their dowmload