From 0b1fcf891e264964684d0c30946c296494f0321d Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Mon, 19 Jun 2023 04:41:18 +0700 Subject: [PATCH] Updating to 116.0.5840.1_11.6.186 definitions --- audits/easyjson.go | 7 + audits/types.go | 5 +- autofill/autofill.go | 28 +++- autofill/easyjson.go | 305 ++++++++++++++++++++++++++++++++++++++++++- autofill/types.go | 15 +++ cdproto.go | 4 + page/types.go | 6 +- 7 files changed, 358 insertions(+), 12 deletions(-) diff --git a/audits/easyjson.go b/audits/easyjson.go index db53634..97480a7 100644 --- a/audits/easyjson.go +++ b/audits/easyjson.go @@ -1730,6 +1730,8 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAudits15(in *jlexer.Lexer, ou out.URL = string(in.String()) case "failureMessage": out.FailureMessage = string(in.String()) + case "requestId": + out.RequestID = network.RequestID(in.String()) default: in.SkipRecursive() } @@ -1754,6 +1756,11 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAudits15(out *jwriter.Writer, out.RawString(prefix) out.String(string(in.FailureMessage)) } + if in.RequestID != "" { + const prefix string = ",\"requestId\":" + out.RawString(prefix) + out.String(string(in.RequestID)) + } out.RawByte('}') } diff --git a/audits/types.go b/audits/types.go index 3a53602..db223ae 100644 --- a/audits/types.go +++ b/audits/types.go @@ -1253,8 +1253,9 @@ type ClientHintIssueDetails struct { // // See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-FailedRequestInfo type FailedRequestInfo struct { - URL string `json:"url"` // The URL that failed to load. - FailureMessage string `json:"failureMessage"` // The failure message for the failed request. + URL string `json:"url"` // The URL that failed to load. + FailureMessage string `json:"failureMessage"` // The failure message for the failed request. + RequestID network.RequestID `json:"requestId,omitempty"` } // StyleSheetLoadingIssueReason [no description]. diff --git a/autofill/autofill.go b/autofill/autofill.go index c41c1e3..629b38e 100644 --- a/autofill/autofill.go +++ b/autofill/autofill.go @@ -49,7 +49,33 @@ func (p *TriggerParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandTrigger, p, nil) } +// SetAddressesParams set addresses so that developers can verify their forms +// implementation. +type SetAddressesParams struct { + Addresses []*Address `json:"addresses"` +} + +// SetAddresses set addresses so that developers can verify their forms +// implementation. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#method-setAddresses +// +// parameters: +// +// addresses +func SetAddresses(addresses []*Address) *SetAddressesParams { + return &SetAddressesParams{ + Addresses: addresses, + } +} + +// Do executes Autofill.setAddresses against the provided context. +func (p *SetAddressesParams) Do(ctx context.Context) (err error) { + return cdp.Execute(ctx, CommandSetAddresses, p, nil) +} + // Command names. const ( - CommandTrigger = "Autofill.trigger" + CommandTrigger = "Autofill.trigger" + CommandSetAddresses = "Autofill.setAddresses" ) diff --git a/autofill/easyjson.go b/autofill/easyjson.go index 9cc8452..24a6d7a 100644 --- a/autofill/easyjson.go +++ b/autofill/easyjson.go @@ -109,7 +109,117 @@ func (v *TriggerParams) UnmarshalJSON(data []byte) error { func (v *TriggerParams) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(in *jlexer.Lexer, out *CreditCard) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(in *jlexer.Lexer, out *SetAddressesParams) { + 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 "addresses": + if in.IsNull() { + in.Skip() + out.Addresses = nil + } else { + in.Delim('[') + if out.Addresses == nil { + if !in.IsDelim(']') { + out.Addresses = make([]*Address, 0, 8) + } else { + out.Addresses = []*Address{} + } + } else { + out.Addresses = (out.Addresses)[:0] + } + for !in.IsDelim(']') { + var v1 *Address + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Address) + } + (*v1).UnmarshalEasyJSON(in) + } + out.Addresses = append(out.Addresses, v1) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(out *jwriter.Writer, in SetAddressesParams) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"addresses\":" + out.RawString(prefix[1:]) + if in.Addresses == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Addresses { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v SetAddressesParams) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v SetAddressesParams) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *SetAddressesParams) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *SetAddressesParams) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill2(in *jlexer.Lexer, out *CreditCard) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -148,7 +258,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(in *jlexer.Lexer, o in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(out *jwriter.Writer, in CreditCard) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill2(out *jwriter.Writer, in CreditCard) { out.RawByte('{') first := true _ = first @@ -183,23 +293,206 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(out *jwriter.Writer // MarshalJSON supports json.Marshaler interface func (v CreditCard) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CreditCard) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill1(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CreditCard) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CreditCard) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill1(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill2(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill3(in *jlexer.Lexer, out *AddressField) { + 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 "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 easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill3(out *jwriter.Writer, in AddressField) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(string(in.Name)) + } + { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.String(string(in.Value)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v AddressField) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v AddressField) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *AddressField) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *AddressField) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill3(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill4(in *jlexer.Lexer, out *Address) { + 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 "fields": + if in.IsNull() { + in.Skip() + out.Fields = nil + } else { + in.Delim('[') + if out.Fields == nil { + if !in.IsDelim(']') { + out.Fields = make([]*AddressField, 0, 8) + } else { + out.Fields = []*AddressField{} + } + } else { + out.Fields = (out.Fields)[:0] + } + for !in.IsDelim(']') { + var v4 *AddressField + if in.IsNull() { + in.Skip() + v4 = nil + } else { + if v4 == nil { + v4 = new(AddressField) + } + (*v4).UnmarshalEasyJSON(in) + } + out.Fields = append(out.Fields, v4) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill4(out *jwriter.Writer, in Address) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"fields\":" + out.RawString(prefix[1:]) + if in.Fields == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Fields { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Address) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Address) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoAutofill4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Address) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Address) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoAutofill4(l, v) } diff --git a/autofill/types.go b/autofill/types.go index 48bb511..3901fc7 100644 --- a/autofill/types.go +++ b/autofill/types.go @@ -12,3 +12,18 @@ type CreditCard struct { ExpiryYear string `json:"expiryYear"` // 4-digit expiry year. Cvc string `json:"cvc"` // 3-digit card verification code. } + +// AddressField [no description]. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-AddressField +type AddressField struct { + Name string `json:"name"` // address field name, for example GIVEN_NAME. + Value string `json:"value"` // address field name, for example Jon Doe. +} + +// Address [no description]. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-Address +type Address struct { + Fields []*AddressField `json:"fields"` // fields and values defining a test address. +} diff --git a/cdproto.go b/cdproto.go index 00988ce..95e0da4 100644 --- a/cdproto.go +++ b/cdproto.go @@ -110,6 +110,7 @@ const ( CommandAuditsCheckFormsIssues = audits.CommandCheckFormsIssues EventAuditsIssueAdded = "Audits.issueAdded" CommandAutofillTrigger = autofill.CommandTrigger + CommandAutofillSetAddresses = autofill.CommandSetAddresses CommandBackgroundServiceStartObserving = backgroundservice.CommandStartObserving CommandBackgroundServiceStopObserving = backgroundservice.CommandStopObserving CommandBackgroundServiceSetRecording = backgroundservice.CommandSetRecording @@ -901,6 +902,9 @@ func UnmarshalMessage(msg *Message) (interface{}, error) { case CommandAutofillTrigger: return emptyVal, nil + case CommandAutofillSetAddresses: + return emptyVal, nil + case CommandBackgroundServiceStartObserving: return emptyVal, nil diff --git a/page/types.go b/page/types.go index d16104b..efb2d65 100644 --- a/page/types.go +++ b/page/types.go @@ -1049,7 +1049,7 @@ const ( BackForwardCacheNotRestoredReasonKeepaliveRequest BackForwardCacheNotRestoredReason = "KeepaliveRequest" BackForwardCacheNotRestoredReasonIndexedDBEvent BackForwardCacheNotRestoredReason = "IndexedDBEvent" BackForwardCacheNotRestoredReasonDummy BackForwardCacheNotRestoredReason = "Dummy" - BackForwardCacheNotRestoredReasonAuthorizationHeader BackForwardCacheNotRestoredReason = "AuthorizationHeader" + BackForwardCacheNotRestoredReasonJsNetworkRequestReceivedCacheControlNoStoreResource BackForwardCacheNotRestoredReason = "JsNetworkRequestReceivedCacheControlNoStoreResource" BackForwardCacheNotRestoredReasonContentSecurityHandler BackForwardCacheNotRestoredReason = "ContentSecurityHandler" BackForwardCacheNotRestoredReasonContentWebAuthenticationAPI BackForwardCacheNotRestoredReason = "ContentWebAuthenticationAPI" BackForwardCacheNotRestoredReasonContentFileChooser BackForwardCacheNotRestoredReason = "ContentFileChooser" @@ -1289,8 +1289,8 @@ func (t *BackForwardCacheNotRestoredReason) UnmarshalEasyJSON(in *jlexer.Lexer) *t = BackForwardCacheNotRestoredReasonIndexedDBEvent case BackForwardCacheNotRestoredReasonDummy: *t = BackForwardCacheNotRestoredReasonDummy - case BackForwardCacheNotRestoredReasonAuthorizationHeader: - *t = BackForwardCacheNotRestoredReasonAuthorizationHeader + case BackForwardCacheNotRestoredReasonJsNetworkRequestReceivedCacheControlNoStoreResource: + *t = BackForwardCacheNotRestoredReasonJsNetworkRequestReceivedCacheControlNoStoreResource case BackForwardCacheNotRestoredReasonContentSecurityHandler: *t = BackForwardCacheNotRestoredReasonContentSecurityHandler case BackForwardCacheNotRestoredReasonContentWebAuthenticationAPI: