From ab917191657d16e9bd0f344749ad45bf2d40bb8f Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Mon, 22 Apr 2024 06:02:01 +0700 Subject: [PATCH] Updating to 126.0.6432.1_12.6.56 definitions --- cdproto.go | 5 ++ extensions/easyjson.go | 152 +++++++++++++++++++++++++++++++++++++++ extensions/extensions.go | 65 +++++++++++++++++ page/page.go | 4 +- 4 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 extensions/easyjson.go create mode 100644 extensions/extensions.go diff --git a/cdproto.go b/cdproto.go index 404c326..39d5c4c 100644 --- a/cdproto.go +++ b/cdproto.go @@ -32,6 +32,7 @@ import ( "github.com/chromedp/cdproto/domstorage" "github.com/chromedp/cdproto/emulation" "github.com/chromedp/cdproto/eventbreakpoints" + "github.com/chromedp/cdproto/extensions" "github.com/chromedp/cdproto/fedcm" "github.com/chromedp/cdproto/fetch" "github.com/chromedp/cdproto/headlessexperimental" @@ -354,6 +355,7 @@ const ( CommandEventBreakpointsSetInstrumentationBreakpoint = eventbreakpoints.CommandSetInstrumentationBreakpoint CommandEventBreakpointsRemoveInstrumentationBreakpoint = eventbreakpoints.CommandRemoveInstrumentationBreakpoint CommandEventBreakpointsDisable = eventbreakpoints.CommandDisable + CommandExtensionsLoadUnpacked = extensions.CommandLoadUnpacked CommandFedCmEnable = fedcm.CommandEnable CommandFedCmDisable = fedcm.CommandDisable CommandFedCmSelectAccount = fedcm.CommandSelectAccount @@ -1658,6 +1660,9 @@ func UnmarshalMessage(msg *Message) (interface{}, error) { case CommandEventBreakpointsDisable: return emptyVal, nil + case CommandExtensionsLoadUnpacked: + v = new(extensions.LoadUnpackedReturns) + case CommandFedCmEnable: return emptyVal, nil diff --git a/extensions/easyjson.go b/extensions/easyjson.go new file mode 100644 index 0000000..2d5bab6 --- /dev/null +++ b/extensions/easyjson.go @@ -0,0 +1,152 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package extensions + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions(in *jlexer.Lexer, out *LoadUnpackedReturns) { + 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 "id": + out.ID = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions(out *jwriter.Writer, in LoadUnpackedReturns) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v LoadUnpackedReturns) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v LoadUnpackedReturns) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *LoadUnpackedReturns) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *LoadUnpackedReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions1(in *jlexer.Lexer, out *LoadUnpackedParams) { + 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 "path": + out.Path = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions1(out *jwriter.Writer, in LoadUnpackedParams) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"path\":" + out.RawString(prefix[1:]) + out.String(string(in.Path)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v LoadUnpackedParams) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v LoadUnpackedParams) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoExtensions1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *LoadUnpackedParams) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *LoadUnpackedParams) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoExtensions1(l, v) +} diff --git a/extensions/extensions.go b/extensions/extensions.go new file mode 100644 index 0000000..e246b54 --- /dev/null +++ b/extensions/extensions.go @@ -0,0 +1,65 @@ +// Package extensions provides the Chrome DevTools Protocol +// commands, types, and events for the Extensions domain. +// +// Defines commands and events for browser extensions. Available if the +// client is connected using the --remote-debugging-pipe flag and the +// --enable-unsafe-extension-debugging flag is set. +// +// Generated by the cdproto-gen command. +package extensions + +// Code generated by cdproto-gen. DO NOT EDIT. + +import ( + "context" + + "github.com/chromedp/cdproto/cdp" +) + +// LoadUnpackedParams installs an unpacked extension from the filesystem +// similar to --load-extension CLI flags. Returns extension ID once the +// extension has been installed. +type LoadUnpackedParams struct { + Path string `json:"path"` // Absolute file path. +} + +// LoadUnpacked installs an unpacked extension from the filesystem similar to +// --load-extension CLI flags. Returns extension ID once the extension has been +// installed. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-loadUnpacked +// +// parameters: +// +// path - Absolute file path. +func LoadUnpacked(path string) *LoadUnpackedParams { + return &LoadUnpackedParams{ + Path: path, + } +} + +// LoadUnpackedReturns return values. +type LoadUnpackedReturns struct { + ID string `json:"id,omitempty"` // Extension id. +} + +// Do executes Extensions.loadUnpacked against the provided context. +// +// returns: +// +// id - Extension id. +func (p *LoadUnpackedParams) Do(ctx context.Context) (id string, err error) { + // execute + var res LoadUnpackedReturns + err = cdp.Execute(ctx, CommandLoadUnpacked, p, &res) + if err != nil { + return "", err + } + + return res.ID, nil +} + +// Command names. +const ( + CommandLoadUnpacked = "Extensions.loadUnpacked" +) diff --git a/page/page.go b/page/page.go index 53192f1..6a6bbe9 100644 --- a/page/page.go +++ b/page/page.go @@ -318,7 +318,7 @@ func (p *EnableParams) Do(ctx context.Context) (err error) { // GetAppManifestParams gets the processed manifest for this current // document. This API always waits for the manifest to be loaded. If manifestId // is provided, and it does not match the manifest of the current document, this -// API errors out. If there isn’t a loaded page, this API errors out +// API errors out. If there is not a loaded page, this API errors out // immediately. type GetAppManifestParams struct { ManifestID string `json:"manifestId,omitempty"` @@ -327,7 +327,7 @@ type GetAppManifestParams struct { // GetAppManifest gets the processed manifest for this current document. This // API always waits for the manifest to be loaded. If manifestId is provided, // and it does not match the manifest of the current document, this API errors -// out. If there isn’t a loaded page, this API errors out immediately. +// out. If there is not a loaded page, this API errors out immediately. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-getAppManifest //