Add cdp support for xpath scrapers (#625)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
bnkai
2020-08-04 03:42:40 +03:00
committed by GitHub
parent 1b4a9eed36
commit 4373f9bf01
284 changed files with 133250 additions and 54 deletions

2
go.mod
View File

@@ -4,6 +4,8 @@ require (
github.com/99designs/gqlgen v0.9.0 github.com/99designs/gqlgen v0.9.0
github.com/antchfx/htmlquery v1.2.3 github.com/antchfx/htmlquery v1.2.3
github.com/bmatcuk/doublestar v1.3.1 github.com/bmatcuk/doublestar v1.3.1
github.com/chromedp/cdproto v0.0.0-20200608134039-8a80cdaf865c
github.com/chromedp/chromedp v0.5.3
github.com/disintegration/imaging v1.6.0 github.com/disintegration/imaging v1.6.0
github.com/go-chi/chi v4.0.2+incompatible github.com/go-chi/chi v4.0.2+incompatible
github.com/gobuffalo/packr/v2 v2.0.2 github.com/gobuffalo/packr/v2 v2.0.2

17
go.sum
View File

@@ -42,6 +42,11 @@ github.com/bmatcuk/doublestar v1.3.1/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/chromedp/cdproto v0.0.0-20200116234248-4da64dd111ac/go.mod h1:PfAWWKJqjlGFYJEidUM6aVIWPr0EpobeyVWEEmplX7g=
github.com/chromedp/cdproto v0.0.0-20200608134039-8a80cdaf865c h1:qM1xzKK8kc93zKPkxK4iqtjksqDDrU6g9wGnr30jyLo=
github.com/chromedp/cdproto v0.0.0-20200608134039-8a80cdaf865c/go.mod h1:E6LPWRdIJc11h/di5p0rwvRmUYbhGpBEH7ZbPfzDIOE=
github.com/chromedp/chromedp v0.5.3 h1:F9LafxmYpsQhWQBdCs+6Sret1zzeeFyHS5LkRF//Ffg=
github.com/chromedp/chromedp v0.5.3/go.mod h1:YLdPtndaHQ4rCpSpBG+IPpy9JvX0VD+7aaLxYgYj28w=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
@@ -310,6 +315,12 @@ github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw
github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM=
github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc= github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc=
github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY= github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
@@ -408,6 +419,8 @@ github.com/karrick/godirwalk v1.7.8/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46s
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08 h1:V0an7KRw92wmJysvFvtqtKMAPmvS5O0jtB0nYo6t+gs=
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08/go.mod h1:dFWs1zEqDjFtnBXsd1vPOZaLsESovai349994nHx3e0=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -425,6 +438,9 @@ github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM=
github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM=
github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c=
@@ -722,6 +738,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190426135247-a129542de9ae h1:mQLHiymj/JXKnnjc62tb7nD5pZLs940/sXJu+Xp3DBA= golang.org/x/sys v0.0.0-20190426135247-a129542de9ae h1:mQLHiymj/JXKnnjc62tb7nD5pZLs940/sXJu+Xp3DBA=
golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=

View File

@@ -19,6 +19,7 @@ fragment ConfigGeneralData on ConfigGeneralResult {
logAccess logAccess
excludes excludes
scraperUserAgent scraperUserAgent
scraperCDPPath
} }
fragment ConfigInterfaceData on ConfigInterfaceResult { fragment ConfigInterfaceData on ConfigInterfaceResult {

View File

@@ -58,6 +58,8 @@ input ConfigGeneralInput {
excludes: [String!] excludes: [String!]
"""Scraper user agent string""" """Scraper user agent string"""
scraperUserAgent: String scraperUserAgent: String
"""Scraper CDP path. Path to chrome executable or remote address"""
scraperCDPPath: String
} }
type ConfigGeneralResult { type ConfigGeneralResult {
@@ -101,6 +103,8 @@ type ConfigGeneralResult {
excludes: [String!]! excludes: [String!]!
"""Scraper user agent string""" """Scraper user agent string"""
scraperUserAgent: String scraperUserAgent: String
"""Scraper CDP path. Path to chrome executable or remote address"""
scraperCDPPath: String
} }
input ConfigInterfaceInput { input ConfigInterfaceInput {

View File

@@ -103,8 +103,15 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input models.Co
config.Set(config.Exclude, input.Excludes) config.Set(config.Exclude, input.Excludes)
} }
refreshScraperCache := false
if input.ScraperUserAgent != nil { if input.ScraperUserAgent != nil {
config.Set(config.ScraperUserAgent, input.ScraperUserAgent) config.Set(config.ScraperUserAgent, input.ScraperUserAgent)
refreshScraperCache = true
}
if input.ScraperCDPPath != nil {
config.Set(config.ScraperCDPPath, input.ScraperCDPPath)
refreshScraperCache = true
} }
if err := config.Write(); err != nil { if err := config.Write(); err != nil {
@@ -112,6 +119,9 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input models.Co
} }
manager.GetInstance().RefreshConfig() manager.GetInstance().RefreshConfig()
if refreshScraperCache {
manager.GetInstance().RefreshScraperCache()
}
return makeConfigGeneralResult(), nil return makeConfigGeneralResult(), nil
} }

View File

@@ -40,6 +40,7 @@ func makeConfigGeneralResult() *models.ConfigGeneralResult {
maxStreamingTranscodeSize := config.GetMaxStreamingTranscodeSize() maxStreamingTranscodeSize := config.GetMaxStreamingTranscodeSize()
scraperUserAgent := config.GetScraperUserAgent() scraperUserAgent := config.GetScraperUserAgent()
scraperCDPPath := config.GetScraperCDPPath()
return &models.ConfigGeneralResult{ return &models.ConfigGeneralResult{
Stashes: config.GetStashPaths(), Stashes: config.GetStashPaths(),
@@ -62,6 +63,7 @@ func makeConfigGeneralResult() *models.ConfigGeneralResult {
LogAccess: config.GetLogAccess(), LogAccess: config.GetLogAccess(),
Excludes: config.GetExcludes(), Excludes: config.GetExcludes(),
ScraperUserAgent: &scraperUserAgent, ScraperUserAgent: &scraperUserAgent,
ScraperCDPPath: &scraperCDPPath,
} }
} }

View File

@@ -57,6 +57,7 @@ const SessionStoreKey = "session_store_key"
// scraping options // scraping options
const ScrapersPath = "scrapers_path" const ScrapersPath = "scrapers_path"
const ScraperUserAgent = "scraper_user_agent" const ScraperUserAgent = "scraper_user_agent"
const ScraperCDPPath = "scraper_cdp_path"
// i18n // i18n
const Language = "language" const Language = "language"
@@ -158,6 +159,12 @@ func GetScraperUserAgent() string {
return viper.GetString(ScraperUserAgent) return viper.GetString(ScraperUserAgent)
} }
// GetScraperCDPPath gets the path to the Chrome executable or remote address
// to an instance of Chrome.
func GetScraperCDPPath() string {
return viper.GetString(ScraperCDPPath)
}
func GetHost() string { func GetHost() string {
return viper.GetString(Host) return viper.GetString(Host)
} }

View File

@@ -153,10 +153,12 @@ func initLog() {
logger.Init(config.GetLogFile(), config.GetLogOut(), config.GetLogLevel()) logger.Init(config.GetLogFile(), config.GetLogOut(), config.GetLogLevel())
} }
// initScraperCache initializes a new scraper cache and returns it.
func initScraperCache() *scraper.Cache { func initScraperCache() *scraper.Cache {
scraperConfig := scraper.GlobalConfig{ scraperConfig := scraper.GlobalConfig{
Path: config.GetScrapersPath(), Path: config.GetScrapersPath(),
UserAgent: config.GetScraperUserAgent(), UserAgent: config.GetScraperUserAgent(),
CDPPath: config.GetScraperCDPPath(),
} }
ret, err := scraper.NewCache(scraperConfig) ret, err := scraper.NewCache(scraperConfig)
@@ -178,3 +180,9 @@ func (s *singleton) RefreshConfig() {
paths.EnsureJSONDirs() paths.EnsureJSONDirs()
} }
} }
// RefreshScraperCache refreshes the scraper cache. Call this when scraper
// configuration changes.
func (s *singleton) RefreshScraperCache() {
s.ScraperCache = initScraperCache()
}

View File

@@ -43,6 +43,9 @@ type config struct {
// Xpath scraping configurations // Xpath scraping configurations
XPathScrapers mappedScrapers `yaml:"xPathScrapers"` XPathScrapers mappedScrapers `yaml:"xPathScrapers"`
// Scraping driver options
DriverOptions *scraperDriverOptions `yaml:"driver"`
} }
func (c config) validate() error { func (c config) validate() error {
@@ -135,6 +138,11 @@ type scraperDebugOptions struct {
PrintHTML bool `yaml:"printHTML"` PrintHTML bool `yaml:"printHTML"`
} }
type scraperDriverOptions struct {
UseCDP bool `yaml:"useCDP"`
Sleep int `yaml:"sleep"`
}
func loadScraperFromYAML(id string, reader io.Reader) (*config, error) { func loadScraperFromYAML(id string, reader io.Reader) (*config, error) {
ret := &config{} ret := &config{}

View File

@@ -5,6 +5,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings"
"github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/models"
@@ -14,7 +15,18 @@ import (
type GlobalConfig struct { type GlobalConfig struct {
// User Agent used when scraping using http. // User Agent used when scraping using http.
UserAgent string UserAgent string
Path string
// Path (file or remote address) to a Chrome CDP instance.
CDPPath string
Path string
}
func (c GlobalConfig) isCDPPathHTTP() bool {
return strings.HasPrefix(c.CDPPath, "http://") || strings.HasPrefix(c.CDPPath, "https://")
}
func (c GlobalConfig) isCDPPathWS() bool {
return strings.HasPrefix(c.CDPPath, "ws://")
} }
// Cache stores scraper details. // Cache stores scraper details.

175
pkg/scraper/url.go Normal file
View File

@@ -0,0 +1,175 @@
package scraper
import (
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"os"
"strings"
"time"
"github.com/chromedp/cdproto/dom"
"github.com/chromedp/cdproto/network"
"github.com/chromedp/chromedp"
jsoniter "github.com/json-iterator/go"
"github.com/stashapp/stash/pkg/logger"
"golang.org/x/net/html/charset"
"golang.org/x/net/publicsuffix"
)
func loadURL(url string, scraperConfig config, globalConfig GlobalConfig) (io.Reader, error) {
driverOptions := scraperConfig.DriverOptions
if driverOptions != nil && driverOptions.UseCDP {
// get the page using chrome dp
return urlFromCDP(url, *driverOptions, globalConfig)
}
// get the page using http.Client
options := cookiejar.Options{
PublicSuffixList: publicsuffix.List,
}
jar, er := cookiejar.New(&options)
if er != nil {
return nil, er
}
client := &http.Client{
Timeout: scrapeGetTimeout,
// defaultCheckRedirect code with max changed from 10 to 20
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if len(via) >= 20 {
return errors.New("stopped after 20 redirects")
}
return nil
},
Jar: jar,
}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
userAgent := globalConfig.UserAgent
if userAgent != "" {
req.Header.Set("User-Agent", userAgent)
}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
return charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
}
// func urlFromCDP uses chrome cdp and DOM to load and process the url
// if remote is set as true in the scraperConfig it will try to use localhost:9222
// else it will look for google-chrome in path
func urlFromCDP(url string, driverOptions scraperDriverOptions, globalConfig GlobalConfig) (io.Reader, error) {
const defaultSleep = 2
if !driverOptions.UseCDP {
return nil, fmt.Errorf("Url shouldn't be feetched through CDP")
}
sleep := defaultSleep
if driverOptions.Sleep != 0 {
sleep = driverOptions.Sleep
}
sleepDuration := time.Duration(sleep) * time.Second
act := context.Background()
// if scraperCDPPath is a remote address, then allocate accordingly
if globalConfig.CDPPath != "" {
var cancelAct context.CancelFunc
if globalConfig.isCDPPathHTTP() || globalConfig.isCDPPathWS() {
remote := globalConfig.CDPPath
// if CDPPath is http(s) then we need to get the websocket URL
if globalConfig.isCDPPathHTTP() {
var err error
remote, err = getRemoteCDPWSAddress(remote)
if err != nil {
return nil, err
}
}
act, cancelAct = chromedp.NewRemoteAllocator(context.Background(), remote)
} else {
// user a temporary user directory for chrome
dir, err := ioutil.TempDir("", "stash-chromedp")
if err != nil {
return nil, err
}
defer os.RemoveAll(dir)
opts := append(chromedp.DefaultExecAllocatorOptions[:],
chromedp.UserDataDir(dir),
chromedp.ExecPath(globalConfig.CDPPath),
)
act, cancelAct = chromedp.NewExecAllocator(act, opts...)
}
defer cancelAct()
}
ctx, cancel := chromedp.NewContext(act)
defer cancel()
var res string
err := chromedp.Run(ctx,
network.Enable(),
chromedp.Navigate(url),
chromedp.Sleep(sleepDuration),
chromedp.ActionFunc(func(ctx context.Context) error {
node, err := dom.GetDocument().Do(ctx)
if err != nil {
return err
}
res, err = dom.GetOuterHTML().WithNodeID(node.NodeID).Do(ctx)
return err
}),
)
if err != nil {
return nil, err
}
return strings.NewReader(res), nil
}
// getRemoteCDPWSAddress returns the complete remote address that is required to access the cdp instance
func getRemoteCDPWSAddress(address string) (string, error) {
resp, err := http.Get(address)
if err != nil {
return "", err
}
var result map[string]interface{}
var json = jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return "", err
}
remote := result["webSocketDebuggerUrl"].(string)
logger.Debugf("Remote cdp instance found %s", remote)
return remote, err
}
func cdpNetwork(enable bool) chromedp.Action {
return chromedp.ActionFunc(func(ctx context.Context) error {
if enable {
network.Enable().Do(ctx)
} else {
network.Disable().Do(ctx)
}
return nil
})
}

View File

@@ -3,17 +3,14 @@ package scraper
import ( import (
"bytes" "bytes"
"errors" "errors"
"net/http"
"net/http/cookiejar"
"net/url" "net/url"
"regexp" "regexp"
"strings" "strings"
"time" "time"
"github.com/antchfx/htmlquery" "github.com/antchfx/htmlquery"
"golang.org/x/net/html" "golang.org/x/net/html"
"golang.org/x/net/html/charset"
"golang.org/x/net/publicsuffix"
"github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/models"
@@ -111,42 +108,7 @@ func (s *xpathScraper) scrapeSceneByFragment(scene models.SceneUpdateInput) (*mo
} }
func (s *xpathScraper) loadURL(url string) (*html.Node, error) { func (s *xpathScraper) loadURL(url string) (*html.Node, error) {
options := cookiejar.Options{ r, err := loadURL(url, s.config, s.globalConfig)
PublicSuffixList: publicsuffix.List,
}
jar, er := cookiejar.New(&options)
if er != nil {
return nil, er
}
client := &http.Client{
Timeout: scrapeGetTimeout,
// defaultCheckRedirect code with max changed from 10 to 20
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if len(via) >= 20 {
return errors.New("stopped after 20 redirects")
}
return nil
},
Jar: jar,
}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
userAgent := s.globalConfig.UserAgent
if userAgent != "" {
req.Header.Set("User-Agent", userAgent)
}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
r, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
if err != nil { if err != nil {
return nil, err return nil, err
} }

20
scripts/test_oshash.go Normal file
View File

@@ -0,0 +1,20 @@
// +build ignore
package main
import (
"fmt"
"os"
"github.com/stashapp/stash/pkg/utils"
)
func main() {
hash, err := utils.OSHashFromFilePath(os.Args[1])
if err != nil {
panic(err)
}
fmt.Println(hash)
}

View File

@@ -13,6 +13,7 @@ const markup = `
* Add support for parent/child studios. * Add support for parent/child studios.
### 🎨 Improvements ### 🎨 Improvements
* Add support for chrome dp in xpath scrapers.
* Allow customisation of preview video generation. * Allow customisation of preview video generation.
* Add support for live transcoding in Safari. * Add support for live transcoding in Safari.
* Add mapped and fixed post-processing scraping options. * Add mapped and fixed post-processing scraping options.

View File

@@ -47,6 +47,9 @@ export const SettingsConfigurationPanel: React.FC = () => {
const [scraperUserAgent, setScraperUserAgent] = useState<string | undefined>( const [scraperUserAgent, setScraperUserAgent] = useState<string | undefined>(
undefined undefined
); );
const [scraperCDPPath, setScraperCDPPath] = useState<string | undefined>(
undefined
);
const { data, error, loading } = useConfiguration(); const { data, error, loading } = useConfiguration();
@@ -71,6 +74,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
logAccess, logAccess,
excludes, excludes,
scraperUserAgent, scraperUserAgent,
scraperCDPPath,
}); });
useEffect(() => { useEffect(() => {
@@ -100,6 +104,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
setLogAccess(conf.general.logAccess); setLogAccess(conf.general.logAccess);
setExcludes(conf.general.excludes); setExcludes(conf.general.excludes);
setScraperUserAgent(conf.general.scraperUserAgent ?? undefined); setScraperUserAgent(conf.general.scraperUserAgent ?? undefined);
setScraperCDPPath(conf.general.scraperCDPPath ?? undefined);
} }
}, [data, error]); }, [data, error]);
@@ -425,18 +430,37 @@ export const SettingsConfigurationPanel: React.FC = () => {
</Form.Group> </Form.Group>
</Form.Group> </Form.Group>
<Form.Group id="generated-path"> <Form.Group>
<h6>Scraping</h6> <h4>Scraping</h4>
<Form.Control <Form.Group id="scraperUserAgent">
className="col col-sm-6 text-input" <h6>Scraper User Agent</h6>
defaultValue={scraperUserAgent} <Form.Control
onChange={(e: React.ChangeEvent<HTMLInputElement>) => className="col col-sm-6 text-input"
setScraperUserAgent(e.currentTarget.value) defaultValue={scraperUserAgent}
} onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
/> setScraperUserAgent(e.currentTarget.value)
<Form.Text className="text-muted"> }
User-Agent string used during scrape http requests />
</Form.Text> <Form.Text className="text-muted">
User-Agent string used during scrape http requests
</Form.Text>
</Form.Group>
<Form.Group id="scraperCDPPath">
<h6>Chrome CDP path</h6>
<Form.Control
className="col col-sm-6 text-input"
defaultValue={scraperCDPPath}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setScraperCDPPath(e.currentTarget.value)
}
/>
<Form.Text className="text-muted">
File path to the Chrome executable, or a remote address (starting
with http:// or https://, for example
http://localhost:9222/json/version) to a Chrome instance.
</Form.Text>
</Form.Group>
</Form.Group> </Form.Group>
<hr /> <hr />

View File

@@ -34,10 +34,18 @@ exclude:
_a useful [link](https://regex101.com/) to experiment with regexps_ _a useful [link](https://regex101.com/) to experiment with regexps_
## Scraping User Agent string ## Scraping
### User Agent string
Some websites require a legitimate User-Agent string when receiving requests, or they will be rejected. If entered, this string will be applied as the `User-Agent` header value in http scrape requests. Some websites require a legitimate User-Agent string when receiving requests, or they will be rejected. If entered, this string will be applied as the `User-Agent` header value in http scrape requests.
### Chrome CDP path
Some scrapers require a Chrome instance to function correctly. If left empty, stash will attempt to find the Chrome executable in the path environment, and will fail if it cannot find one.
`Chrome CDP path` can be set to a path to the chrome executable, or an http(s) address to remote chrome instance (for example: `http://localhost:9222/json/version`).
## Authentication ## Authentication
By default, stash is not configured with any sort of password protection. To enable password protection, both `Username` and `Password` must be populated. Note that when entering a new username and password where none was set previously, the system will immediately request these credentials to log you in. By default, stash is not configured with any sort of password protection. To enable password protection, both `Username` and `Password` must be populated. Note that when entering a new username and password where none was set previously, the system will immediately request these credentials to log you in.

View File

@@ -283,6 +283,22 @@ For backwards compatibility, `regex`, `subscraper` and `parseDate` are also allo
Post-processing on attribute post-process is done in the following order: `concat`, `regex`, `subscraper`, `parseDate` and then `split`. Post-processing on attribute post-process is done in the following order: `concat`, `regex`, `subscraper`, `parseDate` and then `split`.
##### CDP support
Some websites deliver content that cannot be scraped using the raw html file alone. These websites use javascript to dynamically load the content. As such, direct xpath scraping will not work on these websites. There is an option to use Chrome DevTools Protocol to load the webpage using an instance of Chrome, then scrape the result.
Chrome CDP support can be enabled for a specific scraping configuration by adding the following to the root of the yml configuration:
```
driver:
useCDP: true
```
Optionally, you can add a `sleep` value under the `driver` section. This specifies the amount of time (in seconds) that the scraper should wait after loading the website to perform the scrape. This is needed as some sites need more time for loading scripts to finish. If unset, this value defaults to 2 seconds.
When `useCDP` is set to true, stash will execute or connect to an instance of Chrome. The behaviour is dictated by the `Chrome CDP path` setting in the user configuration. If left empty, stash will attempt to find the Chrome executable in the path environment, and will fail if it cannot find one.
`Chrome CDP path` can be set to a path to the chrome executable, or an http(s) address to remote chrome instance (for example: `http://localhost:9222/json/version`).
##### Example ##### Example
A performer and scene xpath scraper is shown as an example below: A performer and scene xpath scraper is shown as an example below:

2
vendor/github.com/chromedp/cdproto/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
*.json
*.pdl

24
vendor/github.com/chromedp/cdproto/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,24 @@
dist: bionic
language: go
go:
- 1.12.x
- 1.13.x
env:
- GO111MODULE=off
services:
- docker
addons:
apt:
chrome: stable
before_install:
- mkdir -p $GOPATH/src/github.com/chromedp
- git clone https://github.com/chromedp/chromedp.git $GOPATH/src/github.com/chromedp/chromedp
- cd $GOPATH/src/github.com/chromedp/chromedp
- go get -d -t
script:
- cd $GOPATH/src/github.com/chromedp/cdproto
- go install ./...
- cd $GOPATH/src/github.com/chromedp/chromedp
- go test -v
- go test -c
- docker run --rm --volume=$PWD:/chromedp --entrypoint=/chromedp/chromedp.test --workdir=/chromedp --env=PATH=/headless-shell chromedp/headless-shell:latest -test.v

21
vendor/github.com/chromedp/cdproto/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2020 Kenneth Shaw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

23
vendor/github.com/chromedp/cdproto/README.md generated vendored Normal file
View File

@@ -0,0 +1,23 @@
# About cdproto
Package `cdproto` contains the generated commands, types, and events for the
[Chrome DevTools Protocol domains][devtools-protocol].
This package is generated by the [`cdproto-gen`][cdproto-gen] command. Please
refer to that project and to the main [`chromedp`][chromedp] project for
information on using the commands, types, and events available here.
## API
Please see the [GoDoc listing][godoc].
## Contributing
If you would like to submit a change to the code in this package, please submit
your Pull Request to the [`cdproto-gen`][cdproto-gen] project. Any Issues and
Pull Requests submitted to this project will be closed without being reviewed.
[devtools-protocol]: https://chromedevtools.github.io/devtools-protocol/
[cdproto-gen]: https://github.com/chromedp/cdproto-gen
[chromedp]: https://github.com/chromedp/chromedp
[godoc]: https://godoc.org/github.com/chromedp/cdproto

View File

@@ -0,0 +1,153 @@
// Package accessibility provides the Chrome DevTools Protocol
// commands, types, and events for the Accessibility domain.
//
// Generated by the cdproto-gen command.
package accessibility
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
)
// DisableParams disables the accessibility domain.
type DisableParams struct{}
// Disable disables the accessibility domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Accessibility.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables the accessibility domain which causes AXNodeIds to
// remain consistent between method calls. This turns on accessibility for the
// page, which can impact performance until accessibility is disabled.
type EnableParams struct{}
// Enable enables the accessibility domain which causes AXNodeIds to remain
// consistent between method calls. This turns on accessibility for the page,
// which can impact performance until accessibility is disabled.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Accessibility.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetPartialAXTreeParams fetches the accessibility node and partial
// accessibility tree for this DOM node, if it exists.
type GetPartialAXTreeParams struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to get the partial accessibility tree for.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to get the partial accessibility tree for.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node wrapper to get the partial accessibility tree for.
FetchRelatives bool `json:"fetchRelatives,omitempty"` // Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
}
// GetPartialAXTree fetches the accessibility node and partial accessibility
// tree for this DOM node, if it exists.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-getPartialAXTree
//
// parameters:
func GetPartialAXTree() *GetPartialAXTreeParams {
return &GetPartialAXTreeParams{}
}
// WithNodeID identifier of the node to get the partial accessibility tree
// for.
func (p GetPartialAXTreeParams) WithNodeID(nodeID cdp.NodeID) *GetPartialAXTreeParams {
p.NodeID = nodeID
return &p
}
// WithBackendNodeID identifier of the backend node to get the partial
// accessibility tree for.
func (p GetPartialAXTreeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *GetPartialAXTreeParams {
p.BackendNodeID = backendNodeID
return &p
}
// WithObjectID JavaScript object id of the node wrapper to get the partial
// accessibility tree for.
func (p GetPartialAXTreeParams) WithObjectID(objectID runtime.RemoteObjectID) *GetPartialAXTreeParams {
p.ObjectID = objectID
return &p
}
// WithFetchRelatives whether to fetch this nodes ancestors, siblings and
// children. Defaults to true.
func (p GetPartialAXTreeParams) WithFetchRelatives(fetchRelatives bool) *GetPartialAXTreeParams {
p.FetchRelatives = fetchRelatives
return &p
}
// GetPartialAXTreeReturns return values.
type GetPartialAXTreeReturns struct {
Nodes []*Node `json:"nodes,omitempty"` // The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
}
// Do executes Accessibility.getPartialAXTree against the provided context.
//
// returns:
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
func (p *GetPartialAXTreeParams) Do(ctx context.Context) (nodes []*Node, err error) {
// execute
var res GetPartialAXTreeReturns
err = cdp.Execute(ctx, CommandGetPartialAXTree, p, &res)
if err != nil {
return nil, err
}
return res.Nodes, nil
}
// GetFullAXTreeParams fetches the entire accessibility tree.
type GetFullAXTreeParams struct{}
// GetFullAXTree fetches the entire accessibility tree.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#method-getFullAXTree
func GetFullAXTree() *GetFullAXTreeParams {
return &GetFullAXTreeParams{}
}
// GetFullAXTreeReturns return values.
type GetFullAXTreeReturns struct {
Nodes []*Node `json:"nodes,omitempty"`
}
// Do executes Accessibility.getFullAXTree against the provided context.
//
// returns:
// nodes
func (p *GetFullAXTreeParams) Do(ctx context.Context) (nodes []*Node, err error) {
// execute
var res GetFullAXTreeReturns
err = cdp.Execute(ctx, CommandGetFullAXTree, nil, &res)
if err != nil {
return nil, err
}
return res.Nodes, nil
}
// Command names.
const (
CommandDisable = "Accessibility.disable"
CommandEnable = "Accessibility.enable"
CommandGetPartialAXTree = "Accessibility.getPartialAXTree"
CommandGetFullAXTree = "Accessibility.getFullAXTree"
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,448 @@
package accessibility
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// NodeID unique accessibility node identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXNodeId
type NodeID string
// String returns the NodeID as string value.
func (t NodeID) String() string {
return string(t)
}
// ValueType enum of possible property types.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXValueType
type ValueType string
// String returns the ValueType as string value.
func (t ValueType) String() string {
return string(t)
}
// ValueType values.
const (
ValueTypeBoolean ValueType = "boolean"
ValueTypeTristate ValueType = "tristate"
ValueTypeBooleanOrUndefined ValueType = "booleanOrUndefined"
ValueTypeIdref ValueType = "idref"
ValueTypeIdrefList ValueType = "idrefList"
ValueTypeInteger ValueType = "integer"
ValueTypeNode ValueType = "node"
ValueTypeNodeList ValueType = "nodeList"
ValueTypeNumber ValueType = "number"
ValueTypeString ValueType = "string"
ValueTypeComputedString ValueType = "computedString"
ValueTypeToken ValueType = "token"
ValueTypeTokenList ValueType = "tokenList"
ValueTypeDomRelation ValueType = "domRelation"
ValueTypeRole ValueType = "role"
ValueTypeInternalRole ValueType = "internalRole"
ValueTypeValueUndefined ValueType = "valueUndefined"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ValueType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ValueType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ValueType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ValueType(in.String()) {
case ValueTypeBoolean:
*t = ValueTypeBoolean
case ValueTypeTristate:
*t = ValueTypeTristate
case ValueTypeBooleanOrUndefined:
*t = ValueTypeBooleanOrUndefined
case ValueTypeIdref:
*t = ValueTypeIdref
case ValueTypeIdrefList:
*t = ValueTypeIdrefList
case ValueTypeInteger:
*t = ValueTypeInteger
case ValueTypeNode:
*t = ValueTypeNode
case ValueTypeNodeList:
*t = ValueTypeNodeList
case ValueTypeNumber:
*t = ValueTypeNumber
case ValueTypeString:
*t = ValueTypeString
case ValueTypeComputedString:
*t = ValueTypeComputedString
case ValueTypeToken:
*t = ValueTypeToken
case ValueTypeTokenList:
*t = ValueTypeTokenList
case ValueTypeDomRelation:
*t = ValueTypeDomRelation
case ValueTypeRole:
*t = ValueTypeRole
case ValueTypeInternalRole:
*t = ValueTypeInternalRole
case ValueTypeValueUndefined:
*t = ValueTypeValueUndefined
default:
in.AddError(errors.New("unknown ValueType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ValueType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ValueSourceType enum of possible property sources.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXValueSourceType
type ValueSourceType string
// String returns the ValueSourceType as string value.
func (t ValueSourceType) String() string {
return string(t)
}
// ValueSourceType values.
const (
ValueSourceTypeAttribute ValueSourceType = "attribute"
ValueSourceTypeImplicit ValueSourceType = "implicit"
ValueSourceTypeStyle ValueSourceType = "style"
ValueSourceTypeContents ValueSourceType = "contents"
ValueSourceTypePlaceholder ValueSourceType = "placeholder"
ValueSourceTypeRelatedElement ValueSourceType = "relatedElement"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ValueSourceType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ValueSourceType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ValueSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ValueSourceType(in.String()) {
case ValueSourceTypeAttribute:
*t = ValueSourceTypeAttribute
case ValueSourceTypeImplicit:
*t = ValueSourceTypeImplicit
case ValueSourceTypeStyle:
*t = ValueSourceTypeStyle
case ValueSourceTypeContents:
*t = ValueSourceTypeContents
case ValueSourceTypePlaceholder:
*t = ValueSourceTypePlaceholder
case ValueSourceTypeRelatedElement:
*t = ValueSourceTypeRelatedElement
default:
in.AddError(errors.New("unknown ValueSourceType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ValueSourceType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ValueNativeSourceType enum of possible native property sources (as a
// subtype of a particular AXValueSourceType).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXValueNativeSourceType
type ValueNativeSourceType string
// String returns the ValueNativeSourceType as string value.
func (t ValueNativeSourceType) String() string {
return string(t)
}
// ValueNativeSourceType values.
const (
ValueNativeSourceTypeFigcaption ValueNativeSourceType = "figcaption"
ValueNativeSourceTypeLabel ValueNativeSourceType = "label"
ValueNativeSourceTypeLabelfor ValueNativeSourceType = "labelfor"
ValueNativeSourceTypeLabelwrapped ValueNativeSourceType = "labelwrapped"
ValueNativeSourceTypeLegend ValueNativeSourceType = "legend"
ValueNativeSourceTypeTablecaption ValueNativeSourceType = "tablecaption"
ValueNativeSourceTypeTitle ValueNativeSourceType = "title"
ValueNativeSourceTypeOther ValueNativeSourceType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ValueNativeSourceType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ValueNativeSourceType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ValueNativeSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ValueNativeSourceType(in.String()) {
case ValueNativeSourceTypeFigcaption:
*t = ValueNativeSourceTypeFigcaption
case ValueNativeSourceTypeLabel:
*t = ValueNativeSourceTypeLabel
case ValueNativeSourceTypeLabelfor:
*t = ValueNativeSourceTypeLabelfor
case ValueNativeSourceTypeLabelwrapped:
*t = ValueNativeSourceTypeLabelwrapped
case ValueNativeSourceTypeLegend:
*t = ValueNativeSourceTypeLegend
case ValueNativeSourceTypeTablecaption:
*t = ValueNativeSourceTypeTablecaption
case ValueNativeSourceTypeTitle:
*t = ValueNativeSourceTypeTitle
case ValueNativeSourceTypeOther:
*t = ValueNativeSourceTypeOther
default:
in.AddError(errors.New("unknown ValueNativeSourceType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ValueNativeSourceType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ValueSource a single source for a computed AX property.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXValueSource
type ValueSource struct {
Type ValueSourceType `json:"type"` // What type of source this is.
Value *Value `json:"value,omitempty"` // The value of this property source.
Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any.
AttributeValue *Value `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any.
Superseded bool `json:"superseded,omitempty"` // Whether this source is superseded by a higher priority source.
NativeSource ValueNativeSourceType `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a <label> element.
NativeSourceValue *Value `json:"nativeSourceValue,omitempty"` // The value, such as a node or node list, of the native source.
Invalid bool `json:"invalid,omitempty"` // Whether the value for this property is invalid.
InvalidReason string `json:"invalidReason,omitempty"` // Reason for the value being invalid, if it is.
}
// RelatedNode [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXRelatedNode
type RelatedNode struct {
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId"` // The BackendNodeId of the related DOM node.
Idref string `json:"idref,omitempty"` // The IDRef value provided, if any.
Text string `json:"text,omitempty"` // The text alternative of this node in the current context.
}
// Property [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXProperty
type Property struct {
Name PropertyName `json:"name"` // The name of this property.
Value *Value `json:"value"` // The value of this property.
}
// Value a single computed AX property.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXValue
type Value struct {
Type ValueType `json:"type"` // The type of this value.
Value easyjson.RawMessage `json:"value,omitempty"` // The computed value of this property.
RelatedNodes []*RelatedNode `json:"relatedNodes,omitempty"` // One or more related nodes, if applicable.
Sources []*ValueSource `json:"sources,omitempty"` // The sources which contributed to the computation of this property.
}
// PropertyName values of AXProperty name: - from 'busy' to
// 'roledescription': states which apply to every AX node - from 'live' to
// 'root': attributes which apply to nodes in live regions - from 'autocomplete'
// to 'valuetext': attributes which apply to widgets - from 'checked' to
// 'selected': states which apply to widgets - from 'activedescendant' to 'owns'
// - relationships between elements other than parent/child/sibling.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXPropertyName
type PropertyName string
// String returns the PropertyName as string value.
func (t PropertyName) String() string {
return string(t)
}
// PropertyName values.
const (
PropertyNameBusy PropertyName = "busy"
PropertyNameDisabled PropertyName = "disabled"
PropertyNameEditable PropertyName = "editable"
PropertyNameFocusable PropertyName = "focusable"
PropertyNameFocused PropertyName = "focused"
PropertyNameHidden PropertyName = "hidden"
PropertyNameHiddenRoot PropertyName = "hiddenRoot"
PropertyNameInvalid PropertyName = "invalid"
PropertyNameKeyshortcuts PropertyName = "keyshortcuts"
PropertyNameSettable PropertyName = "settable"
PropertyNameRoledescription PropertyName = "roledescription"
PropertyNameLive PropertyName = "live"
PropertyNameAtomic PropertyName = "atomic"
PropertyNameRelevant PropertyName = "relevant"
PropertyNameRoot PropertyName = "root"
PropertyNameAutocomplete PropertyName = "autocomplete"
PropertyNameHasPopup PropertyName = "hasPopup"
PropertyNameLevel PropertyName = "level"
PropertyNameMultiselectable PropertyName = "multiselectable"
PropertyNameOrientation PropertyName = "orientation"
PropertyNameMultiline PropertyName = "multiline"
PropertyNameReadonly PropertyName = "readonly"
PropertyNameRequired PropertyName = "required"
PropertyNameValuemin PropertyName = "valuemin"
PropertyNameValuemax PropertyName = "valuemax"
PropertyNameValuetext PropertyName = "valuetext"
PropertyNameChecked PropertyName = "checked"
PropertyNameExpanded PropertyName = "expanded"
PropertyNameModal PropertyName = "modal"
PropertyNamePressed PropertyName = "pressed"
PropertyNameSelected PropertyName = "selected"
PropertyNameActivedescendant PropertyName = "activedescendant"
PropertyNameControls PropertyName = "controls"
PropertyNameDescribedby PropertyName = "describedby"
PropertyNameDetails PropertyName = "details"
PropertyNameErrormessage PropertyName = "errormessage"
PropertyNameFlowto PropertyName = "flowto"
PropertyNameLabelledby PropertyName = "labelledby"
PropertyNameOwns PropertyName = "owns"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PropertyName) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PropertyName) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PropertyName) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PropertyName(in.String()) {
case PropertyNameBusy:
*t = PropertyNameBusy
case PropertyNameDisabled:
*t = PropertyNameDisabled
case PropertyNameEditable:
*t = PropertyNameEditable
case PropertyNameFocusable:
*t = PropertyNameFocusable
case PropertyNameFocused:
*t = PropertyNameFocused
case PropertyNameHidden:
*t = PropertyNameHidden
case PropertyNameHiddenRoot:
*t = PropertyNameHiddenRoot
case PropertyNameInvalid:
*t = PropertyNameInvalid
case PropertyNameKeyshortcuts:
*t = PropertyNameKeyshortcuts
case PropertyNameSettable:
*t = PropertyNameSettable
case PropertyNameRoledescription:
*t = PropertyNameRoledescription
case PropertyNameLive:
*t = PropertyNameLive
case PropertyNameAtomic:
*t = PropertyNameAtomic
case PropertyNameRelevant:
*t = PropertyNameRelevant
case PropertyNameRoot:
*t = PropertyNameRoot
case PropertyNameAutocomplete:
*t = PropertyNameAutocomplete
case PropertyNameHasPopup:
*t = PropertyNameHasPopup
case PropertyNameLevel:
*t = PropertyNameLevel
case PropertyNameMultiselectable:
*t = PropertyNameMultiselectable
case PropertyNameOrientation:
*t = PropertyNameOrientation
case PropertyNameMultiline:
*t = PropertyNameMultiline
case PropertyNameReadonly:
*t = PropertyNameReadonly
case PropertyNameRequired:
*t = PropertyNameRequired
case PropertyNameValuemin:
*t = PropertyNameValuemin
case PropertyNameValuemax:
*t = PropertyNameValuemax
case PropertyNameValuetext:
*t = PropertyNameValuetext
case PropertyNameChecked:
*t = PropertyNameChecked
case PropertyNameExpanded:
*t = PropertyNameExpanded
case PropertyNameModal:
*t = PropertyNameModal
case PropertyNamePressed:
*t = PropertyNamePressed
case PropertyNameSelected:
*t = PropertyNameSelected
case PropertyNameActivedescendant:
*t = PropertyNameActivedescendant
case PropertyNameControls:
*t = PropertyNameControls
case PropertyNameDescribedby:
*t = PropertyNameDescribedby
case PropertyNameDetails:
*t = PropertyNameDetails
case PropertyNameErrormessage:
*t = PropertyNameErrormessage
case PropertyNameFlowto:
*t = PropertyNameFlowto
case PropertyNameLabelledby:
*t = PropertyNameLabelledby
case PropertyNameOwns:
*t = PropertyNameOwns
default:
in.AddError(errors.New("unknown PropertyName value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PropertyName) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Node a node in the accessibility tree.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Accessibility#type-AXNode
type Node struct {
NodeID NodeID `json:"nodeId"` // Unique identifier for this node.
Ignored bool `json:"ignored"` // Whether this node is ignored for accessibility
IgnoredReasons []*Property `json:"ignoredReasons,omitempty"` // Collection of reasons why this node is hidden.
Role *Value `json:"role,omitempty"` // This Node's role, whether explicit or implicit.
Name *Value `json:"name,omitempty"` // The accessible name for this Node.
Description *Value `json:"description,omitempty"` // The accessible description for this Node.
Value *Value `json:"value,omitempty"` // The value for this Node.
Properties []*Property `json:"properties,omitempty"` // All other properties
ChildIds []NodeID `json:"childIds,omitempty"` // IDs for each of this node's child nodes.
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId,omitempty"` // The backend ID for the associated DOM node, if any.
}

View File

@@ -0,0 +1,288 @@
// Package animation provides the Chrome DevTools Protocol
// commands, types, and events for the Animation domain.
//
// Generated by the cdproto-gen command.
package animation
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
)
// DisableParams disables animation domain notifications.
type DisableParams struct{}
// Disable disables animation domain notifications.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Animation.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables animation domain notifications.
type EnableParams struct{}
// Enable enables animation domain notifications.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Animation.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetCurrentTimeParams returns the current time of the an animation.
type GetCurrentTimeParams struct {
ID string `json:"id"` // Id of animation.
}
// GetCurrentTime returns the current time of the an animation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-getCurrentTime
//
// parameters:
// id - Id of animation.
func GetCurrentTime(id string) *GetCurrentTimeParams {
return &GetCurrentTimeParams{
ID: id,
}
}
// GetCurrentTimeReturns return values.
type GetCurrentTimeReturns struct {
CurrentTime float64 `json:"currentTime,omitempty"` // Current time of the page.
}
// Do executes Animation.getCurrentTime against the provided context.
//
// returns:
// currentTime - Current time of the page.
func (p *GetCurrentTimeParams) Do(ctx context.Context) (currentTime float64, err error) {
// execute
var res GetCurrentTimeReturns
err = cdp.Execute(ctx, CommandGetCurrentTime, p, &res)
if err != nil {
return 0, err
}
return res.CurrentTime, nil
}
// GetPlaybackRateParams gets the playback rate of the document timeline.
type GetPlaybackRateParams struct{}
// GetPlaybackRate gets the playback rate of the document timeline.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-getPlaybackRate
func GetPlaybackRate() *GetPlaybackRateParams {
return &GetPlaybackRateParams{}
}
// GetPlaybackRateReturns return values.
type GetPlaybackRateReturns struct {
PlaybackRate float64 `json:"playbackRate,omitempty"` // Playback rate for animations on page.
}
// Do executes Animation.getPlaybackRate against the provided context.
//
// returns:
// playbackRate - Playback rate for animations on page.
func (p *GetPlaybackRateParams) Do(ctx context.Context) (playbackRate float64, err error) {
// execute
var res GetPlaybackRateReturns
err = cdp.Execute(ctx, CommandGetPlaybackRate, nil, &res)
if err != nil {
return 0, err
}
return res.PlaybackRate, nil
}
// ReleaseAnimationsParams releases a set of animations to no longer be
// manipulated.
type ReleaseAnimationsParams struct {
Animations []string `json:"animations"` // List of animation ids to seek.
}
// ReleaseAnimations releases a set of animations to no longer be
// manipulated.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-releaseAnimations
//
// parameters:
// animations - List of animation ids to seek.
func ReleaseAnimations(animations []string) *ReleaseAnimationsParams {
return &ReleaseAnimationsParams{
Animations: animations,
}
}
// Do executes Animation.releaseAnimations against the provided context.
func (p *ReleaseAnimationsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandReleaseAnimations, p, nil)
}
// ResolveAnimationParams gets the remote object of the Animation.
type ResolveAnimationParams struct {
AnimationID string `json:"animationId"` // Animation id.
}
// ResolveAnimation gets the remote object of the Animation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-resolveAnimation
//
// parameters:
// animationID - Animation id.
func ResolveAnimation(animationID string) *ResolveAnimationParams {
return &ResolveAnimationParams{
AnimationID: animationID,
}
}
// ResolveAnimationReturns return values.
type ResolveAnimationReturns struct {
RemoteObject *runtime.RemoteObject `json:"remoteObject,omitempty"` // Corresponding remote object.
}
// Do executes Animation.resolveAnimation against the provided context.
//
// returns:
// remoteObject - Corresponding remote object.
func (p *ResolveAnimationParams) Do(ctx context.Context) (remoteObject *runtime.RemoteObject, err error) {
// execute
var res ResolveAnimationReturns
err = cdp.Execute(ctx, CommandResolveAnimation, p, &res)
if err != nil {
return nil, err
}
return res.RemoteObject, nil
}
// SeekAnimationsParams seek a set of animations to a particular time within
// each animation.
type SeekAnimationsParams struct {
Animations []string `json:"animations"` // List of animation ids to seek.
CurrentTime float64 `json:"currentTime"` // Set the current time of each animation.
}
// SeekAnimations seek a set of animations to a particular time within each
// animation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-seekAnimations
//
// parameters:
// animations - List of animation ids to seek.
// currentTime - Set the current time of each animation.
func SeekAnimations(animations []string, currentTime float64) *SeekAnimationsParams {
return &SeekAnimationsParams{
Animations: animations,
CurrentTime: currentTime,
}
}
// Do executes Animation.seekAnimations against the provided context.
func (p *SeekAnimationsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSeekAnimations, p, nil)
}
// SetPausedParams sets the paused state of a set of animations.
type SetPausedParams struct {
Animations []string `json:"animations"` // Animations to set the pause state of.
Paused bool `json:"paused"` // Paused state to set to.
}
// SetPaused sets the paused state of a set of animations.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-setPaused
//
// parameters:
// animations - Animations to set the pause state of.
// paused - Paused state to set to.
func SetPaused(animations []string, paused bool) *SetPausedParams {
return &SetPausedParams{
Animations: animations,
Paused: paused,
}
}
// Do executes Animation.setPaused against the provided context.
func (p *SetPausedParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetPaused, p, nil)
}
// SetPlaybackRateParams sets the playback rate of the document timeline.
type SetPlaybackRateParams struct {
PlaybackRate float64 `json:"playbackRate"` // Playback rate for animations on page
}
// SetPlaybackRate sets the playback rate of the document timeline.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-setPlaybackRate
//
// parameters:
// playbackRate - Playback rate for animations on page
func SetPlaybackRate(playbackRate float64) *SetPlaybackRateParams {
return &SetPlaybackRateParams{
PlaybackRate: playbackRate,
}
}
// Do executes Animation.setPlaybackRate against the provided context.
func (p *SetPlaybackRateParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetPlaybackRate, p, nil)
}
// SetTimingParams sets the timing of an animation node.
type SetTimingParams struct {
AnimationID string `json:"animationId"` // Animation id.
Duration float64 `json:"duration"` // Duration of the animation.
Delay float64 `json:"delay"` // Delay of the animation.
}
// SetTiming sets the timing of an animation node.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#method-setTiming
//
// parameters:
// animationID - Animation id.
// duration - Duration of the animation.
// delay - Delay of the animation.
func SetTiming(animationID string, duration float64, delay float64) *SetTimingParams {
return &SetTimingParams{
AnimationID: animationID,
Duration: duration,
Delay: delay,
}
}
// Do executes Animation.setTiming against the provided context.
func (p *SetTimingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetTiming, p, nil)
}
// Command names.
const (
CommandDisable = "Animation.disable"
CommandEnable = "Animation.enable"
CommandGetCurrentTime = "Animation.getCurrentTime"
CommandGetPlaybackRate = "Animation.getPlaybackRate"
CommandReleaseAnimations = "Animation.releaseAnimations"
CommandResolveAnimation = "Animation.resolveAnimation"
CommandSeekAnimations = "Animation.seekAnimations"
CommandSetPaused = "Animation.setPaused"
CommandSetPlaybackRate = "Animation.setPlaybackRate"
CommandSetTiming = "Animation.setTiming"
)

1672
vendor/github.com/chromedp/cdproto/animation/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

24
vendor/github.com/chromedp/cdproto/animation/events.go generated vendored Normal file
View File

@@ -0,0 +1,24 @@
package animation
// Code generated by cdproto-gen. DO NOT EDIT.
// EventAnimationCanceled event for when an animation has been cancelled.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#event-animationCanceled
type EventAnimationCanceled struct {
ID string `json:"id"` // Id of the animation that was cancelled.
}
// EventAnimationCreated event for each animation that has been created.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#event-animationCreated
type EventAnimationCreated struct {
ID string `json:"id"` // Id of the animation that was created.
}
// EventAnimationStarted event for animation that has been started.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#event-animationStarted
type EventAnimationStarted struct {
Animation *Animation `json:"animation"` // Animation that was started.
}

107
vendor/github.com/chromedp/cdproto/animation/types.go generated vendored Normal file
View File

@@ -0,0 +1,107 @@
package animation
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Animation animation instance.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#type-Animation
type Animation struct {
ID string `json:"id"` // Animation's id.
Name string `json:"name"` // Animation's name.
PausedState bool `json:"pausedState"` // Animation's internal paused state.
PlayState string `json:"playState"` // Animation's play state.
PlaybackRate float64 `json:"playbackRate"` // Animation's playback rate.
StartTime float64 `json:"startTime"` // Animation's start time.
CurrentTime float64 `json:"currentTime"` // Animation's current time.
Type Type `json:"type"` // Animation type of Animation.
Source *Effect `json:"source,omitempty"` // Animation's source animation node.
CSSID string `json:"cssId,omitempty"` // A unique ID for Animation representing the sources that triggered this CSS animation/transition.
}
// Effect animationEffect instance.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#type-AnimationEffect
type Effect struct {
Delay float64 `json:"delay"` // AnimationEffect's delay.
EndDelay float64 `json:"endDelay"` // AnimationEffect's end delay.
IterationStart float64 `json:"iterationStart"` // AnimationEffect's iteration start.
Iterations float64 `json:"iterations"` // AnimationEffect's iterations.
Duration float64 `json:"duration"` // AnimationEffect's iteration duration.
Direction string `json:"direction"` // AnimationEffect's playback direction.
Fill string `json:"fill"` // AnimationEffect's fill mode.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // AnimationEffect's target node.
KeyframesRule *KeyframesRule `json:"keyframesRule,omitempty"` // AnimationEffect's keyframes.
Easing string `json:"easing"` // AnimationEffect's timing function.
}
// KeyframesRule keyframes Rule.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#type-KeyframesRule
type KeyframesRule struct {
Name string `json:"name,omitempty"` // CSS keyframed animation's name.
Keyframes []*KeyframeStyle `json:"keyframes"` // List of animation keyframes.
}
// KeyframeStyle keyframe Style.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#type-KeyframeStyle
type KeyframeStyle struct {
Offset string `json:"offset"` // Keyframe's time offset.
Easing string `json:"easing"` // AnimationEffect's timing function.
}
// Type animation type of Animation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Animation#type-Animation
type Type string
// String returns the Type as string value.
func (t Type) String() string {
return string(t)
}
// Type values.
const (
TypeCSSTransition Type = "CSSTransition"
TypeCSSAnimation Type = "CSSAnimation"
TypeWebAnimation Type = "WebAnimation"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Type) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Type(in.String()) {
case TypeCSSTransition:
*t = TypeCSSTransition
case TypeCSSAnimation:
*t = TypeCSSAnimation
case TypeWebAnimation:
*t = TypeWebAnimation
default:
in.AddError(errors.New("unknown Type value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Type) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@@ -0,0 +1,147 @@
// Package applicationcache provides the Chrome DevTools Protocol
// commands, types, and events for the ApplicationCache domain.
//
// Generated by the cdproto-gen command.
package applicationcache
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// EnableParams enables application cache domain notifications.
type EnableParams struct{}
// Enable enables application cache domain notifications.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes ApplicationCache.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetApplicationCacheForFrameParams returns relevant application cache data
// for the document in given frame.
type GetApplicationCacheForFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache is retrieved.
}
// GetApplicationCacheForFrame returns relevant application cache data for
// the document in given frame.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getApplicationCacheForFrame
//
// parameters:
// frameID - Identifier of the frame containing document whose application cache is retrieved.
func GetApplicationCacheForFrame(frameID cdp.FrameID) *GetApplicationCacheForFrameParams {
return &GetApplicationCacheForFrameParams{
FrameID: frameID,
}
}
// GetApplicationCacheForFrameReturns return values.
type GetApplicationCacheForFrameReturns struct {
ApplicationCache *ApplicationCache `json:"applicationCache,omitempty"` // Relevant application cache data for the document in given frame.
}
// Do executes ApplicationCache.getApplicationCacheForFrame against the provided context.
//
// returns:
// applicationCache - Relevant application cache data for the document in given frame.
func (p *GetApplicationCacheForFrameParams) Do(ctx context.Context) (applicationCache *ApplicationCache, err error) {
// execute
var res GetApplicationCacheForFrameReturns
err = cdp.Execute(ctx, CommandGetApplicationCacheForFrame, p, &res)
if err != nil {
return nil, err
}
return res.ApplicationCache, nil
}
// GetFramesWithManifestsParams returns array of frame identifiers with
// manifest urls for each frame containing a document associated with some
// application cache.
type GetFramesWithManifestsParams struct{}
// GetFramesWithManifests returns array of frame identifiers with manifest
// urls for each frame containing a document associated with some application
// cache.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getFramesWithManifests
func GetFramesWithManifests() *GetFramesWithManifestsParams {
return &GetFramesWithManifestsParams{}
}
// GetFramesWithManifestsReturns return values.
type GetFramesWithManifestsReturns struct {
FrameIds []*FrameWithManifest `json:"frameIds,omitempty"` // Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
}
// Do executes ApplicationCache.getFramesWithManifests against the provided context.
//
// returns:
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
func (p *GetFramesWithManifestsParams) Do(ctx context.Context) (frameIds []*FrameWithManifest, err error) {
// execute
var res GetFramesWithManifestsReturns
err = cdp.Execute(ctx, CommandGetFramesWithManifests, nil, &res)
if err != nil {
return nil, err
}
return res.FrameIds, nil
}
// GetManifestForFrameParams returns manifest URL for document in the given
// frame.
type GetManifestForFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose manifest is retrieved.
}
// GetManifestForFrame returns manifest URL for document in the given frame.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#method-getManifestForFrame
//
// parameters:
// frameID - Identifier of the frame containing document whose manifest is retrieved.
func GetManifestForFrame(frameID cdp.FrameID) *GetManifestForFrameParams {
return &GetManifestForFrameParams{
FrameID: frameID,
}
}
// GetManifestForFrameReturns return values.
type GetManifestForFrameReturns struct {
ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL for document in the given frame.
}
// Do executes ApplicationCache.getManifestForFrame against the provided context.
//
// returns:
// manifestURL - Manifest URL for document in the given frame.
func (p *GetManifestForFrameParams) Do(ctx context.Context) (manifestURL string, err error) {
// execute
var res GetManifestForFrameReturns
err = cdp.Execute(ctx, CommandGetManifestForFrame, p, &res)
if err != nil {
return "", err
}
return res.ManifestURL, nil
}
// Command names.
const (
CommandEnable = "ApplicationCache.enable"
CommandGetApplicationCacheForFrame = "ApplicationCache.getApplicationCacheForFrame"
CommandGetFramesWithManifests = "ApplicationCache.getFramesWithManifests"
CommandGetManifestForFrame = "ApplicationCache.getManifestForFrame"
)

View File

@@ -0,0 +1,964 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package applicationcache
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache(in *jlexer.Lexer, out *Resource) {
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 "url":
out.URL = string(in.String())
case "size":
out.Size = int64(in.Int64())
case "type":
out.Type = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache(out *jwriter.Writer, in Resource) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"url\":"
out.RawString(prefix[1:])
out.String(string(in.URL))
}
{
const prefix string = ",\"size\":"
out.RawString(prefix)
out.Int64(int64(in.Size))
}
{
const prefix string = ",\"type\":"
out.RawString(prefix)
out.String(string(in.Type))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Resource) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Resource) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Resource) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Resource) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache1(in *jlexer.Lexer, out *GetManifestForFrameReturns) {
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 "manifestURL":
out.ManifestURL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache1(out *jwriter.Writer, in GetManifestForFrameReturns) {
out.RawByte('{')
first := true
_ = first
if in.ManifestURL != "" {
const prefix string = ",\"manifestURL\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.ManifestURL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetManifestForFrameReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetManifestForFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetManifestForFrameReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetManifestForFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache2(in *jlexer.Lexer, out *GetManifestForFrameParams) {
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 "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache2(out *jwriter.Writer, in GetManifestForFrameParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"frameId\":"
out.RawString(prefix[1:])
out.String(string(in.FrameID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetManifestForFrameParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetManifestForFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetManifestForFrameParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetManifestForFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache3(in *jlexer.Lexer, out *GetFramesWithManifestsReturns) {
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 "frameIds":
if in.IsNull() {
in.Skip()
out.FrameIds = nil
} else {
in.Delim('[')
if out.FrameIds == nil {
if !in.IsDelim(']') {
out.FrameIds = make([]*FrameWithManifest, 0, 8)
} else {
out.FrameIds = []*FrameWithManifest{}
}
} else {
out.FrameIds = (out.FrameIds)[:0]
}
for !in.IsDelim(']') {
var v1 *FrameWithManifest
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(FrameWithManifest)
}
(*v1).UnmarshalEasyJSON(in)
}
out.FrameIds = append(out.FrameIds, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache3(out *jwriter.Writer, in GetFramesWithManifestsReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.FrameIds) != 0 {
const prefix string = ",\"frameIds\":"
first = false
out.RawString(prefix[1:])
{
out.RawByte('[')
for v2, v3 := range in.FrameIds {
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 GetFramesWithManifestsReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetFramesWithManifestsReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetFramesWithManifestsReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetFramesWithManifestsReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache4(in *jlexer.Lexer, out *GetFramesWithManifestsParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache4(out *jwriter.Writer, in GetFramesWithManifestsParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetFramesWithManifestsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetFramesWithManifestsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetFramesWithManifestsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetFramesWithManifestsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache5(in *jlexer.Lexer, out *GetApplicationCacheForFrameReturns) {
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 "applicationCache":
if in.IsNull() {
in.Skip()
out.ApplicationCache = nil
} else {
if out.ApplicationCache == nil {
out.ApplicationCache = new(ApplicationCache)
}
(*out.ApplicationCache).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache5(out *jwriter.Writer, in GetApplicationCacheForFrameReturns) {
out.RawByte('{')
first := true
_ = first
if in.ApplicationCache != nil {
const prefix string = ",\"applicationCache\":"
first = false
out.RawString(prefix[1:])
(*in.ApplicationCache).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetApplicationCacheForFrameReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetApplicationCacheForFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetApplicationCacheForFrameReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetApplicationCacheForFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache6(in *jlexer.Lexer, out *GetApplicationCacheForFrameParams) {
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 "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache6(out *jwriter.Writer, in GetApplicationCacheForFrameParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"frameId\":"
out.RawString(prefix[1:])
out.String(string(in.FrameID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetApplicationCacheForFrameParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetApplicationCacheForFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetApplicationCacheForFrameParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetApplicationCacheForFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache6(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache7(in *jlexer.Lexer, out *FrameWithManifest) {
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 "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
case "manifestURL":
out.ManifestURL = string(in.String())
case "status":
out.Status = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache7(out *jwriter.Writer, in FrameWithManifest) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"frameId\":"
out.RawString(prefix[1:])
out.String(string(in.FrameID))
}
{
const prefix string = ",\"manifestURL\":"
out.RawString(prefix)
out.String(string(in.ManifestURL))
}
{
const prefix string = ",\"status\":"
out.RawString(prefix)
out.Int64(int64(in.Status))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v FrameWithManifest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v FrameWithManifest) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *FrameWithManifest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *FrameWithManifest) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache7(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache8(in *jlexer.Lexer, out *EventNetworkStateUpdated) {
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 "isNowOnline":
out.IsNowOnline = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache8(out *jwriter.Writer, in EventNetworkStateUpdated) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"isNowOnline\":"
out.RawString(prefix[1:])
out.Bool(bool(in.IsNowOnline))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventNetworkStateUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventNetworkStateUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventNetworkStateUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventNetworkStateUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache8(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache9(in *jlexer.Lexer, out *EventApplicationCacheStatusUpdated) {
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 "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
case "manifestURL":
out.ManifestURL = string(in.String())
case "status":
out.Status = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache9(out *jwriter.Writer, in EventApplicationCacheStatusUpdated) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"frameId\":"
out.RawString(prefix[1:])
out.String(string(in.FrameID))
}
{
const prefix string = ",\"manifestURL\":"
out.RawString(prefix)
out.String(string(in.ManifestURL))
}
{
const prefix string = ",\"status\":"
out.RawString(prefix)
out.Int64(int64(in.Status))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventApplicationCacheStatusUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache9(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventApplicationCacheStatusUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache9(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventApplicationCacheStatusUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache9(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventApplicationCacheStatusUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache9(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache10(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache10(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache10(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache10(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache10(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache10(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache11(in *jlexer.Lexer, out *ApplicationCache) {
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 "manifestURL":
out.ManifestURL = string(in.String())
case "size":
out.Size = float64(in.Float64())
case "creationTime":
out.CreationTime = float64(in.Float64())
case "updateTime":
out.UpdateTime = float64(in.Float64())
case "resources":
if in.IsNull() {
in.Skip()
out.Resources = nil
} else {
in.Delim('[')
if out.Resources == nil {
if !in.IsDelim(']') {
out.Resources = make([]*Resource, 0, 8)
} else {
out.Resources = []*Resource{}
}
} else {
out.Resources = (out.Resources)[:0]
}
for !in.IsDelim(']') {
var v4 *Resource
if in.IsNull() {
in.Skip()
v4 = nil
} else {
if v4 == nil {
v4 = new(Resource)
}
(*v4).UnmarshalEasyJSON(in)
}
out.Resources = append(out.Resources, v4)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache11(out *jwriter.Writer, in ApplicationCache) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"manifestURL\":"
out.RawString(prefix[1:])
out.String(string(in.ManifestURL))
}
{
const prefix string = ",\"size\":"
out.RawString(prefix)
out.Float64(float64(in.Size))
}
{
const prefix string = ",\"creationTime\":"
out.RawString(prefix)
out.Float64(float64(in.CreationTime))
}
{
const prefix string = ",\"updateTime\":"
out.RawString(prefix)
out.Float64(float64(in.UpdateTime))
}
{
const prefix string = ",\"resources\":"
out.RawString(prefix)
if in.Resources == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v5, v6 := range in.Resources {
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 ApplicationCache) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache11(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ApplicationCache) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache11(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ApplicationCache) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache11(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ApplicationCache) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache11(l, v)
}

View File

@@ -0,0 +1,23 @@
package applicationcache
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
)
// EventApplicationCacheStatusUpdated [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#event-applicationCacheStatusUpdated
type EventApplicationCacheStatusUpdated struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache updated status.
ManifestURL string `json:"manifestURL"` // Manifest URL.
Status int64 `json:"status"` // Updated application cache status.
}
// EventNetworkStateUpdated [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#event-networkStateUpdated
type EventNetworkStateUpdated struct {
IsNowOnline bool `json:"isNowOnline"`
}

View File

@@ -0,0 +1,36 @@
package applicationcache
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
)
// Resource detailed application cache resource information.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#type-ApplicationCacheResource
type Resource struct {
URL string `json:"url"` // Resource url.
Size int64 `json:"size"` // Resource size.
Type string `json:"type"` // Resource type.
}
// ApplicationCache detailed application cache information.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#type-ApplicationCache
type ApplicationCache struct {
ManifestURL string `json:"manifestURL"` // Manifest URL.
Size float64 `json:"size"` // Application cache size.
CreationTime float64 `json:"creationTime"` // Application cache creation time.
UpdateTime float64 `json:"updateTime"` // Application cache update time.
Resources []*Resource `json:"resources"` // Application cache resources.
}
// FrameWithManifest frame identifier - manifest URL pair.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/ApplicationCache#type-FrameWithManifest
type FrameWithManifest struct {
FrameID cdp.FrameID `json:"frameId"` // Frame identifier.
ManifestURL string `json:"manifestURL"` // Manifest URL.
Status int64 `json:"status"` // Application cache status.
}

126
vendor/github.com/chromedp/cdproto/audits/audits.go generated vendored Normal file
View File

@@ -0,0 +1,126 @@
// Package audits provides the Chrome DevTools Protocol
// commands, types, and events for the Audits domain.
//
// Audits domain allows investigation of page violations and possible
// improvements.
//
// Generated by the cdproto-gen command.
package audits
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"encoding/base64"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/network"
)
// GetEncodedResponseParams returns the response body and size if it were
// re-encoded with the specified settings. Only applies to images.
type GetEncodedResponseParams struct {
RequestID network.RequestID `json:"requestId"` // Identifier of the network request to get content for.
Encoding GetEncodedResponseEncoding `json:"encoding"` // The encoding to use.
Quality float64 `json:"quality,omitempty"` // The quality of the encoding (0-1). (defaults to 1)
SizeOnly bool `json:"sizeOnly,omitempty"` // Whether to only return the size information (defaults to false).
}
// GetEncodedResponse returns the response body and size if it were
// re-encoded with the specified settings. Only applies to images.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#method-getEncodedResponse
//
// parameters:
// requestID - Identifier of the network request to get content for.
// encoding - The encoding to use.
func GetEncodedResponse(requestID network.RequestID, encoding GetEncodedResponseEncoding) *GetEncodedResponseParams {
return &GetEncodedResponseParams{
RequestID: requestID,
Encoding: encoding,
}
}
// WithQuality the quality of the encoding (0-1). (defaults to 1).
func (p GetEncodedResponseParams) WithQuality(quality float64) *GetEncodedResponseParams {
p.Quality = quality
return &p
}
// WithSizeOnly whether to only return the size information (defaults to
// false).
func (p GetEncodedResponseParams) WithSizeOnly(sizeOnly bool) *GetEncodedResponseParams {
p.SizeOnly = sizeOnly
return &p
}
// GetEncodedResponseReturns return values.
type GetEncodedResponseReturns struct {
Body string `json:"body,omitempty"` // The encoded body as a base64 string. Omitted if sizeOnly is true.
OriginalSize int64 `json:"originalSize,omitempty"` // Size before re-encoding.
EncodedSize int64 `json:"encodedSize,omitempty"` // Size after re-encoding.
}
// Do executes Audits.getEncodedResponse against the provided context.
//
// returns:
// body - The encoded body as a base64 string. Omitted if sizeOnly is true.
// originalSize - Size before re-encoding.
// encodedSize - Size after re-encoding.
func (p *GetEncodedResponseParams) Do(ctx context.Context) (body []byte, originalSize int64, encodedSize int64, err error) {
// execute
var res GetEncodedResponseReturns
err = cdp.Execute(ctx, CommandGetEncodedResponse, p, &res)
if err != nil {
return nil, 0, 0, err
}
// decode
var dec []byte
dec, err = base64.StdEncoding.DecodeString(res.Body)
if err != nil {
return nil, 0, 0, err
}
return dec, res.OriginalSize, res.EncodedSize, nil
}
// DisableParams disables issues domain, prevents further issues from being
// reported to the client.
type DisableParams struct{}
// Disable disables issues domain, prevents further issues from being
// reported to the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Audits.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables issues domain, sends the issues collected so far to
// the client by means of the issueAdded event.
type EnableParams struct{}
// Enable enables issues domain, sends the issues collected so far to the
// client by means of the issueAdded event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Audits.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// Command names.
const (
CommandGetEncodedResponse = "Audits.getEncodedResponse"
CommandDisable = "Audits.disable"
CommandEnable = "Audits.enable"
)

1228
vendor/github.com/chromedp/cdproto/audits/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

10
vendor/github.com/chromedp/cdproto/audits/events.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
package audits
// Code generated by cdproto-gen. DO NOT EDIT.
// EventIssueAdded [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#event-issueAdded
type EventIssueAdded struct {
Issue *InspectorIssue `json:"issue"`
}

559
vendor/github.com/chromedp/cdproto/audits/types.go generated vendored Normal file
View File

@@ -0,0 +1,559 @@
package audits
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/network"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AffectedCookie information about a cookie that is affected by an inspector
// issue.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-AffectedCookie
type AffectedCookie struct {
Name string `json:"name"` // The following three properties uniquely identify a cookie
Path string `json:"path"`
Domain string `json:"domain"`
}
// AffectedRequest information about a request that is affected by an
// inspector issue.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-AffectedRequest
type AffectedRequest struct {
RequestID network.RequestID `json:"requestId"` // The unique request id.
URL string `json:"url,omitempty"`
}
// AffectedFrame information about the frame affected by an inspector issue.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-AffectedFrame
type AffectedFrame struct {
FrameID cdp.FrameID `json:"frameId"`
}
// SameSiteCookieExclusionReason [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-SameSiteCookieExclusionReason
type SameSiteCookieExclusionReason string
// String returns the SameSiteCookieExclusionReason as string value.
func (t SameSiteCookieExclusionReason) String() string {
return string(t)
}
// SameSiteCookieExclusionReason values.
const (
SameSiteCookieExclusionReasonExcludeSameSiteUnspecifiedTreatedAsLax SameSiteCookieExclusionReason = "ExcludeSameSiteUnspecifiedTreatedAsLax"
SameSiteCookieExclusionReasonExcludeSameSiteNoneInsecure SameSiteCookieExclusionReason = "ExcludeSameSiteNoneInsecure"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SameSiteCookieExclusionReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SameSiteCookieExclusionReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SameSiteCookieExclusionReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SameSiteCookieExclusionReason(in.String()) {
case SameSiteCookieExclusionReasonExcludeSameSiteUnspecifiedTreatedAsLax:
*t = SameSiteCookieExclusionReasonExcludeSameSiteUnspecifiedTreatedAsLax
case SameSiteCookieExclusionReasonExcludeSameSiteNoneInsecure:
*t = SameSiteCookieExclusionReasonExcludeSameSiteNoneInsecure
default:
in.AddError(errors.New("unknown SameSiteCookieExclusionReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SameSiteCookieExclusionReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SameSiteCookieWarningReason [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-SameSiteCookieWarningReason
type SameSiteCookieWarningReason string
// String returns the SameSiteCookieWarningReason as string value.
func (t SameSiteCookieWarningReason) String() string {
return string(t)
}
// SameSiteCookieWarningReason values.
const (
SameSiteCookieWarningReasonWarnSameSiteUnspecifiedCrossSiteContext SameSiteCookieWarningReason = "WarnSameSiteUnspecifiedCrossSiteContext"
SameSiteCookieWarningReasonWarnSameSiteNoneInsecure SameSiteCookieWarningReason = "WarnSameSiteNoneInsecure"
SameSiteCookieWarningReasonWarnSameSiteUnspecifiedLaxAllowUnsafe SameSiteCookieWarningReason = "WarnSameSiteUnspecifiedLaxAllowUnsafe"
SameSiteCookieWarningReasonWarnSameSiteStrictLaxDowngradeStrict SameSiteCookieWarningReason = "WarnSameSiteStrictLaxDowngradeStrict"
SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeStrict SameSiteCookieWarningReason = "WarnSameSiteStrictCrossDowngradeStrict"
SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeLax SameSiteCookieWarningReason = "WarnSameSiteStrictCrossDowngradeLax"
SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeStrict SameSiteCookieWarningReason = "WarnSameSiteLaxCrossDowngradeStrict"
SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeLax SameSiteCookieWarningReason = "WarnSameSiteLaxCrossDowngradeLax"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SameSiteCookieWarningReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SameSiteCookieWarningReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SameSiteCookieWarningReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SameSiteCookieWarningReason(in.String()) {
case SameSiteCookieWarningReasonWarnSameSiteUnspecifiedCrossSiteContext:
*t = SameSiteCookieWarningReasonWarnSameSiteUnspecifiedCrossSiteContext
case SameSiteCookieWarningReasonWarnSameSiteNoneInsecure:
*t = SameSiteCookieWarningReasonWarnSameSiteNoneInsecure
case SameSiteCookieWarningReasonWarnSameSiteUnspecifiedLaxAllowUnsafe:
*t = SameSiteCookieWarningReasonWarnSameSiteUnspecifiedLaxAllowUnsafe
case SameSiteCookieWarningReasonWarnSameSiteStrictLaxDowngradeStrict:
*t = SameSiteCookieWarningReasonWarnSameSiteStrictLaxDowngradeStrict
case SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeStrict:
*t = SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeStrict
case SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeLax:
*t = SameSiteCookieWarningReasonWarnSameSiteStrictCrossDowngradeLax
case SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeStrict:
*t = SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeStrict
case SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeLax:
*t = SameSiteCookieWarningReasonWarnSameSiteLaxCrossDowngradeLax
default:
in.AddError(errors.New("unknown SameSiteCookieWarningReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SameSiteCookieWarningReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SameSiteCookieOperation [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-SameSiteCookieOperation
type SameSiteCookieOperation string
// String returns the SameSiteCookieOperation as string value.
func (t SameSiteCookieOperation) String() string {
return string(t)
}
// SameSiteCookieOperation values.
const (
SameSiteCookieOperationSetCookie SameSiteCookieOperation = "SetCookie"
SameSiteCookieOperationReadCookie SameSiteCookieOperation = "ReadCookie"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SameSiteCookieOperation) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SameSiteCookieOperation) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SameSiteCookieOperation) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SameSiteCookieOperation(in.String()) {
case SameSiteCookieOperationSetCookie:
*t = SameSiteCookieOperationSetCookie
case SameSiteCookieOperationReadCookie:
*t = SameSiteCookieOperationReadCookie
default:
in.AddError(errors.New("unknown SameSiteCookieOperation value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SameSiteCookieOperation) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SameSiteCookieIssueDetails this information is currently necessary, as the
// front-end has a difficult time finding a specific cookie. With this, we can
// convey specific error information without the cookie.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-SameSiteCookieIssueDetails
type SameSiteCookieIssueDetails struct {
Cookie *AffectedCookie `json:"cookie"`
CookieWarningReasons []SameSiteCookieWarningReason `json:"cookieWarningReasons"`
CookieExclusionReasons []SameSiteCookieExclusionReason `json:"cookieExclusionReasons"`
Operation SameSiteCookieOperation `json:"operation"` // Optionally identifies the site-for-cookies and the cookie url, which may be used by the front-end as additional context.
SiteForCookies string `json:"siteForCookies,omitempty"`
CookieURL string `json:"cookieUrl,omitempty"`
Request *AffectedRequest `json:"request,omitempty"`
}
// MixedContentResolutionStatus [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-MixedContentResolutionStatus
type MixedContentResolutionStatus string
// String returns the MixedContentResolutionStatus as string value.
func (t MixedContentResolutionStatus) String() string {
return string(t)
}
// MixedContentResolutionStatus values.
const (
MixedContentResolutionStatusMixedContentBlocked MixedContentResolutionStatus = "MixedContentBlocked"
MixedContentResolutionStatusMixedContentAutomaticallyUpgraded MixedContentResolutionStatus = "MixedContentAutomaticallyUpgraded"
MixedContentResolutionStatusMixedContentWarning MixedContentResolutionStatus = "MixedContentWarning"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MixedContentResolutionStatus) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MixedContentResolutionStatus) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MixedContentResolutionStatus) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MixedContentResolutionStatus(in.String()) {
case MixedContentResolutionStatusMixedContentBlocked:
*t = MixedContentResolutionStatusMixedContentBlocked
case MixedContentResolutionStatusMixedContentAutomaticallyUpgraded:
*t = MixedContentResolutionStatusMixedContentAutomaticallyUpgraded
case MixedContentResolutionStatusMixedContentWarning:
*t = MixedContentResolutionStatusMixedContentWarning
default:
in.AddError(errors.New("unknown MixedContentResolutionStatus value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MixedContentResolutionStatus) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// MixedContentResourceType [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-MixedContentResourceType
type MixedContentResourceType string
// String returns the MixedContentResourceType as string value.
func (t MixedContentResourceType) String() string {
return string(t)
}
// MixedContentResourceType values.
const (
MixedContentResourceTypeAudio MixedContentResourceType = "Audio"
MixedContentResourceTypeBeacon MixedContentResourceType = "Beacon"
MixedContentResourceTypeCSPReport MixedContentResourceType = "CSPReport"
MixedContentResourceTypeDownload MixedContentResourceType = "Download"
MixedContentResourceTypeEventSource MixedContentResourceType = "EventSource"
MixedContentResourceTypeFavicon MixedContentResourceType = "Favicon"
MixedContentResourceTypeFont MixedContentResourceType = "Font"
MixedContentResourceTypeForm MixedContentResourceType = "Form"
MixedContentResourceTypeFrame MixedContentResourceType = "Frame"
MixedContentResourceTypeImage MixedContentResourceType = "Image"
MixedContentResourceTypeImport MixedContentResourceType = "Import"
MixedContentResourceTypeManifest MixedContentResourceType = "Manifest"
MixedContentResourceTypePing MixedContentResourceType = "Ping"
MixedContentResourceTypePluginData MixedContentResourceType = "PluginData"
MixedContentResourceTypePluginResource MixedContentResourceType = "PluginResource"
MixedContentResourceTypePrefetch MixedContentResourceType = "Prefetch"
MixedContentResourceTypeResource MixedContentResourceType = "Resource"
MixedContentResourceTypeScript MixedContentResourceType = "Script"
MixedContentResourceTypeServiceWorker MixedContentResourceType = "ServiceWorker"
MixedContentResourceTypeSharedWorker MixedContentResourceType = "SharedWorker"
MixedContentResourceTypeStylesheet MixedContentResourceType = "Stylesheet"
MixedContentResourceTypeTrack MixedContentResourceType = "Track"
MixedContentResourceTypeVideo MixedContentResourceType = "Video"
MixedContentResourceTypeWorker MixedContentResourceType = "Worker"
MixedContentResourceTypeXMLHTTPRequest MixedContentResourceType = "XMLHttpRequest"
MixedContentResourceTypeXSLT MixedContentResourceType = "XSLT"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MixedContentResourceType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MixedContentResourceType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MixedContentResourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MixedContentResourceType(in.String()) {
case MixedContentResourceTypeAudio:
*t = MixedContentResourceTypeAudio
case MixedContentResourceTypeBeacon:
*t = MixedContentResourceTypeBeacon
case MixedContentResourceTypeCSPReport:
*t = MixedContentResourceTypeCSPReport
case MixedContentResourceTypeDownload:
*t = MixedContentResourceTypeDownload
case MixedContentResourceTypeEventSource:
*t = MixedContentResourceTypeEventSource
case MixedContentResourceTypeFavicon:
*t = MixedContentResourceTypeFavicon
case MixedContentResourceTypeFont:
*t = MixedContentResourceTypeFont
case MixedContentResourceTypeForm:
*t = MixedContentResourceTypeForm
case MixedContentResourceTypeFrame:
*t = MixedContentResourceTypeFrame
case MixedContentResourceTypeImage:
*t = MixedContentResourceTypeImage
case MixedContentResourceTypeImport:
*t = MixedContentResourceTypeImport
case MixedContentResourceTypeManifest:
*t = MixedContentResourceTypeManifest
case MixedContentResourceTypePing:
*t = MixedContentResourceTypePing
case MixedContentResourceTypePluginData:
*t = MixedContentResourceTypePluginData
case MixedContentResourceTypePluginResource:
*t = MixedContentResourceTypePluginResource
case MixedContentResourceTypePrefetch:
*t = MixedContentResourceTypePrefetch
case MixedContentResourceTypeResource:
*t = MixedContentResourceTypeResource
case MixedContentResourceTypeScript:
*t = MixedContentResourceTypeScript
case MixedContentResourceTypeServiceWorker:
*t = MixedContentResourceTypeServiceWorker
case MixedContentResourceTypeSharedWorker:
*t = MixedContentResourceTypeSharedWorker
case MixedContentResourceTypeStylesheet:
*t = MixedContentResourceTypeStylesheet
case MixedContentResourceTypeTrack:
*t = MixedContentResourceTypeTrack
case MixedContentResourceTypeVideo:
*t = MixedContentResourceTypeVideo
case MixedContentResourceTypeWorker:
*t = MixedContentResourceTypeWorker
case MixedContentResourceTypeXMLHTTPRequest:
*t = MixedContentResourceTypeXMLHTTPRequest
case MixedContentResourceTypeXSLT:
*t = MixedContentResourceTypeXSLT
default:
in.AddError(errors.New("unknown MixedContentResourceType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MixedContentResourceType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// MixedContentIssueDetails [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-MixedContentIssueDetails
type MixedContentIssueDetails struct {
ResourceType MixedContentResourceType `json:"resourceType,omitempty"` // The type of resource causing the mixed content issue (css, js, iframe, form,...). Marked as optional because it is mapped to from blink::mojom::RequestContextType, which will be replaced by network::mojom::RequestDestination
ResolutionStatus MixedContentResolutionStatus `json:"resolutionStatus"` // The way the mixed content issue is being resolved.
InsecureURL string `json:"insecureURL"` // The unsafe http url causing the mixed content issue.
MainResourceURL string `json:"mainResourceURL"` // The url responsible for the call to an unsafe url.
Request *AffectedRequest `json:"request,omitempty"` // The mixed content request. Does not always exist (e.g. for unsafe form submission urls).
Frame *AffectedFrame `json:"frame,omitempty"` // Optional because not every mixed content issue is necessarily linked to a frame.
}
// BlockedByResponseReason enum indicating the reason a response has been
// blocked. These reasons are refinements of the net error BLOCKED_BY_RESPONSE.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-BlockedByResponseReason
type BlockedByResponseReason string
// String returns the BlockedByResponseReason as string value.
func (t BlockedByResponseReason) String() string {
return string(t)
}
// BlockedByResponseReason values.
const (
BlockedByResponseReasonCoepFrameResourceNeedsCoepHeader BlockedByResponseReason = "CoepFrameResourceNeedsCoepHeader"
BlockedByResponseReasonCoopSandboxedIFrameCannotNavigateToCoopPage BlockedByResponseReason = "CoopSandboxedIFrameCannotNavigateToCoopPage"
BlockedByResponseReasonCorpNotSameOrigin BlockedByResponseReason = "CorpNotSameOrigin"
BlockedByResponseReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep BlockedByResponseReason = "CorpNotSameOriginAfterDefaultedToSameOriginByCoep"
BlockedByResponseReasonCorpNotSameSite BlockedByResponseReason = "CorpNotSameSite"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t BlockedByResponseReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t BlockedByResponseReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *BlockedByResponseReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch BlockedByResponseReason(in.String()) {
case BlockedByResponseReasonCoepFrameResourceNeedsCoepHeader:
*t = BlockedByResponseReasonCoepFrameResourceNeedsCoepHeader
case BlockedByResponseReasonCoopSandboxedIFrameCannotNavigateToCoopPage:
*t = BlockedByResponseReasonCoopSandboxedIFrameCannotNavigateToCoopPage
case BlockedByResponseReasonCorpNotSameOrigin:
*t = BlockedByResponseReasonCorpNotSameOrigin
case BlockedByResponseReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep:
*t = BlockedByResponseReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep
case BlockedByResponseReasonCorpNotSameSite:
*t = BlockedByResponseReasonCorpNotSameSite
default:
in.AddError(errors.New("unknown BlockedByResponseReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *BlockedByResponseReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// BlockedByResponseIssueDetails details for a request that has been blocked
// with the BLOCKED_BY_RESPONSE code. Currently only used for COEP/COOP, but may
// be extended to include some CSP errors in the future.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-BlockedByResponseIssueDetails
type BlockedByResponseIssueDetails struct {
Request *AffectedRequest `json:"request"`
Frame *AffectedFrame `json:"frame,omitempty"`
Reason BlockedByResponseReason `json:"reason"`
}
// InspectorIssueCode a unique identifier for the type of issue. Each type
// may use one of the optional fields in InspectorIssueDetails to convey more
// specific information about the kind of issue.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-InspectorIssueCode
type InspectorIssueCode string
// String returns the InspectorIssueCode as string value.
func (t InspectorIssueCode) String() string {
return string(t)
}
// InspectorIssueCode values.
const (
InspectorIssueCodeSameSiteCookieIssue InspectorIssueCode = "SameSiteCookieIssue"
InspectorIssueCodeMixedContentIssue InspectorIssueCode = "MixedContentIssue"
InspectorIssueCodeBlockedByResponseIssue InspectorIssueCode = "BlockedByResponseIssue"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InspectorIssueCode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InspectorIssueCode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InspectorIssueCode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InspectorIssueCode(in.String()) {
case InspectorIssueCodeSameSiteCookieIssue:
*t = InspectorIssueCodeSameSiteCookieIssue
case InspectorIssueCodeMixedContentIssue:
*t = InspectorIssueCodeMixedContentIssue
case InspectorIssueCodeBlockedByResponseIssue:
*t = InspectorIssueCodeBlockedByResponseIssue
default:
in.AddError(errors.New("unknown InspectorIssueCode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InspectorIssueCode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// InspectorIssueDetails this struct holds a list of optional fields with
// additional information specific to the kind of issue. When adding a new issue
// code, please also add a new optional field to this type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-InspectorIssueDetails
type InspectorIssueDetails struct {
SameSiteCookieIssueDetails *SameSiteCookieIssueDetails `json:"sameSiteCookieIssueDetails,omitempty"`
MixedContentIssueDetails *MixedContentIssueDetails `json:"mixedContentIssueDetails,omitempty"`
BlockedByResponseIssueDetails *BlockedByResponseIssueDetails `json:"blockedByResponseIssueDetails,omitempty"`
}
// InspectorIssue an inspector issue reported from the back-end.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#type-InspectorIssue
type InspectorIssue struct {
Code InspectorIssueCode `json:"code"`
Details *InspectorIssueDetails `json:"details"`
}
// GetEncodedResponseEncoding the encoding to use.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Audits#method-getEncodedResponse
type GetEncodedResponseEncoding string
// String returns the GetEncodedResponseEncoding as string value.
func (t GetEncodedResponseEncoding) String() string {
return string(t)
}
// GetEncodedResponseEncoding values.
const (
GetEncodedResponseEncodingWebp GetEncodedResponseEncoding = "webp"
GetEncodedResponseEncodingJpeg GetEncodedResponseEncoding = "jpeg"
GetEncodedResponseEncodingPng GetEncodedResponseEncoding = "png"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t GetEncodedResponseEncoding) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t GetEncodedResponseEncoding) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *GetEncodedResponseEncoding) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch GetEncodedResponseEncoding(in.String()) {
case GetEncodedResponseEncodingWebp:
*t = GetEncodedResponseEncodingWebp
case GetEncodedResponseEncodingJpeg:
*t = GetEncodedResponseEncodingJpeg
case GetEncodedResponseEncodingPng:
*t = GetEncodedResponseEncodingPng
default:
in.AddError(errors.New("unknown GetEncodedResponseEncoding value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *GetEncodedResponseEncoding) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@@ -0,0 +1,114 @@
// Package backgroundservice provides the Chrome DevTools Protocol
// commands, types, and events for the BackgroundService domain.
//
// Defines events for background web platform features.
//
// Generated by the cdproto-gen command.
package backgroundservice
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// StartObservingParams enables event updates for the service.
type StartObservingParams struct {
Service ServiceName `json:"service"`
}
// StartObserving enables event updates for the service.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-startObserving
//
// parameters:
// service
func StartObserving(service ServiceName) *StartObservingParams {
return &StartObservingParams{
Service: service,
}
}
// Do executes BackgroundService.startObserving against the provided context.
func (p *StartObservingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStartObserving, p, nil)
}
// StopObservingParams disables event updates for the service.
type StopObservingParams struct {
Service ServiceName `json:"service"`
}
// StopObserving disables event updates for the service.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-stopObserving
//
// parameters:
// service
func StopObserving(service ServiceName) *StopObservingParams {
return &StopObservingParams{
Service: service,
}
}
// Do executes BackgroundService.stopObserving against the provided context.
func (p *StopObservingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStopObserving, p, nil)
}
// SetRecordingParams set the recording state for the service.
type SetRecordingParams struct {
ShouldRecord bool `json:"shouldRecord"`
Service ServiceName `json:"service"`
}
// SetRecording set the recording state for the service.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-setRecording
//
// parameters:
// shouldRecord
// service
func SetRecording(shouldRecord bool, service ServiceName) *SetRecordingParams {
return &SetRecordingParams{
ShouldRecord: shouldRecord,
Service: service,
}
}
// Do executes BackgroundService.setRecording against the provided context.
func (p *SetRecordingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetRecording, p, nil)
}
// ClearEventsParams clears all stored data for the service.
type ClearEventsParams struct {
Service ServiceName `json:"service"`
}
// ClearEvents clears all stored data for the service.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-clearEvents
//
// parameters:
// service
func ClearEvents(service ServiceName) *ClearEventsParams {
return &ClearEventsParams{
Service: service,
}
}
// Do executes BackgroundService.clearEvents against the provided context.
func (p *ClearEventsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClearEvents, p, nil)
}
// Command names.
const (
CommandStartObserving = "BackgroundService.startObserving"
CommandStopObserving = "BackgroundService.stopObserving"
CommandSetRecording = "BackgroundService.setRecording"
CommandClearEvents = "BackgroundService.clearEvents"
)

View File

@@ -0,0 +1,680 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package backgroundservice
import (
json "encoding/json"
cdp "github.com/chromedp/cdproto/cdp"
serviceworker "github.com/chromedp/cdproto/serviceworker"
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice(in *jlexer.Lexer, out *StopObservingParams) {
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 "service":
(out.Service).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice(out *jwriter.Writer, in StopObservingParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"service\":"
out.RawString(prefix[1:])
(in.Service).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StopObservingParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StopObservingParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StopObservingParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StopObservingParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice1(in *jlexer.Lexer, out *StartObservingParams) {
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 "service":
(out.Service).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice1(out *jwriter.Writer, in StartObservingParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"service\":"
out.RawString(prefix[1:])
(in.Service).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StartObservingParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StartObservingParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StartObservingParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StartObservingParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice2(in *jlexer.Lexer, out *SetRecordingParams) {
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 "shouldRecord":
out.ShouldRecord = bool(in.Bool())
case "service":
(out.Service).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice2(out *jwriter.Writer, in SetRecordingParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"shouldRecord\":"
out.RawString(prefix[1:])
out.Bool(bool(in.ShouldRecord))
}
{
const prefix string = ",\"service\":"
out.RawString(prefix)
(in.Service).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetRecordingParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetRecordingParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetRecordingParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetRecordingParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice3(in *jlexer.Lexer, out *EventRecordingStateChanged) {
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 "isRecording":
out.IsRecording = bool(in.Bool())
case "service":
(out.Service).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice3(out *jwriter.Writer, in EventRecordingStateChanged) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"isRecording\":"
out.RawString(prefix[1:])
out.Bool(bool(in.IsRecording))
}
{
const prefix string = ",\"service\":"
out.RawString(prefix)
(in.Service).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventRecordingStateChanged) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventRecordingStateChanged) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventRecordingStateChanged) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventRecordingStateChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice4(in *jlexer.Lexer, out *EventMetadata) {
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 "key":
out.Key = string(in.String())
case "value":
out.Value = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice4(out *jwriter.Writer, in EventMetadata) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"key\":"
out.RawString(prefix[1:])
out.String(string(in.Key))
}
{
const prefix string = ",\"value\":"
out.RawString(prefix)
out.String(string(in.Value))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventMetadata) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventMetadata) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventMetadata) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventMetadata) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice5(in *jlexer.Lexer, out *EventBackgroundServiceEventReceived) {
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 "backgroundServiceEvent":
if in.IsNull() {
in.Skip()
out.BackgroundServiceEvent = nil
} else {
if out.BackgroundServiceEvent == nil {
out.BackgroundServiceEvent = new(Event)
}
(*out.BackgroundServiceEvent).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice5(out *jwriter.Writer, in EventBackgroundServiceEventReceived) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"backgroundServiceEvent\":"
out.RawString(prefix[1:])
if in.BackgroundServiceEvent == nil {
out.RawString("null")
} else {
(*in.BackgroundServiceEvent).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventBackgroundServiceEventReceived) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventBackgroundServiceEventReceived) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventBackgroundServiceEventReceived) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventBackgroundServiceEventReceived) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice6(in *jlexer.Lexer, out *Event) {
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 "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
case "origin":
out.Origin = string(in.String())
case "serviceWorkerRegistrationId":
out.ServiceWorkerRegistrationID = serviceworker.RegistrationID(in.String())
case "service":
(out.Service).UnmarshalEasyJSON(in)
case "eventName":
out.EventName = string(in.String())
case "instanceId":
out.InstanceID = string(in.String())
case "eventMetadata":
if in.IsNull() {
in.Skip()
out.EventMetadata = nil
} else {
in.Delim('[')
if out.EventMetadata == nil {
if !in.IsDelim(']') {
out.EventMetadata = make([]*EventMetadata, 0, 8)
} else {
out.EventMetadata = []*EventMetadata{}
}
} else {
out.EventMetadata = (out.EventMetadata)[:0]
}
for !in.IsDelim(']') {
var v1 *EventMetadata
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(EventMetadata)
}
(*v1).UnmarshalEasyJSON(in)
}
out.EventMetadata = append(out.EventMetadata, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice6(out *jwriter.Writer, in Event) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"timestamp\":"
out.RawString(prefix[1:])
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
}
{
const prefix string = ",\"origin\":"
out.RawString(prefix)
out.String(string(in.Origin))
}
{
const prefix string = ",\"serviceWorkerRegistrationId\":"
out.RawString(prefix)
out.String(string(in.ServiceWorkerRegistrationID))
}
{
const prefix string = ",\"service\":"
out.RawString(prefix)
(in.Service).MarshalEasyJSON(out)
}
{
const prefix string = ",\"eventName\":"
out.RawString(prefix)
out.String(string(in.EventName))
}
{
const prefix string = ",\"instanceId\":"
out.RawString(prefix)
out.String(string(in.InstanceID))
}
{
const prefix string = ",\"eventMetadata\":"
out.RawString(prefix)
if in.EventMetadata == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v2, v3 := range in.EventMetadata {
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 Event) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Event) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Event) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Event) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice6(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice7(in *jlexer.Lexer, out *ClearEventsParams) {
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 "service":
(out.Service).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice7(out *jwriter.Writer, in ClearEventsParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"service\":"
out.RawString(prefix[1:])
(in.Service).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ClearEventsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearEventsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearEventsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearEventsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice7(l, v)
}

View File

@@ -0,0 +1,21 @@
package backgroundservice
// Code generated by cdproto-gen. DO NOT EDIT.
// EventRecordingStateChanged called when the recording state for the service
// has been updated.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#event-recordingStateChanged
type EventRecordingStateChanged struct {
IsRecording bool `json:"isRecording"`
Service ServiceName `json:"service"`
}
// EventBackgroundServiceEventReceived called with all existing
// backgroundServiceEvents when enabled, and all new events afterwards if
// enabled and recording.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#event-backgroundServiceEventReceived
type EventBackgroundServiceEventReceived struct {
BackgroundServiceEvent *Event `json:"backgroundServiceEvent"`
}

View File

@@ -0,0 +1,93 @@
package backgroundservice
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/serviceworker"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// ServiceName the Background Service that will be associated with the
// commands/events. Every Background Service operates independently, but they
// share the same API.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-ServiceName
type ServiceName string
// String returns the ServiceName as string value.
func (t ServiceName) String() string {
return string(t)
}
// ServiceName values.
const (
ServiceNameBackgroundFetch ServiceName = "backgroundFetch"
ServiceNameBackgroundSync ServiceName = "backgroundSync"
ServiceNamePushMessaging ServiceName = "pushMessaging"
ServiceNameNotifications ServiceName = "notifications"
ServiceNamePaymentHandler ServiceName = "paymentHandler"
ServiceNamePeriodicBackgroundSync ServiceName = "periodicBackgroundSync"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ServiceName) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ServiceName) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ServiceName) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ServiceName(in.String()) {
case ServiceNameBackgroundFetch:
*t = ServiceNameBackgroundFetch
case ServiceNameBackgroundSync:
*t = ServiceNameBackgroundSync
case ServiceNamePushMessaging:
*t = ServiceNamePushMessaging
case ServiceNameNotifications:
*t = ServiceNameNotifications
case ServiceNamePaymentHandler:
*t = ServiceNamePaymentHandler
case ServiceNamePeriodicBackgroundSync:
*t = ServiceNamePeriodicBackgroundSync
default:
in.AddError(errors.New("unknown ServiceName value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ServiceName) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// EventMetadata a key-value pair for additional event information to pass
// along.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-EventMetadata
type EventMetadata struct {
Key string `json:"key"`
Value string `json:"value"`
}
// Event [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-BackgroundServiceEvent
type Event struct {
Timestamp *cdp.TimeSinceEpoch `json:"timestamp"` // Timestamp of the event (in seconds).
Origin string `json:"origin"` // The origin this event belongs to.
ServiceWorkerRegistrationID serviceworker.RegistrationID `json:"serviceWorkerRegistrationId"` // The Service Worker ID that initiated the event.
Service ServiceName `json:"service"` // The Background Service this event belongs to.
EventName string `json:"eventName"` // A description of the event.
InstanceID string `json:"instanceId"` // An identifier that groups related events together.
EventMetadata []*EventMetadata `json:"eventMetadata"` // A list of event-specific information.
}

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

@@ -0,0 +1,525 @@
// Package browser provides the Chrome DevTools Protocol
// commands, types, and events for the Browser domain.
//
// The Browser domain defines methods and events for browser managing.
//
// Generated by the cdproto-gen command.
package browser
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/target"
)
// SetPermissionParams set permission settings for given origin.
type SetPermissionParams struct {
Permission *PermissionDescriptor `json:"permission"` // Descriptor of permission to override.
Setting PermissionSetting `json:"setting"` // Setting of the permission.
Origin string `json:"origin,omitempty"` // Origin the permission applies to, all origins if not specified.
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // Context to override. When omitted, default browser context is used.
}
// SetPermission set permission settings for given origin.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setPermission
//
// parameters:
// permission - Descriptor of permission to override.
// setting - Setting of the permission.
func SetPermission(permission *PermissionDescriptor, setting PermissionSetting) *SetPermissionParams {
return &SetPermissionParams{
Permission: permission,
Setting: setting,
}
}
// WithOrigin origin the permission applies to, all origins if not specified.
func (p SetPermissionParams) WithOrigin(origin string) *SetPermissionParams {
p.Origin = origin
return &p
}
// WithBrowserContextID context to override. When omitted, default browser
// context is used.
func (p SetPermissionParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *SetPermissionParams {
p.BrowserContextID = browserContextID
return &p
}
// Do executes Browser.setPermission against the provided context.
func (p *SetPermissionParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetPermission, p, nil)
}
// GrantPermissionsParams grant specific permissions to the given origin and
// reject all others.
type GrantPermissionsParams struct {
Permissions []PermissionType `json:"permissions"`
Origin string `json:"origin,omitempty"` // Origin the permission applies to, all origins if not specified.
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // BrowserContext to override permissions. When omitted, default browser context is used.
}
// GrantPermissions grant specific permissions to the given origin and reject
// all others.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-grantPermissions
//
// parameters:
// permissions
func GrantPermissions(permissions []PermissionType) *GrantPermissionsParams {
return &GrantPermissionsParams{
Permissions: permissions,
}
}
// WithOrigin origin the permission applies to, all origins if not specified.
func (p GrantPermissionsParams) WithOrigin(origin string) *GrantPermissionsParams {
p.Origin = origin
return &p
}
// WithBrowserContextID browserContext to override permissions. When omitted,
// default browser context is used.
func (p GrantPermissionsParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *GrantPermissionsParams {
p.BrowserContextID = browserContextID
return &p
}
// Do executes Browser.grantPermissions against the provided context.
func (p *GrantPermissionsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandGrantPermissions, p, nil)
}
// ResetPermissionsParams reset all permission management for all origins.
type ResetPermissionsParams struct {
BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // BrowserContext to reset permissions. When omitted, default browser context is used.
}
// ResetPermissions reset all permission management for all origins.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-resetPermissions
//
// parameters:
func ResetPermissions() *ResetPermissionsParams {
return &ResetPermissionsParams{}
}
// WithBrowserContextID browserContext to reset permissions. When omitted,
// default browser context is used.
func (p ResetPermissionsParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *ResetPermissionsParams {
p.BrowserContextID = browserContextID
return &p
}
// Do executes Browser.resetPermissions against the provided context.
func (p *ResetPermissionsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandResetPermissions, p, nil)
}
// SetDownloadBehaviorParams set the behavior when downloading a file.
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'.
}
// SetDownloadBehavior set the behavior when downloading a file.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDownloadBehavior
//
// parameters:
// 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.
func SetDownloadBehavior(behavior SetDownloadBehaviorBehavior) *SetDownloadBehaviorParams {
return &SetDownloadBehaviorParams{
Behavior: behavior,
}
}
// WithBrowserContextID browserContext to set download behavior. When
// omitted, default browser context is used.
func (p SetDownloadBehaviorParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *SetDownloadBehaviorParams {
p.BrowserContextID = browserContextID
return &p
}
// WithDownloadPath the default path to save downloaded files to. This is
// required if behavior is set to 'allow' or 'allowAndName'.
func (p SetDownloadBehaviorParams) WithDownloadPath(downloadPath string) *SetDownloadBehaviorParams {
p.DownloadPath = downloadPath
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)
}
// CloseParams close browser gracefully.
type CloseParams struct{}
// Close close browser gracefully.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-close
func Close() *CloseParams {
return &CloseParams{}
}
// Do executes Browser.close against the provided context.
func (p *CloseParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClose, nil, nil)
}
// CrashParams crashes browser on the main thread.
type CrashParams struct{}
// Crash crashes browser on the main thread.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crash
func Crash() *CrashParams {
return &CrashParams{}
}
// Do executes Browser.crash against the provided context.
func (p *CrashParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandCrash, nil, nil)
}
// CrashGpuProcessParams crashes GPU process.
type CrashGpuProcessParams struct{}
// CrashGpuProcess crashes GPU process.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crashGpuProcess
func CrashGpuProcess() *CrashGpuProcessParams {
return &CrashGpuProcessParams{}
}
// Do executes Browser.crashGpuProcess against the provided context.
func (p *CrashGpuProcessParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandCrashGpuProcess, nil, nil)
}
// GetVersionParams returns version information.
type GetVersionParams struct{}
// GetVersion returns version information.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getVersion
func GetVersion() *GetVersionParams {
return &GetVersionParams{}
}
// GetVersionReturns return values.
type GetVersionReturns struct {
ProtocolVersion string `json:"protocolVersion,omitempty"` // Protocol version.
Product string `json:"product,omitempty"` // Product name.
Revision string `json:"revision,omitempty"` // Product revision.
UserAgent string `json:"userAgent,omitempty"` // User-Agent.
JsVersion string `json:"jsVersion,omitempty"` // V8 version.
}
// Do executes Browser.getVersion against the provided context.
//
// returns:
// protocolVersion - Protocol version.
// product - Product name.
// revision - Product revision.
// userAgent - User-Agent.
// jsVersion - V8 version.
func (p *GetVersionParams) Do(ctx context.Context) (protocolVersion string, product string, revision string, userAgent string, jsVersion string, err error) {
// execute
var res GetVersionReturns
err = cdp.Execute(ctx, CommandGetVersion, nil, &res)
if err != nil {
return "", "", "", "", "", err
}
return res.ProtocolVersion, res.Product, res.Revision, res.UserAgent, res.JsVersion, nil
}
// GetBrowserCommandLineParams returns the command line switches for the
// browser process if, and only if --enable-automation is on the commandline.
type GetBrowserCommandLineParams struct{}
// GetBrowserCommandLine returns the command line switches for the browser
// process if, and only if --enable-automation is on the commandline.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getBrowserCommandLine
func GetBrowserCommandLine() *GetBrowserCommandLineParams {
return &GetBrowserCommandLineParams{}
}
// GetBrowserCommandLineReturns return values.
type GetBrowserCommandLineReturns struct {
Arguments []string `json:"arguments,omitempty"` // Commandline parameters
}
// Do executes Browser.getBrowserCommandLine against the provided context.
//
// returns:
// arguments - Commandline parameters
func (p *GetBrowserCommandLineParams) Do(ctx context.Context) (arguments []string, err error) {
// execute
var res GetBrowserCommandLineReturns
err = cdp.Execute(ctx, CommandGetBrowserCommandLine, nil, &res)
if err != nil {
return nil, err
}
return res.Arguments, nil
}
// GetHistogramsParams get Chrome histograms.
type GetHistogramsParams struct {
Query string `json:"query,omitempty"` // Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.
Delta bool `json:"delta,omitempty"` // If true, retrieve delta since last call.
}
// GetHistograms get Chrome histograms.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistograms
//
// parameters:
func GetHistograms() *GetHistogramsParams {
return &GetHistogramsParams{}
}
// WithQuery requested substring in name. Only histograms which have query as
// a substring in their name are extracted. An empty or absent query returns all
// histograms.
func (p GetHistogramsParams) WithQuery(query string) *GetHistogramsParams {
p.Query = query
return &p
}
// WithDelta if true, retrieve delta since last call.
func (p GetHistogramsParams) WithDelta(delta bool) *GetHistogramsParams {
p.Delta = delta
return &p
}
// GetHistogramsReturns return values.
type GetHistogramsReturns struct {
Histograms []*Histogram `json:"histograms,omitempty"` // Histograms.
}
// Do executes Browser.getHistograms against the provided context.
//
// returns:
// histograms - Histograms.
func (p *GetHistogramsParams) Do(ctx context.Context) (histograms []*Histogram, err error) {
// execute
var res GetHistogramsReturns
err = cdp.Execute(ctx, CommandGetHistograms, p, &res)
if err != nil {
return nil, err
}
return res.Histograms, nil
}
// GetHistogramParams get a Chrome histogram by name.
type GetHistogramParams struct {
Name string `json:"name"` // Requested histogram name.
Delta bool `json:"delta,omitempty"` // If true, retrieve delta since last call.
}
// GetHistogram get a Chrome histogram by name.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistogram
//
// parameters:
// name - Requested histogram name.
func GetHistogram(name string) *GetHistogramParams {
return &GetHistogramParams{
Name: name,
}
}
// WithDelta if true, retrieve delta since last call.
func (p GetHistogramParams) WithDelta(delta bool) *GetHistogramParams {
p.Delta = delta
return &p
}
// GetHistogramReturns return values.
type GetHistogramReturns struct {
Histogram *Histogram `json:"histogram,omitempty"` // Histogram.
}
// Do executes Browser.getHistogram against the provided context.
//
// returns:
// histogram - Histogram.
func (p *GetHistogramParams) Do(ctx context.Context) (histogram *Histogram, err error) {
// execute
var res GetHistogramReturns
err = cdp.Execute(ctx, CommandGetHistogram, p, &res)
if err != nil {
return nil, err
}
return res.Histogram, nil
}
// GetWindowBoundsParams get position and size of the browser window.
type GetWindowBoundsParams struct {
WindowID WindowID `json:"windowId"` // Browser window id.
}
// GetWindowBounds get position and size of the browser window.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getWindowBounds
//
// parameters:
// windowID - Browser window id.
func GetWindowBounds(windowID WindowID) *GetWindowBoundsParams {
return &GetWindowBoundsParams{
WindowID: windowID,
}
}
// GetWindowBoundsReturns return values.
type GetWindowBoundsReturns struct {
Bounds *Bounds `json:"bounds,omitempty"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}
// Do executes Browser.getWindowBounds against the provided context.
//
// returns:
// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
func (p *GetWindowBoundsParams) Do(ctx context.Context) (bounds *Bounds, err error) {
// execute
var res GetWindowBoundsReturns
err = cdp.Execute(ctx, CommandGetWindowBounds, p, &res)
if err != nil {
return nil, err
}
return res.Bounds, nil
}
// GetWindowForTargetParams get the browser window that contains the devtools
// target.
type GetWindowForTargetParams struct {
TargetID target.ID `json:"targetId,omitempty"` // Devtools agent host id. If called as a part of the session, associated targetId is used.
}
// GetWindowForTarget get the browser window that contains the devtools
// target.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getWindowForTarget
//
// parameters:
func GetWindowForTarget() *GetWindowForTargetParams {
return &GetWindowForTargetParams{}
}
// WithTargetID devtools agent host id. If called as a part of the session,
// associated targetId is used.
func (p GetWindowForTargetParams) WithTargetID(targetID target.ID) *GetWindowForTargetParams {
p.TargetID = targetID
return &p
}
// GetWindowForTargetReturns return values.
type GetWindowForTargetReturns struct {
WindowID WindowID `json:"windowId,omitempty"` // Browser window id.
Bounds *Bounds `json:"bounds,omitempty"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}
// Do executes Browser.getWindowForTarget against the provided context.
//
// returns:
// windowID - Browser window id.
// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
func (p *GetWindowForTargetParams) Do(ctx context.Context) (windowID WindowID, bounds *Bounds, err error) {
// execute
var res GetWindowForTargetReturns
err = cdp.Execute(ctx, CommandGetWindowForTarget, p, &res)
if err != nil {
return 0, nil, err
}
return res.WindowID, res.Bounds, nil
}
// SetWindowBoundsParams set position and/or size of the browser window.
type SetWindowBoundsParams struct {
WindowID WindowID `json:"windowId"` // Browser window id.
Bounds *Bounds `json:"bounds"` // New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
}
// SetWindowBounds set position and/or size of the browser window.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setWindowBounds
//
// parameters:
// windowID - Browser window id.
// bounds - New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
func SetWindowBounds(windowID WindowID, bounds *Bounds) *SetWindowBoundsParams {
return &SetWindowBoundsParams{
WindowID: windowID,
Bounds: bounds,
}
}
// Do executes Browser.setWindowBounds against the provided context.
func (p *SetWindowBoundsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetWindowBounds, p, nil)
}
// SetDockTileParams set dock tile details, platform-specific.
type SetDockTileParams struct {
BadgeLabel string `json:"badgeLabel,omitempty"`
Image string `json:"image,omitempty"` // Png encoded image.
}
// SetDockTile set dock tile details, platform-specific.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDockTile
//
// parameters:
func SetDockTile() *SetDockTileParams {
return &SetDockTileParams{}
}
// WithBadgeLabel [no description].
func (p SetDockTileParams) WithBadgeLabel(badgeLabel string) *SetDockTileParams {
p.BadgeLabel = badgeLabel
return &p
}
// WithImage png encoded image.
func (p SetDockTileParams) WithImage(image string) *SetDockTileParams {
p.Image = image
return &p
}
// Do executes Browser.setDockTile against the provided context.
func (p *SetDockTileParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDockTile, p, nil)
}
// Command names.
const (
CommandSetPermission = "Browser.setPermission"
CommandGrantPermissions = "Browser.grantPermissions"
CommandResetPermissions = "Browser.resetPermissions"
CommandSetDownloadBehavior = "Browser.setDownloadBehavior"
CommandClose = "Browser.close"
CommandCrash = "Browser.crash"
CommandCrashGpuProcess = "Browser.crashGpuProcess"
CommandGetVersion = "Browser.getVersion"
CommandGetBrowserCommandLine = "Browser.getBrowserCommandLine"
CommandGetHistograms = "Browser.getHistograms"
CommandGetHistogram = "Browser.getHistogram"
CommandGetWindowBounds = "Browser.getWindowBounds"
CommandGetWindowForTarget = "Browser.getWindowForTarget"
CommandSetWindowBounds = "Browser.setWindowBounds"
CommandSetDockTile = "Browser.setDockTile"
)

2101
vendor/github.com/chromedp/cdproto/browser/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

315
vendor/github.com/chromedp/cdproto/browser/types.go generated vendored Normal file
View File

@@ -0,0 +1,315 @@
package browser
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// WindowID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-WindowID
type WindowID int64
// Int64 returns the WindowID as int64 value.
func (t WindowID) Int64() int64 {
return int64(t)
}
// WindowState the state of the browser window.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-WindowState
type WindowState string
// String returns the WindowState as string value.
func (t WindowState) String() string {
return string(t)
}
// WindowState values.
const (
WindowStateNormal WindowState = "normal"
WindowStateMinimized WindowState = "minimized"
WindowStateMaximized WindowState = "maximized"
WindowStateFullscreen WindowState = "fullscreen"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t WindowState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t WindowState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *WindowState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch WindowState(in.String()) {
case WindowStateNormal:
*t = WindowStateNormal
case WindowStateMinimized:
*t = WindowStateMinimized
case WindowStateMaximized:
*t = WindowStateMaximized
case WindowStateFullscreen:
*t = WindowStateFullscreen
default:
in.AddError(errors.New("unknown WindowState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *WindowState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Bounds browser window bounds information.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Bounds
type Bounds struct {
Left int64 `json:"left,omitempty"` // The offset from the left edge of the screen to the window in pixels.
Top int64 `json:"top,omitempty"` // The offset from the top edge of the screen to the window in pixels.
Width int64 `json:"width,omitempty"` // The window width in pixels.
Height int64 `json:"height,omitempty"` // The window height in pixels.
WindowState WindowState `json:"windowState,omitempty"` // The window state. Default to normal.
}
// PermissionType [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionType
type PermissionType string
// String returns the PermissionType as string value.
func (t PermissionType) String() string {
return string(t)
}
// PermissionType values.
const (
PermissionTypeAccessibilityEvents PermissionType = "accessibilityEvents"
PermissionTypeAudioCapture PermissionType = "audioCapture"
PermissionTypeBackgroundSync PermissionType = "backgroundSync"
PermissionTypeBackgroundFetch PermissionType = "backgroundFetch"
PermissionTypeClipboardReadWrite PermissionType = "clipboardReadWrite"
PermissionTypeClipboardSanitizedWrite PermissionType = "clipboardSanitizedWrite"
PermissionTypeDurableStorage PermissionType = "durableStorage"
PermissionTypeFlash PermissionType = "flash"
PermissionTypeGeolocation PermissionType = "geolocation"
PermissionTypeMidi PermissionType = "midi"
PermissionTypeMidiSysex PermissionType = "midiSysex"
PermissionTypeNfc PermissionType = "nfc"
PermissionTypeNotifications PermissionType = "notifications"
PermissionTypePaymentHandler PermissionType = "paymentHandler"
PermissionTypePeriodicBackgroundSync PermissionType = "periodicBackgroundSync"
PermissionTypeProtectedMediaIdentifier PermissionType = "protectedMediaIdentifier"
PermissionTypeSensors PermissionType = "sensors"
PermissionTypeVideoCapture PermissionType = "videoCapture"
PermissionTypeIdleDetection PermissionType = "idleDetection"
PermissionTypeWakeLockScreen PermissionType = "wakeLockScreen"
PermissionTypeWakeLockSystem PermissionType = "wakeLockSystem"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PermissionType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PermissionType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PermissionType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PermissionType(in.String()) {
case PermissionTypeAccessibilityEvents:
*t = PermissionTypeAccessibilityEvents
case PermissionTypeAudioCapture:
*t = PermissionTypeAudioCapture
case PermissionTypeBackgroundSync:
*t = PermissionTypeBackgroundSync
case PermissionTypeBackgroundFetch:
*t = PermissionTypeBackgroundFetch
case PermissionTypeClipboardReadWrite:
*t = PermissionTypeClipboardReadWrite
case PermissionTypeClipboardSanitizedWrite:
*t = PermissionTypeClipboardSanitizedWrite
case PermissionTypeDurableStorage:
*t = PermissionTypeDurableStorage
case PermissionTypeFlash:
*t = PermissionTypeFlash
case PermissionTypeGeolocation:
*t = PermissionTypeGeolocation
case PermissionTypeMidi:
*t = PermissionTypeMidi
case PermissionTypeMidiSysex:
*t = PermissionTypeMidiSysex
case PermissionTypeNfc:
*t = PermissionTypeNfc
case PermissionTypeNotifications:
*t = PermissionTypeNotifications
case PermissionTypePaymentHandler:
*t = PermissionTypePaymentHandler
case PermissionTypePeriodicBackgroundSync:
*t = PermissionTypePeriodicBackgroundSync
case PermissionTypeProtectedMediaIdentifier:
*t = PermissionTypeProtectedMediaIdentifier
case PermissionTypeSensors:
*t = PermissionTypeSensors
case PermissionTypeVideoCapture:
*t = PermissionTypeVideoCapture
case PermissionTypeIdleDetection:
*t = PermissionTypeIdleDetection
case PermissionTypeWakeLockScreen:
*t = PermissionTypeWakeLockScreen
case PermissionTypeWakeLockSystem:
*t = PermissionTypeWakeLockSystem
default:
in.AddError(errors.New("unknown PermissionType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PermissionType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PermissionSetting [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionSetting
type PermissionSetting string
// String returns the PermissionSetting as string value.
func (t PermissionSetting) String() string {
return string(t)
}
// PermissionSetting values.
const (
PermissionSettingGranted PermissionSetting = "granted"
PermissionSettingDenied PermissionSetting = "denied"
PermissionSettingPrompt PermissionSetting = "prompt"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PermissionSetting) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PermissionSetting) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PermissionSetting) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PermissionSetting(in.String()) {
case PermissionSettingGranted:
*t = PermissionSettingGranted
case PermissionSettingDenied:
*t = PermissionSettingDenied
case PermissionSettingPrompt:
*t = PermissionSettingPrompt
default:
in.AddError(errors.New("unknown PermissionSetting value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PermissionSetting) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PermissionDescriptor definition of PermissionDescriptor defined in the
// Permissions API:
// https://w3c.github.io/permissions/#dictdef-permissiondescriptor.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionDescriptor
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.
}
// Bucket chrome histogram bucket.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Bucket
type Bucket struct {
Low int64 `json:"low"` // Minimum value (inclusive).
High int64 `json:"high"` // Maximum value (exclusive).
Count int64 `json:"count"` // Number of samples.
}
// Histogram chrome histogram.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Histogram
type Histogram struct {
Name string `json:"name"` // Name.
Sum int64 `json:"sum"` // Sum of sample values.
Count int64 `json:"count"` // Total number of samples.
Buckets []*Bucket `json:"buckets"` // Buckets.
}
// 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
// guids.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDownloadBehavior
type SetDownloadBehaviorBehavior string
// String returns the SetDownloadBehaviorBehavior as string value.
func (t SetDownloadBehaviorBehavior) String() string {
return string(t)
}
// SetDownloadBehaviorBehavior values.
const (
SetDownloadBehaviorBehaviorDeny SetDownloadBehaviorBehavior = "deny"
SetDownloadBehaviorBehaviorAllow SetDownloadBehaviorBehavior = "allow"
SetDownloadBehaviorBehaviorAllowAndName SetDownloadBehaviorBehavior = "allowAndName"
SetDownloadBehaviorBehaviorDefault SetDownloadBehaviorBehavior = "default"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SetDownloadBehaviorBehavior) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SetDownloadBehaviorBehavior) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SetDownloadBehaviorBehavior) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetDownloadBehaviorBehavior(in.String()) {
case SetDownloadBehaviorBehaviorDeny:
*t = SetDownloadBehaviorBehaviorDeny
case SetDownloadBehaviorBehaviorAllow:
*t = SetDownloadBehaviorBehaviorAllow
case SetDownloadBehaviorBehaviorAllowAndName:
*t = SetDownloadBehaviorBehaviorAllowAndName
case SetDownloadBehaviorBehaviorDefault:
*t = SetDownloadBehaviorBehaviorDefault
default:
in.AddError(errors.New("unknown SetDownloadBehaviorBehavior value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SetDownloadBehaviorBehavior) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@@ -0,0 +1,210 @@
// Package cachestorage provides the Chrome DevTools Protocol
// commands, types, and events for the CacheStorage domain.
//
// Generated by the cdproto-gen command.
package cachestorage
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// DeleteCacheParams deletes a cache.
type DeleteCacheParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache for deletion.
}
// DeleteCache deletes a cache.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#method-deleteCache
//
// parameters:
// cacheID - Id of cache for deletion.
func DeleteCache(cacheID CacheID) *DeleteCacheParams {
return &DeleteCacheParams{
CacheID: cacheID,
}
}
// Do executes CacheStorage.deleteCache against the provided context.
func (p *DeleteCacheParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDeleteCache, p, nil)
}
// DeleteEntryParams deletes a cache entry.
type DeleteEntryParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache where the entry will be deleted.
Request string `json:"request"` // URL spec of the request.
}
// DeleteEntry deletes a cache entry.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#method-deleteEntry
//
// parameters:
// cacheID - Id of cache where the entry will be deleted.
// request - URL spec of the request.
func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
return &DeleteEntryParams{
CacheID: cacheID,
Request: request,
}
}
// Do executes CacheStorage.deleteEntry against the provided context.
func (p *DeleteEntryParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDeleteEntry, p, nil)
}
// RequestCacheNamesParams requests cache names.
type RequestCacheNamesParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
}
// RequestCacheNames requests cache names.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#method-requestCacheNames
//
// parameters:
// securityOrigin - Security origin.
func RequestCacheNames(securityOrigin string) *RequestCacheNamesParams {
return &RequestCacheNamesParams{
SecurityOrigin: securityOrigin,
}
}
// RequestCacheNamesReturns return values.
type RequestCacheNamesReturns struct {
Caches []*Cache `json:"caches,omitempty"` // Caches for the security origin.
}
// Do executes CacheStorage.requestCacheNames against the provided context.
//
// returns:
// caches - Caches for the security origin.
func (p *RequestCacheNamesParams) Do(ctx context.Context) (caches []*Cache, err error) {
// execute
var res RequestCacheNamesReturns
err = cdp.Execute(ctx, CommandRequestCacheNames, p, &res)
if err != nil {
return nil, err
}
return res.Caches, nil
}
// RequestCachedResponseParams fetches cache entry.
type RequestCachedResponseParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache that contains the entry.
RequestURL string `json:"requestURL"` // URL spec of the request.
RequestHeaders []*Header `json:"requestHeaders"` // headers of the request.
}
// RequestCachedResponse fetches cache entry.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#method-requestCachedResponse
//
// parameters:
// cacheID - Id of cache that contains the entry.
// requestURL - URL spec of the request.
// requestHeaders - headers of the request.
func RequestCachedResponse(cacheID CacheID, requestURL string, requestHeaders []*Header) *RequestCachedResponseParams {
return &RequestCachedResponseParams{
CacheID: cacheID,
RequestURL: requestURL,
RequestHeaders: requestHeaders,
}
}
// RequestCachedResponseReturns return values.
type RequestCachedResponseReturns struct {
Response *CachedResponse `json:"response,omitempty"` // Response read from the cache.
}
// Do executes CacheStorage.requestCachedResponse against the provided context.
//
// returns:
// response - Response read from the cache.
func (p *RequestCachedResponseParams) Do(ctx context.Context) (response *CachedResponse, err error) {
// execute
var res RequestCachedResponseReturns
err = cdp.Execute(ctx, CommandRequestCachedResponse, p, &res)
if err != nil {
return nil, err
}
return res.Response, nil
}
// RequestEntriesParams requests data from cache.
type RequestEntriesParams struct {
CacheID CacheID `json:"cacheId"` // ID of cache to get entries from.
SkipCount int64 `json:"skipCount,omitempty"` // Number of records to skip.
PageSize int64 `json:"pageSize,omitempty"` // Number of records to fetch.
PathFilter string `json:"pathFilter,omitempty"` // If present, only return the entries containing this substring in the path
}
// RequestEntries requests data from cache.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#method-requestEntries
//
// parameters:
// cacheID - ID of cache to get entries from.
func RequestEntries(cacheID CacheID) *RequestEntriesParams {
return &RequestEntriesParams{
CacheID: cacheID,
}
}
// WithSkipCount number of records to skip.
func (p RequestEntriesParams) WithSkipCount(skipCount int64) *RequestEntriesParams {
p.SkipCount = skipCount
return &p
}
// WithPageSize number of records to fetch.
func (p RequestEntriesParams) WithPageSize(pageSize int64) *RequestEntriesParams {
p.PageSize = pageSize
return &p
}
// WithPathFilter if present, only return the entries containing this
// substring in the path.
func (p RequestEntriesParams) WithPathFilter(pathFilter string) *RequestEntriesParams {
p.PathFilter = pathFilter
return &p
}
// RequestEntriesReturns return values.
type RequestEntriesReturns struct {
CacheDataEntries []*DataEntry `json:"cacheDataEntries,omitempty"` // Array of object store data entries.
ReturnCount float64 `json:"returnCount,omitempty"` // Count of returned entries from this storage. If pathFilter is empty, it is the count of all entries from this storage.
}
// Do executes CacheStorage.requestEntries against the provided context.
//
// returns:
// cacheDataEntries - Array of object store data entries.
// returnCount - Count of returned entries from this storage. If pathFilter is empty, it is the count of all entries from this storage.
func (p *RequestEntriesParams) Do(ctx context.Context) (cacheDataEntries []*DataEntry, returnCount float64, err error) {
// execute
var res RequestEntriesReturns
err = cdp.Execute(ctx, CommandRequestEntries, p, &res)
if err != nil {
return nil, 0, err
}
return res.CacheDataEntries, res.ReturnCount, nil
}
// Command names.
const (
CommandDeleteCache = "CacheStorage.deleteCache"
CommandDeleteEntry = "CacheStorage.deleteEntry"
CommandRequestCacheNames = "CacheStorage.requestCacheNames"
CommandRequestCachedResponse = "CacheStorage.requestCachedResponse"
CommandRequestEntries = "CacheStorage.requestEntries"
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
package cachestorage
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// CacheID unique identifier of the Cache object.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-CacheId
type CacheID string
// String returns the CacheID as string value.
func (t CacheID) String() string {
return string(t)
}
// CachedResponseType type of HTTP response cached.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-CachedResponseType
type CachedResponseType string
// String returns the CachedResponseType as string value.
func (t CachedResponseType) String() string {
return string(t)
}
// CachedResponseType values.
const (
CachedResponseTypeBasic CachedResponseType = "basic"
CachedResponseTypeCors CachedResponseType = "cors"
CachedResponseTypeDefault CachedResponseType = "default"
CachedResponseTypeError CachedResponseType = "error"
CachedResponseTypeOpaqueResponse CachedResponseType = "opaqueResponse"
CachedResponseTypeOpaqueRedirect CachedResponseType = "opaqueRedirect"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t CachedResponseType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t CachedResponseType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *CachedResponseType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch CachedResponseType(in.String()) {
case CachedResponseTypeBasic:
*t = CachedResponseTypeBasic
case CachedResponseTypeCors:
*t = CachedResponseTypeCors
case CachedResponseTypeDefault:
*t = CachedResponseTypeDefault
case CachedResponseTypeError:
*t = CachedResponseTypeError
case CachedResponseTypeOpaqueResponse:
*t = CachedResponseTypeOpaqueResponse
case CachedResponseTypeOpaqueRedirect:
*t = CachedResponseTypeOpaqueRedirect
default:
in.AddError(errors.New("unknown CachedResponseType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *CachedResponseType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// DataEntry data entry.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-DataEntry
type DataEntry struct {
RequestURL string `json:"requestURL"` // Request URL.
RequestMethod string `json:"requestMethod"` // Request method.
RequestHeaders []*Header `json:"requestHeaders"` // Request headers
ResponseTime float64 `json:"responseTime"` // Number of seconds since epoch.
ResponseStatus int64 `json:"responseStatus"` // HTTP response status code.
ResponseStatusText string `json:"responseStatusText"` // HTTP response status text.
ResponseType CachedResponseType `json:"responseType"` // HTTP response type
ResponseHeaders []*Header `json:"responseHeaders"` // Response headers
}
// Cache cache identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-Cache
type Cache struct {
CacheID CacheID `json:"cacheId"` // An opaque unique id of the cache.
SecurityOrigin string `json:"securityOrigin"` // Security origin of the cache.
CacheName string `json:"cacheName"` // The name of the cache.
}
// Header [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-Header
type Header struct {
Name string `json:"name"`
Value string `json:"value"`
}
// CachedResponse cached response.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage#type-CachedResponse
type CachedResponse struct {
Body string `json:"body"` // Entry content, base64-encoded.
}

142
vendor/github.com/chromedp/cdproto/cast/cast.go generated vendored Normal file
View File

@@ -0,0 +1,142 @@
// Package cast provides the Chrome DevTools Protocol
// commands, types, and events for the Cast domain.
//
// A domain for interacting with Cast, Presentation API, and Remote Playback
// API functionalities.
//
// Generated by the cdproto-gen command.
package cast
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// EnableParams starts observing for sinks that can be used for tab
// mirroring, and if set, sinks compatible with |presentationUrl| as well. When
// sinks are found, a |sinksUpdated| event is fired. Also starts observing for
// issue messages. When an issue is added or removed, an |issueUpdated| event is
// fired.
type EnableParams struct {
PresentationURL string `json:"presentationUrl,omitempty"`
}
// Enable starts observing for sinks that can be used for tab mirroring, and
// if set, sinks compatible with |presentationUrl| as well. When sinks are
// found, a |sinksUpdated| event is fired. Also starts observing for issue
// messages. When an issue is added or removed, an |issueUpdated| event is
// fired.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-enable
//
// parameters:
func Enable() *EnableParams {
return &EnableParams{}
}
// WithPresentationURL [no description].
func (p EnableParams) WithPresentationURL(presentationURL string) *EnableParams {
p.PresentationURL = presentationURL
return &p
}
// Do executes Cast.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, p, nil)
}
// DisableParams stops observing for sinks and issues.
type DisableParams struct{}
// Disable stops observing for sinks and issues.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Cast.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// SetSinkToUseParams sets a sink to be used when the web page requests the
// browser to choose a sink via Presentation API, Remote Playback API, or Cast
// SDK.
type SetSinkToUseParams struct {
SinkName string `json:"sinkName"`
}
// SetSinkToUse sets a sink to be used when the web page requests the browser
// to choose a sink via Presentation API, Remote Playback API, or Cast SDK.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-setSinkToUse
//
// parameters:
// sinkName
func SetSinkToUse(sinkName string) *SetSinkToUseParams {
return &SetSinkToUseParams{
SinkName: sinkName,
}
}
// Do executes Cast.setSinkToUse against the provided context.
func (p *SetSinkToUseParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetSinkToUse, p, nil)
}
// StartTabMirroringParams starts mirroring the tab to the sink.
type StartTabMirroringParams struct {
SinkName string `json:"sinkName"`
}
// StartTabMirroring starts mirroring the tab to the sink.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-startTabMirroring
//
// parameters:
// sinkName
func StartTabMirroring(sinkName string) *StartTabMirroringParams {
return &StartTabMirroringParams{
SinkName: sinkName,
}
}
// Do executes Cast.startTabMirroring against the provided context.
func (p *StartTabMirroringParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStartTabMirroring, p, nil)
}
// StopCastingParams stops the active Cast session on the sink.
type StopCastingParams struct {
SinkName string `json:"sinkName"`
}
// StopCasting stops the active Cast session on the sink.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-stopCasting
//
// parameters:
// sinkName
func StopCasting(sinkName string) *StopCastingParams {
return &StopCastingParams{
SinkName: sinkName,
}
}
// Do executes Cast.stopCasting against the provided context.
func (p *StopCastingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStopCasting, p, nil)
}
// Command names.
const (
CommandEnable = "Cast.enable"
CommandDisable = "Cast.disable"
CommandSetSinkToUse = "Cast.setSinkToUse"
CommandStartTabMirroring = "Cast.startTabMirroring"
CommandStopCasting = "Cast.stopCasting"
)

599
vendor/github.com/chromedp/cdproto/cast/easyjson.go generated vendored Normal file
View File

@@ -0,0 +1,599 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package cast
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast(in *jlexer.Lexer, out *StopCastingParams) {
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 "sinkName":
out.SinkName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast(out *jwriter.Writer, in StopCastingParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"sinkName\":"
out.RawString(prefix[1:])
out.String(string(in.SinkName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StopCastingParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StopCastingParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StopCastingParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StopCastingParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast1(in *jlexer.Lexer, out *StartTabMirroringParams) {
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 "sinkName":
out.SinkName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast1(out *jwriter.Writer, in StartTabMirroringParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"sinkName\":"
out.RawString(prefix[1:])
out.String(string(in.SinkName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StartTabMirroringParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StartTabMirroringParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StartTabMirroringParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StartTabMirroringParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast2(in *jlexer.Lexer, out *Sink) {
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 "name":
out.Name = string(in.String())
case "id":
out.ID = string(in.String())
case "session":
out.Session = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast2(out *jwriter.Writer, in Sink) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"name\":"
out.RawString(prefix[1:])
out.String(string(in.Name))
}
{
const prefix string = ",\"id\":"
out.RawString(prefix)
out.String(string(in.ID))
}
if in.Session != "" {
const prefix string = ",\"session\":"
out.RawString(prefix)
out.String(string(in.Session))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Sink) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Sink) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Sink) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Sink) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast3(in *jlexer.Lexer, out *SetSinkToUseParams) {
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 "sinkName":
out.SinkName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast3(out *jwriter.Writer, in SetSinkToUseParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"sinkName\":"
out.RawString(prefix[1:])
out.String(string(in.SinkName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetSinkToUseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetSinkToUseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetSinkToUseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetSinkToUseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast4(in *jlexer.Lexer, out *EventSinksUpdated) {
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 "sinks":
if in.IsNull() {
in.Skip()
out.Sinks = nil
} else {
in.Delim('[')
if out.Sinks == nil {
if !in.IsDelim(']') {
out.Sinks = make([]*Sink, 0, 8)
} else {
out.Sinks = []*Sink{}
}
} else {
out.Sinks = (out.Sinks)[:0]
}
for !in.IsDelim(']') {
var v1 *Sink
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(Sink)
}
(*v1).UnmarshalEasyJSON(in)
}
out.Sinks = append(out.Sinks, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast4(out *jwriter.Writer, in EventSinksUpdated) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"sinks\":"
out.RawString(prefix[1:])
if in.Sinks == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v2, v3 := range in.Sinks {
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 EventSinksUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventSinksUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventSinksUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventSinksUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast5(in *jlexer.Lexer, out *EventIssueUpdated) {
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 "issueMessage":
out.IssueMessage = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast5(out *jwriter.Writer, in EventIssueUpdated) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"issueMessage\":"
out.RawString(prefix[1:])
out.String(string(in.IssueMessage))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventIssueUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventIssueUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventIssueUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventIssueUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast6(in *jlexer.Lexer, out *EnableParams) {
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 "presentationUrl":
out.PresentationURL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast6(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
if in.PresentationURL != "" {
const prefix string = ",\"presentationUrl\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.PresentationURL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast6(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast7(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast7(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast7(l, v)
}

19
vendor/github.com/chromedp/cdproto/cast/events.go generated vendored Normal file
View File

@@ -0,0 +1,19 @@
package cast
// Code generated by cdproto-gen. DO NOT EDIT.
// EventSinksUpdated this is fired whenever the list of available sinks
// changes. A sink is a device or a software surface that you can cast to.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#event-sinksUpdated
type EventSinksUpdated struct {
Sinks []*Sink `json:"sinks"`
}
// EventIssueUpdated this is fired whenever the outstanding issue/error
// message changes. |issueMessage| is empty if there is no issue.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#event-issueUpdated
type EventIssueUpdated struct {
IssueMessage string `json:"issueMessage"`
}

12
vendor/github.com/chromedp/cdproto/cast/types.go generated vendored Normal file
View File

@@ -0,0 +1,12 @@
package cast
// Code generated by cdproto-gen. DO NOT EDIT.
// Sink [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#type-Sink
type Sink struct {
Name string `json:"name"`
ID string `json:"id"`
Session string `json:"session,omitempty"` // Text describing the current session. Present only if there is an active session on the sink.
}

785
vendor/github.com/chromedp/cdproto/cdp/easyjson.go generated vendored Normal file
View File

@@ -0,0 +1,785 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package cdp
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp(in *jlexer.Lexer, out *RGBA) {
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 "r":
out.R = int64(in.Int64())
case "g":
out.G = int64(in.Int64())
case "b":
out.B = int64(in.Int64())
case "a":
out.A = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp(out *jwriter.Writer, in RGBA) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"r\":"
out.RawString(prefix[1:])
out.Int64(int64(in.R))
}
{
const prefix string = ",\"g\":"
out.RawString(prefix)
out.Int64(int64(in.G))
}
{
const prefix string = ",\"b\":"
out.RawString(prefix)
out.Int64(int64(in.B))
}
{
const prefix string = ",\"a\":"
out.RawString(prefix)
out.Float64(float64(in.A))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RGBA) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RGBA) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RGBA) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RGBA) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp1(in *jlexer.Lexer, out *Node) {
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 "nodeId":
(out.NodeID).UnmarshalEasyJSON(in)
case "parentId":
(out.ParentID).UnmarshalEasyJSON(in)
case "backendNodeId":
(out.BackendNodeID).UnmarshalEasyJSON(in)
case "nodeType":
(out.NodeType).UnmarshalEasyJSON(in)
case "nodeName":
out.NodeName = string(in.String())
case "localName":
out.LocalName = string(in.String())
case "nodeValue":
out.NodeValue = string(in.String())
case "childNodeCount":
out.ChildNodeCount = int64(in.Int64())
case "children":
if in.IsNull() {
in.Skip()
out.Children = nil
} else {
in.Delim('[')
if out.Children == nil {
if !in.IsDelim(']') {
out.Children = make([]*Node, 0, 8)
} else {
out.Children = []*Node{}
}
} else {
out.Children = (out.Children)[:0]
}
for !in.IsDelim(']') {
var v1 *Node
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(Node)
}
(*v1).UnmarshalEasyJSON(in)
}
out.Children = append(out.Children, v1)
in.WantComma()
}
in.Delim(']')
}
case "attributes":
if in.IsNull() {
in.Skip()
out.Attributes = nil
} else {
in.Delim('[')
if out.Attributes == nil {
if !in.IsDelim(']') {
out.Attributes = make([]string, 0, 4)
} else {
out.Attributes = []string{}
}
} else {
out.Attributes = (out.Attributes)[:0]
}
for !in.IsDelim(']') {
var v2 string
v2 = string(in.String())
out.Attributes = append(out.Attributes, v2)
in.WantComma()
}
in.Delim(']')
}
case "documentURL":
out.DocumentURL = string(in.String())
case "baseURL":
out.BaseURL = string(in.String())
case "publicId":
out.PublicID = string(in.String())
case "systemId":
out.SystemID = string(in.String())
case "internalSubset":
out.InternalSubset = string(in.String())
case "xmlVersion":
out.XMLVersion = string(in.String())
case "name":
out.Name = string(in.String())
case "value":
out.Value = string(in.String())
case "pseudoType":
(out.PseudoType).UnmarshalEasyJSON(in)
case "shadowRootType":
(out.ShadowRootType).UnmarshalEasyJSON(in)
case "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
case "contentDocument":
if in.IsNull() {
in.Skip()
out.ContentDocument = nil
} else {
if out.ContentDocument == nil {
out.ContentDocument = new(Node)
}
(*out.ContentDocument).UnmarshalEasyJSON(in)
}
case "shadowRoots":
if in.IsNull() {
in.Skip()
out.ShadowRoots = nil
} else {
in.Delim('[')
if out.ShadowRoots == nil {
if !in.IsDelim(']') {
out.ShadowRoots = make([]*Node, 0, 8)
} else {
out.ShadowRoots = []*Node{}
}
} else {
out.ShadowRoots = (out.ShadowRoots)[:0]
}
for !in.IsDelim(']') {
var v3 *Node
if in.IsNull() {
in.Skip()
v3 = nil
} else {
if v3 == nil {
v3 = new(Node)
}
(*v3).UnmarshalEasyJSON(in)
}
out.ShadowRoots = append(out.ShadowRoots, v3)
in.WantComma()
}
in.Delim(']')
}
case "templateContent":
if in.IsNull() {
in.Skip()
out.TemplateContent = nil
} else {
if out.TemplateContent == nil {
out.TemplateContent = new(Node)
}
(*out.TemplateContent).UnmarshalEasyJSON(in)
}
case "pseudoElements":
if in.IsNull() {
in.Skip()
out.PseudoElements = nil
} else {
in.Delim('[')
if out.PseudoElements == nil {
if !in.IsDelim(']') {
out.PseudoElements = make([]*Node, 0, 8)
} else {
out.PseudoElements = []*Node{}
}
} else {
out.PseudoElements = (out.PseudoElements)[:0]
}
for !in.IsDelim(']') {
var v4 *Node
if in.IsNull() {
in.Skip()
v4 = nil
} else {
if v4 == nil {
v4 = new(Node)
}
(*v4).UnmarshalEasyJSON(in)
}
out.PseudoElements = append(out.PseudoElements, v4)
in.WantComma()
}
in.Delim(']')
}
case "importedDocument":
if in.IsNull() {
in.Skip()
out.ImportedDocument = nil
} else {
if out.ImportedDocument == nil {
out.ImportedDocument = new(Node)
}
(*out.ImportedDocument).UnmarshalEasyJSON(in)
}
case "distributedNodes":
if in.IsNull() {
in.Skip()
out.DistributedNodes = nil
} else {
in.Delim('[')
if out.DistributedNodes == nil {
if !in.IsDelim(']') {
out.DistributedNodes = make([]*BackendNode, 0, 8)
} else {
out.DistributedNodes = []*BackendNode{}
}
} else {
out.DistributedNodes = (out.DistributedNodes)[:0]
}
for !in.IsDelim(']') {
var v5 *BackendNode
if in.IsNull() {
in.Skip()
v5 = nil
} else {
if v5 == nil {
v5 = new(BackendNode)
}
(*v5).UnmarshalEasyJSON(in)
}
out.DistributedNodes = append(out.DistributedNodes, v5)
in.WantComma()
}
in.Delim(']')
}
case "isSVG":
out.IsSVG = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1(out *jwriter.Writer, in Node) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"nodeId\":"
out.RawString(prefix[1:])
out.Int64(int64(in.NodeID))
}
if in.ParentID != 0 {
const prefix string = ",\"parentId\":"
out.RawString(prefix)
out.Int64(int64(in.ParentID))
}
{
const prefix string = ",\"backendNodeId\":"
out.RawString(prefix)
out.Int64(int64(in.BackendNodeID))
}
{
const prefix string = ",\"nodeType\":"
out.RawString(prefix)
(in.NodeType).MarshalEasyJSON(out)
}
{
const prefix string = ",\"nodeName\":"
out.RawString(prefix)
out.String(string(in.NodeName))
}
{
const prefix string = ",\"localName\":"
out.RawString(prefix)
out.String(string(in.LocalName))
}
{
const prefix string = ",\"nodeValue\":"
out.RawString(prefix)
out.String(string(in.NodeValue))
}
if in.ChildNodeCount != 0 {
const prefix string = ",\"childNodeCount\":"
out.RawString(prefix)
out.Int64(int64(in.ChildNodeCount))
}
if len(in.Children) != 0 {
const prefix string = ",\"children\":"
out.RawString(prefix)
{
out.RawByte('[')
for v6, v7 := range in.Children {
if v6 > 0 {
out.RawByte(',')
}
if v7 == nil {
out.RawString("null")
} else {
(*v7).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
if len(in.Attributes) != 0 {
const prefix string = ",\"attributes\":"
out.RawString(prefix)
{
out.RawByte('[')
for v8, v9 := range in.Attributes {
if v8 > 0 {
out.RawByte(',')
}
out.String(string(v9))
}
out.RawByte(']')
}
}
if in.DocumentURL != "" {
const prefix string = ",\"documentURL\":"
out.RawString(prefix)
out.String(string(in.DocumentURL))
}
if in.BaseURL != "" {
const prefix string = ",\"baseURL\":"
out.RawString(prefix)
out.String(string(in.BaseURL))
}
if in.PublicID != "" {
const prefix string = ",\"publicId\":"
out.RawString(prefix)
out.String(string(in.PublicID))
}
if in.SystemID != "" {
const prefix string = ",\"systemId\":"
out.RawString(prefix)
out.String(string(in.SystemID))
}
if in.InternalSubset != "" {
const prefix string = ",\"internalSubset\":"
out.RawString(prefix)
out.String(string(in.InternalSubset))
}
if in.XMLVersion != "" {
const prefix string = ",\"xmlVersion\":"
out.RawString(prefix)
out.String(string(in.XMLVersion))
}
if in.Name != "" {
const prefix string = ",\"name\":"
out.RawString(prefix)
out.String(string(in.Name))
}
if in.Value != "" {
const prefix string = ",\"value\":"
out.RawString(prefix)
out.String(string(in.Value))
}
if in.PseudoType != "" {
const prefix string = ",\"pseudoType\":"
out.RawString(prefix)
(in.PseudoType).MarshalEasyJSON(out)
}
if in.ShadowRootType != "" {
const prefix string = ",\"shadowRootType\":"
out.RawString(prefix)
(in.ShadowRootType).MarshalEasyJSON(out)
}
if in.FrameID != "" {
const prefix string = ",\"frameId\":"
out.RawString(prefix)
out.String(string(in.FrameID))
}
if in.ContentDocument != nil {
const prefix string = ",\"contentDocument\":"
out.RawString(prefix)
(*in.ContentDocument).MarshalEasyJSON(out)
}
if len(in.ShadowRoots) != 0 {
const prefix string = ",\"shadowRoots\":"
out.RawString(prefix)
{
out.RawByte('[')
for v10, v11 := range in.ShadowRoots {
if v10 > 0 {
out.RawByte(',')
}
if v11 == nil {
out.RawString("null")
} else {
(*v11).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
if in.TemplateContent != nil {
const prefix string = ",\"templateContent\":"
out.RawString(prefix)
(*in.TemplateContent).MarshalEasyJSON(out)
}
if len(in.PseudoElements) != 0 {
const prefix string = ",\"pseudoElements\":"
out.RawString(prefix)
{
out.RawByte('[')
for v12, v13 := range in.PseudoElements {
if v12 > 0 {
out.RawByte(',')
}
if v13 == nil {
out.RawString("null")
} else {
(*v13).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
if in.ImportedDocument != nil {
const prefix string = ",\"importedDocument\":"
out.RawString(prefix)
(*in.ImportedDocument).MarshalEasyJSON(out)
}
if len(in.DistributedNodes) != 0 {
const prefix string = ",\"distributedNodes\":"
out.RawString(prefix)
{
out.RawByte('[')
for v14, v15 := range in.DistributedNodes {
if v14 > 0 {
out.RawByte(',')
}
if v15 == nil {
out.RawString("null")
} else {
(*v15).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
if in.IsSVG {
const prefix string = ",\"isSVG\":"
out.RawString(prefix)
out.Bool(bool(in.IsSVG))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Node) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Node) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Node) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp2(in *jlexer.Lexer, out *Frame) {
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 "id":
(out.ID).UnmarshalEasyJSON(in)
case "parentId":
(out.ParentID).UnmarshalEasyJSON(in)
case "loaderId":
out.LoaderID = LoaderID(in.String())
case "name":
out.Name = string(in.String())
case "url":
out.URL = string(in.String())
case "urlFragment":
out.URLFragment = string(in.String())
case "securityOrigin":
out.SecurityOrigin = string(in.String())
case "mimeType":
out.MimeType = string(in.String())
case "unreachableUrl":
out.UnreachableURL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2(out *jwriter.Writer, in Frame) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"id\":"
out.RawString(prefix[1:])
out.String(string(in.ID))
}
if in.ParentID != "" {
const prefix string = ",\"parentId\":"
out.RawString(prefix)
out.String(string(in.ParentID))
}
{
const prefix string = ",\"loaderId\":"
out.RawString(prefix)
out.String(string(in.LoaderID))
}
if in.Name != "" {
const prefix string = ",\"name\":"
out.RawString(prefix)
out.String(string(in.Name))
}
{
const prefix string = ",\"url\":"
out.RawString(prefix)
out.String(string(in.URL))
}
if in.URLFragment != "" {
const prefix string = ",\"urlFragment\":"
out.RawString(prefix)
out.String(string(in.URLFragment))
}
{
const prefix string = ",\"securityOrigin\":"
out.RawString(prefix)
out.String(string(in.SecurityOrigin))
}
{
const prefix string = ",\"mimeType\":"
out.RawString(prefix)
out.String(string(in.MimeType))
}
if in.UnreachableURL != "" {
const prefix string = ",\"unreachableUrl\":"
out.RawString(prefix)
out.String(string(in.UnreachableURL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Frame) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Frame) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Frame) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Frame) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp3(in *jlexer.Lexer, out *BackendNode) {
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 "nodeType":
(out.NodeType).UnmarshalEasyJSON(in)
case "nodeName":
out.NodeName = string(in.String())
case "backendNodeId":
(out.BackendNodeID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp3(out *jwriter.Writer, in BackendNode) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"nodeType\":"
out.RawString(prefix[1:])
(in.NodeType).MarshalEasyJSON(out)
}
{
const prefix string = ",\"nodeName\":"
out.RawString(prefix)
out.String(string(in.NodeName))
}
{
const prefix string = ",\"backendNodeId\":"
out.RawString(prefix)
out.Int64(int64(in.BackendNodeID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v BackendNode) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v BackendNode) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *BackendNode) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BackendNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp3(l, v)
}

787
vendor/github.com/chromedp/cdproto/cdp/types.go generated vendored Normal file
View File

@@ -0,0 +1,787 @@
package cdp
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
"sync"
"time"
"github.com/knq/sysutil"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Executor is the common interface for executing a command.
type Executor interface {
// Execute executes the command.
Execute(context.Context, string, easyjson.Marshaler, easyjson.Unmarshaler) error
}
// contextKey is the context key type.
type contextKey int
// context keys.
const (
executorKey contextKey = iota
)
// WithExecutor sets the message executor for the context.
func WithExecutor(parent context.Context, executor Executor) context.Context {
return context.WithValue(parent, executorKey, executor)
}
// ExecutorFromContext returns the message executor for the context.
func ExecutorFromContext(ctx context.Context) Executor {
return ctx.Value(executorKey).(Executor)
}
// Execute uses the context's message executor to send a command or event
// method marshaling the provided parameters, and unmarshaling to res.
func Execute(ctx context.Context, method string, params easyjson.Marshaler, res easyjson.Unmarshaler) error {
if executor := ctx.Value(executorKey); executor != nil {
return executor.(Executor).Execute(ctx, method, params, res)
}
return ErrInvalidContext
}
// Error is a error.
type Error string
// Error values.
const (
// ErrInvalidContext is the invalid context error.
ErrInvalidContext Error = "invalid context"
// ErrMsgMissingParamsOrResult is the msg missing params or result error.
ErrMsgMissingParamsOrResult Error = "msg missing params or result"
)
// Error satisfies the error interface.
func (err Error) Error() string {
return string(err)
}
// ErrUnknownCommandOrEvent is an unknown command or event error.
type ErrUnknownCommandOrEvent string
// Error satisfies the error interface.
func (err ErrUnknownCommandOrEvent) Error() string {
return fmt.Sprintf("unknown command or event %q", string(err))
}
// BrowserContextID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-BrowserContextID
type BrowserContextID string
// String returns the BrowserContextID as string value.
func (t BrowserContextID) String() string {
return string(t)
}
// NodeID unique DOM node identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-NodeId
type NodeID int64
// Int64 returns the NodeID as int64 value.
func (t NodeID) Int64() int64 {
return int64(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *NodeID) UnmarshalEasyJSON(in *jlexer.Lexer) {
buf := in.Raw()
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
buf = buf[1 : l-1]
}
v, err := strconv.ParseInt(string(buf), 10, 64)
if err != nil {
in.AddError(err)
}
*t = NodeID(v)
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *NodeID) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// BackendNodeID unique DOM node identifier used to reference a node that may
// not have been pushed to the front-end.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-BackendNodeId
type BackendNodeID int64
// Int64 returns the BackendNodeID as int64 value.
func (t BackendNodeID) Int64() int64 {
return int64(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *BackendNodeID) UnmarshalEasyJSON(in *jlexer.Lexer) {
buf := in.Raw()
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
buf = buf[1 : l-1]
}
v, err := strconv.ParseInt(string(buf), 10, 64)
if err != nil {
in.AddError(err)
}
*t = BackendNodeID(v)
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *BackendNodeID) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// BackendNode backend node with a friendly name.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-BackendNode
type BackendNode struct {
NodeType NodeType `json:"nodeType"` // Node's nodeType.
NodeName string `json:"nodeName"` // Node's nodeName.
BackendNodeID BackendNodeID `json:"backendNodeId"`
}
// PseudoType pseudo element type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-PseudoType
type PseudoType string
// String returns the PseudoType as string value.
func (t PseudoType) String() string {
return string(t)
}
// PseudoType values.
const (
PseudoTypeFirstLine PseudoType = "first-line"
PseudoTypeFirstLetter PseudoType = "first-letter"
PseudoTypeBefore PseudoType = "before"
PseudoTypeAfter PseudoType = "after"
PseudoTypeMarker PseudoType = "marker"
PseudoTypeBackdrop PseudoType = "backdrop"
PseudoTypeSelection PseudoType = "selection"
PseudoTypeFirstLineInherited PseudoType = "first-line-inherited"
PseudoTypeScrollbar PseudoType = "scrollbar"
PseudoTypeScrollbarThumb PseudoType = "scrollbar-thumb"
PseudoTypeScrollbarButton PseudoType = "scrollbar-button"
PseudoTypeScrollbarTrack PseudoType = "scrollbar-track"
PseudoTypeScrollbarTrackPiece PseudoType = "scrollbar-track-piece"
PseudoTypeScrollbarCorner PseudoType = "scrollbar-corner"
PseudoTypeResizer PseudoType = "resizer"
PseudoTypeInputListButton PseudoType = "input-list-button"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PseudoType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PseudoType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PseudoType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PseudoType(in.String()) {
case PseudoTypeFirstLine:
*t = PseudoTypeFirstLine
case PseudoTypeFirstLetter:
*t = PseudoTypeFirstLetter
case PseudoTypeBefore:
*t = PseudoTypeBefore
case PseudoTypeAfter:
*t = PseudoTypeAfter
case PseudoTypeMarker:
*t = PseudoTypeMarker
case PseudoTypeBackdrop:
*t = PseudoTypeBackdrop
case PseudoTypeSelection:
*t = PseudoTypeSelection
case PseudoTypeFirstLineInherited:
*t = PseudoTypeFirstLineInherited
case PseudoTypeScrollbar:
*t = PseudoTypeScrollbar
case PseudoTypeScrollbarThumb:
*t = PseudoTypeScrollbarThumb
case PseudoTypeScrollbarButton:
*t = PseudoTypeScrollbarButton
case PseudoTypeScrollbarTrack:
*t = PseudoTypeScrollbarTrack
case PseudoTypeScrollbarTrackPiece:
*t = PseudoTypeScrollbarTrackPiece
case PseudoTypeScrollbarCorner:
*t = PseudoTypeScrollbarCorner
case PseudoTypeResizer:
*t = PseudoTypeResizer
case PseudoTypeInputListButton:
*t = PseudoTypeInputListButton
default:
in.AddError(errors.New("unknown PseudoType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PseudoType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ShadowRootType shadow root type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-ShadowRootType
type ShadowRootType string
// String returns the ShadowRootType as string value.
func (t ShadowRootType) String() string {
return string(t)
}
// ShadowRootType values.
const (
ShadowRootTypeUserAgent ShadowRootType = "user-agent"
ShadowRootTypeOpen ShadowRootType = "open"
ShadowRootTypeClosed ShadowRootType = "closed"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ShadowRootType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ShadowRootType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ShadowRootType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ShadowRootType(in.String()) {
case ShadowRootTypeUserAgent:
*t = ShadowRootTypeUserAgent
case ShadowRootTypeOpen:
*t = ShadowRootTypeOpen
case ShadowRootTypeClosed:
*t = ShadowRootTypeClosed
default:
in.AddError(errors.New("unknown ShadowRootType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ShadowRootType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Node DOM interaction is implemented in terms of mirror objects that
// represent the actual DOM nodes. DOMNode is a base node mirror type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-Node
type Node struct {
NodeID NodeID `json:"nodeId"` // Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
ParentID NodeID `json:"parentId,omitempty"` // The id of the parent node if any.
BackendNodeID BackendNodeID `json:"backendNodeId"` // The BackendNodeId for this node.
NodeType NodeType `json:"nodeType"` // Node's nodeType.
NodeName string `json:"nodeName"` // Node's nodeName.
LocalName string `json:"localName"` // Node's localName.
NodeValue string `json:"nodeValue"` // Node's nodeValue.
ChildNodeCount int64 `json:"childNodeCount,omitempty"` // Child count for Container nodes.
Children []*Node `json:"children,omitempty"` // Child nodes of this node when requested with children.
Attributes []string `json:"attributes,omitempty"` // Attributes of the Element node in the form of flat array [name1, value1, name2, value2].
DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to.
BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion.
PublicID string `json:"publicId,omitempty"` // DocumentType's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType's systemId.
InternalSubset string `json:"internalSubset,omitempty"` // DocumentType's internalSubset.
XMLVersion string `json:"xmlVersion,omitempty"` // Document's XML version in case of XML documents.
Name string `json:"name,omitempty"` // Attr's name.
Value string `json:"value,omitempty"` // Attr's value.
PseudoType PseudoType `json:"pseudoType,omitempty"` // Pseudo element type for this node.
ShadowRootType ShadowRootType `json:"shadowRootType,omitempty"` // Shadow root type.
FrameID FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements.
ContentDocument *Node `json:"contentDocument,omitempty"` // Content document for frame owner elements.
ShadowRoots []*Node `json:"shadowRoots,omitempty"` // Shadow root list for given element host.
TemplateContent *Node `json:"templateContent,omitempty"` // Content document fragment for template elements.
PseudoElements []*Node `json:"pseudoElements,omitempty"` // Pseudo elements associated with this node.
ImportedDocument *Node `json:"importedDocument,omitempty"` // Import document for the HTMLImport links.
DistributedNodes []*BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point.
IsSVG bool `json:"isSVG,omitempty"` // Whether the node is SVG.
Parent *Node `json:"-"` // Parent node.
Invalidated chan struct{} `json:"-"` // Invalidated channel.
State NodeState `json:"-"` // Node state.
sync.RWMutex `json:"-"` // Read write mutex.
}
// AttributeValue returns the named attribute for the node.
func (n *Node) AttributeValue(name string) string {
n.RLock()
defer n.RUnlock()
for i := 0; i < len(n.Attributes); i += 2 {
if n.Attributes[i] == name {
return n.Attributes[i+1]
}
}
return ""
}
// xpath builds the xpath string.
func (n *Node) xpath(stopAtDocument, stopAtID bool) string {
n.RLock()
defer n.RUnlock()
p, pos, id := "", "", n.AttributeValue("id")
switch {
case n.Parent == nil:
return n.LocalName
case stopAtDocument && n.NodeType == NodeTypeDocument:
return ""
case stopAtID && id != "":
p = "/"
pos = `[@id='` + id + `']`
case n.Parent != nil:
var i int
var found bool
n.Parent.RLock()
for j := 0; j < len(n.Parent.Children); j++ {
if n.Parent.Children[j].LocalName == n.LocalName {
i++
}
if n.Parent.Children[j].NodeID == n.NodeID {
found = true
break
}
}
n.Parent.RUnlock()
if found {
pos = "[" + strconv.Itoa(i) + "]"
}
p = n.Parent.xpath(stopAtDocument, stopAtID)
}
localName := n.LocalName
if n.IsSVG {
localName = `*[local-name()='` + localName + `']`
}
return p + "/" + localName + pos
}
// PartialXPathByID returns the partial XPath for the node, stopping at the
// first parent with an id attribute or at nearest parent document node.
func (n *Node) PartialXPathByID() string {
return n.xpath(true, true)
}
// PartialXPath returns the partial XPath for the node, stopping at the nearest
// parent document node.
func (n *Node) PartialXPath() string {
return n.xpath(true, false)
}
// FullXPathByID returns the full XPath for the node, stopping at the top most
// document root or at the closest parent node with an id attribute.
func (n *Node) FullXPathByID() string {
return n.xpath(false, true)
}
// FullXPath returns the full XPath for the node, stopping only at the top most
// document root.
func (n *Node) FullXPath() string {
return n.xpath(false, false)
}
// Dump builds a printable string representation of the node and its children.
func (n *Node) Dump(prefix, indent string, nodeIDs bool) string {
if n == nil {
return prefix + "<nil>"
}
n.RLock()
defer n.RUnlock()
s := n.LocalName
if s == "" {
s = n.NodeName
}
for i := 0; i < len(n.Attributes); i += 2 {
if strings.ToLower(n.Attributes[i]) == "id" {
s += "#" + n.Attributes[i+1]
break
}
}
if n.NodeType != NodeTypeElement && n.NodeType != NodeTypeText {
s += fmt.Sprintf(" <%s>", n.NodeType)
}
if n.NodeType == NodeTypeText {
v := n.NodeValue
if len(v) > 15 {
v = v[:15] + "..."
}
s += fmt.Sprintf(" %q", v)
}
if n.NodeType == NodeTypeElement && len(n.Attributes) > 0 {
attrs := ""
for i := 0; i < len(n.Attributes); i += 2 {
if strings.ToLower(n.Attributes[i]) == "id" {
continue
}
if attrs != "" {
attrs += " "
}
attrs += fmt.Sprintf("%s=%q", n.Attributes[i], n.Attributes[i+1])
}
if attrs != "" {
s += " [" + attrs + "]"
}
}
if nodeIDs {
s += fmt.Sprintf(" (%d)", n.NodeID)
}
for i := 0; i < len(n.Children); i++ {
s += "\n" + n.Children[i].Dump(prefix+indent, indent, nodeIDs)
}
return prefix + s
}
// NodeState is the state of a DOM node.
type NodeState uint8
// NodeState enum values.
const (
NodeReady NodeState = 1 << (7 - iota)
NodeVisible
NodeHighlighted
)
// nodeStateNames are the names of the node states.
var nodeStateNames = map[NodeState]string{
NodeReady: "Ready",
NodeVisible: "Visible",
NodeHighlighted: "Highlighted",
}
// String satisfies stringer interface.
func (ns NodeState) String() string {
var s []string
for k, v := range nodeStateNames {
if ns&k != 0 {
s = append(s, v)
}
}
return "[" + strings.Join(s, " ") + "]"
}
// EmptyNodeID is the "non-existent" node id.
const EmptyNodeID = NodeID(0)
// RGBA a structure holding an RGBA color.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-RGBA
type RGBA struct {
R int64 `json:"r"` // The red component, in the [0-255] range.
G int64 `json:"g"` // The green component, in the [0-255] range.
B int64 `json:"b"` // The blue component, in the [0-255] range.
A float64 `json:"a"` // The alpha component, in the [0-1] range (default: 1).
}
// NodeType node type.
//
// See: https://developer.mozilla.org/en/docs/Web/API/Node/nodeType
type NodeType int64
// Int64 returns the NodeType as int64 value.
func (t NodeType) Int64() int64 {
return int64(t)
}
// NodeType values.
const (
NodeTypeElement NodeType = 1
NodeTypeAttribute NodeType = 2
NodeTypeText NodeType = 3
NodeTypeCDATA NodeType = 4
NodeTypeEntityReference NodeType = 5
NodeTypeEntity NodeType = 6
NodeTypeProcessingInstruction NodeType = 7
NodeTypeComment NodeType = 8
NodeTypeDocument NodeType = 9
NodeTypeDocumentType NodeType = 10
NodeTypeDocumentFragment NodeType = 11
NodeTypeNotation NodeType = 12
)
// String returns the NodeType as string value.
func (t NodeType) String() string {
switch t {
case NodeTypeElement:
return "Element"
case NodeTypeAttribute:
return "Attribute"
case NodeTypeText:
return "Text"
case NodeTypeCDATA:
return "CDATA"
case NodeTypeEntityReference:
return "EntityReference"
case NodeTypeEntity:
return "Entity"
case NodeTypeProcessingInstruction:
return "ProcessingInstruction"
case NodeTypeComment:
return "Comment"
case NodeTypeDocument:
return "Document"
case NodeTypeDocumentType:
return "DocumentType"
case NodeTypeDocumentFragment:
return "DocumentFragment"
case NodeTypeNotation:
return "Notation"
}
return fmt.Sprintf("NodeType(%d)", t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t NodeType) MarshalEasyJSON(out *jwriter.Writer) {
out.Int64(int64(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t NodeType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *NodeType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch NodeType(in.Int64()) {
case NodeTypeElement:
*t = NodeTypeElement
case NodeTypeAttribute:
*t = NodeTypeAttribute
case NodeTypeText:
*t = NodeTypeText
case NodeTypeCDATA:
*t = NodeTypeCDATA
case NodeTypeEntityReference:
*t = NodeTypeEntityReference
case NodeTypeEntity:
*t = NodeTypeEntity
case NodeTypeProcessingInstruction:
*t = NodeTypeProcessingInstruction
case NodeTypeComment:
*t = NodeTypeComment
case NodeTypeDocument:
*t = NodeTypeDocument
case NodeTypeDocumentType:
*t = NodeTypeDocumentType
case NodeTypeDocumentFragment:
*t = NodeTypeDocumentFragment
case NodeTypeNotation:
*t = NodeTypeNotation
default:
in.AddError(errors.New("unknown NodeType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *NodeType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// LoaderID unique loader identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-LoaderId
type LoaderID string
// String returns the LoaderID as string value.
func (t LoaderID) String() string {
return string(t)
}
// TimeSinceEpoch UTC time in seconds, counted from January 1, 1970.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-TimeSinceEpoch
type TimeSinceEpoch time.Time
// Time returns the TimeSinceEpoch as time.Time value.
func (t TimeSinceEpoch) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TimeSinceEpoch) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).UnixNano() / int64(time.Second))
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t TimeSinceEpoch) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = TimeSinceEpoch(time.Unix(0, int64(in.Float64()*float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// MonotonicTime monotonically increasing time in seconds since an arbitrary
// point in the past.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-MonotonicTime
type MonotonicTime time.Time
// Time returns the MonotonicTime as time.Time value.
func (t MonotonicTime) Time() time.Time {
return time.Time(t)
}
// MonotonicTimeEpoch is the MonotonicTime time epoch.
var MonotonicTimeEpoch *time.Time
func init() {
// initialize epoch
bt := sysutil.BootTime()
MonotonicTimeEpoch = &bt
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MonotonicTime) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).Sub(*MonotonicTimeEpoch)) / float64(time.Second)
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t MonotonicTime) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MonotonicTime) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = MonotonicTime(MonotonicTimeEpoch.Add(time.Duration(in.Float64() * float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MonotonicTime) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// FrameID unique frame identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-FrameId
type FrameID string
// String returns the FrameID as string value.
func (t FrameID) String() string {
return string(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *FrameID) UnmarshalEasyJSON(in *jlexer.Lexer) {
buf := in.Raw()
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
buf = buf[1 : l-1]
}
*t = FrameID(buf)
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *FrameID) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Frame information about the Frame on the page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-Frame
type Frame struct {
ID FrameID `json:"id"` // Frame unique identifier.
ParentID FrameID `json:"parentId,omitempty"` // Parent frame identifier.
LoaderID LoaderID `json:"loaderId"` // Identifier of the loader associated with this frame.
Name string `json:"name,omitempty"` // Frame's name as specified in the tag.
URL string `json:"url"` // Frame document's URL without fragment.
URLFragment string `json:"urlFragment,omitempty"` // Frame document's URL fragment including the '#'.
SecurityOrigin string `json:"securityOrigin"` // Frame document's security origin.
MimeType string `json:"mimeType"` // Frame document's mimeType as determined by the browser.
UnreachableURL string `json:"unreachableUrl,omitempty"` // If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.
State FrameState `json:"-"` // Frame state.
Root *Node `json:"-"` // Frame document root.
Nodes map[NodeID]*Node `json:"-"` // Frame nodes.
sync.RWMutex `json:"-"` // Read write mutex.
}
// FrameState is the state of a Frame.
type FrameState uint16
// FrameState enum values.
const (
FrameDOMContentEventFired FrameState = 1 << (15 - iota)
FrameLoadEventFired
FrameAttached
FrameNavigated
FrameLoading
FrameScheduledNavigation
)
// frameStateNames are the names of the frame states.
var frameStateNames = map[FrameState]string{
FrameDOMContentEventFired: "DOMContentEventFired",
FrameLoadEventFired: "LoadEventFired",
FrameAttached: "Attached",
FrameNavigated: "Navigated",
FrameLoading: "Loading",
FrameScheduledNavigation: "ScheduledNavigation",
}
// String satisfies stringer interface.
func (fs FrameState) String() string {
var s []string
for k, v := range frameStateNames {
if fs&k != 0 {
s = append(s, v)
}
}
return "[" + strings.Join(s, " ") + "]"
}
// EmptyFrameID is the "non-existent" frame id.
const EmptyFrameID = FrameID("")

2496
vendor/github.com/chromedp/cdproto/cdproto.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

831
vendor/github.com/chromedp/cdproto/css/css.go generated vendored Normal file
View File

@@ -0,0 +1,831 @@
// Package css provides the Chrome DevTools Protocol
// commands, types, and events for the CSS domain.
//
// This domain exposes CSS read/write operations. All CSS objects
// (stylesheets, rules, and styles) have an associated id used in subsequent
// operations on the related object. Each object type has a specific id
// structure, and those are not interchangeable between objects of different
// kinds. CSS objects can be loaded using the get*ForNode() calls (which accept
// a DOM node id). A client can also keep track of stylesheets via the
// styleSheetAdded/styleSheetRemoved events and subsequently load the required
// stylesheet contents using the getStyleSheet[Text]() methods.
//
// Generated by the cdproto-gen command.
package css
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// AddRuleParams inserts a new rule with the given ruleText in a stylesheet
// with given styleSheetId, at the position specified by location.
type AddRuleParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier where a new rule should be inserted.
RuleText string `json:"ruleText"` // The text of a new rule.
Location *SourceRange `json:"location"` // Text position of a new rule in the target style sheet.
}
// AddRule inserts a new rule with the given ruleText in a stylesheet with
// given styleSheetId, at the position specified by location.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-addRule
//
// parameters:
// styleSheetID - The css style sheet identifier where a new rule should be inserted.
// ruleText - The text of a new rule.
// location - Text position of a new rule in the target style sheet.
func AddRule(styleSheetID StyleSheetID, ruleText string, location *SourceRange) *AddRuleParams {
return &AddRuleParams{
StyleSheetID: styleSheetID,
RuleText: ruleText,
Location: location,
}
}
// AddRuleReturns return values.
type AddRuleReturns struct {
Rule *Rule `json:"rule,omitempty"` // The newly created rule.
}
// Do executes CSS.addRule against the provided context.
//
// returns:
// rule - The newly created rule.
func (p *AddRuleParams) Do(ctx context.Context) (rule *Rule, err error) {
// execute
var res AddRuleReturns
err = cdp.Execute(ctx, CommandAddRule, p, &res)
if err != nil {
return nil, err
}
return res.Rule, nil
}
// CollectClassNamesParams returns all class names from specified stylesheet.
type CollectClassNamesParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// CollectClassNames returns all class names from specified stylesheet.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-collectClassNames
//
// parameters:
// styleSheetID
func CollectClassNames(styleSheetID StyleSheetID) *CollectClassNamesParams {
return &CollectClassNamesParams{
StyleSheetID: styleSheetID,
}
}
// CollectClassNamesReturns return values.
type CollectClassNamesReturns struct {
ClassNames []string `json:"classNames,omitempty"` // Class name list.
}
// Do executes CSS.collectClassNames against the provided context.
//
// returns:
// classNames - Class name list.
func (p *CollectClassNamesParams) Do(ctx context.Context) (classNames []string, err error) {
// execute
var res CollectClassNamesReturns
err = cdp.Execute(ctx, CommandCollectClassNames, p, &res)
if err != nil {
return nil, err
}
return res.ClassNames, nil
}
// CreateStyleSheetParams creates a new special "via-inspector" stylesheet in
// the frame with given frameId.
type CreateStyleSheetParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame where "via-inspector" stylesheet should be created.
}
// CreateStyleSheet creates a new special "via-inspector" stylesheet in the
// frame with given frameId.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-createStyleSheet
//
// parameters:
// frameID - Identifier of the frame where "via-inspector" stylesheet should be created.
func CreateStyleSheet(frameID cdp.FrameID) *CreateStyleSheetParams {
return &CreateStyleSheetParams{
FrameID: frameID,
}
}
// CreateStyleSheetReturns return values.
type CreateStyleSheetReturns struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the created "via-inspector" stylesheet.
}
// Do executes CSS.createStyleSheet against the provided context.
//
// returns:
// styleSheetID - Identifier of the created "via-inspector" stylesheet.
func (p *CreateStyleSheetParams) Do(ctx context.Context) (styleSheetID StyleSheetID, err error) {
// execute
var res CreateStyleSheetReturns
err = cdp.Execute(ctx, CommandCreateStyleSheet, p, &res)
if err != nil {
return "", err
}
return res.StyleSheetID, nil
}
// DisableParams disables the CSS agent for the given page.
type DisableParams struct{}
// Disable disables the CSS agent for the given page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes CSS.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables the CSS agent for the given page. Clients should not
// assume that the CSS agent has been enabled until the result of this command
// is received.
type EnableParams struct{}
// Enable enables the CSS agent for the given page. Clients should not assume
// that the CSS agent has been enabled until the result of this command is
// received.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes CSS.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// ForcePseudoStateParams ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
type ForcePseudoStateParams struct {
NodeID cdp.NodeID `json:"nodeId"` // The element id for which to force the pseudo state.
ForcedPseudoClasses []string `json:"forcedPseudoClasses"` // Element pseudo classes to force when computing the element's style.
}
// ForcePseudoState ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-forcePseudoState
//
// parameters:
// nodeID - The element id for which to force the pseudo state.
// forcedPseudoClasses - Element pseudo classes to force when computing the element's style.
func ForcePseudoState(nodeID cdp.NodeID, forcedPseudoClasses []string) *ForcePseudoStateParams {
return &ForcePseudoStateParams{
NodeID: nodeID,
ForcedPseudoClasses: forcedPseudoClasses,
}
}
// Do executes CSS.forcePseudoState against the provided context.
func (p *ForcePseudoStateParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandForcePseudoState, p, nil)
}
// GetBackgroundColorsParams [no description].
type GetBackgroundColorsParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get background colors for.
}
// GetBackgroundColors [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getBackgroundColors
//
// parameters:
// nodeID - Id of the node to get background colors for.
func GetBackgroundColors(nodeID cdp.NodeID) *GetBackgroundColorsParams {
return &GetBackgroundColorsParams{
NodeID: nodeID,
}
}
// GetBackgroundColorsReturns return values.
type GetBackgroundColorsReturns struct {
BackgroundColors []string `json:"backgroundColors,omitempty"` // The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
ComputedFontSize string `json:"computedFontSize,omitempty"` // The computed font size for this node, as a CSS computed value string (e.g. '12px').
ComputedFontWeight string `json:"computedFontWeight,omitempty"` // The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
}
// Do executes CSS.getBackgroundColors against the provided context.
//
// returns:
// backgroundColors - The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
// computedFontSize - The computed font size for this node, as a CSS computed value string (e.g. '12px').
// computedFontWeight - The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
func (p *GetBackgroundColorsParams) Do(ctx context.Context) (backgroundColors []string, computedFontSize string, computedFontWeight string, err error) {
// execute
var res GetBackgroundColorsReturns
err = cdp.Execute(ctx, CommandGetBackgroundColors, p, &res)
if err != nil {
return nil, "", "", err
}
return res.BackgroundColors, res.ComputedFontSize, res.ComputedFontWeight, nil
}
// GetComputedStyleForNodeParams returns the computed style for a DOM node
// identified by nodeId.
type GetComputedStyleForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetComputedStyleForNode returns the computed style for a DOM node
// identified by nodeId.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getComputedStyleForNode
//
// parameters:
// nodeID
func GetComputedStyleForNode(nodeID cdp.NodeID) *GetComputedStyleForNodeParams {
return &GetComputedStyleForNodeParams{
NodeID: nodeID,
}
}
// GetComputedStyleForNodeReturns return values.
type GetComputedStyleForNodeReturns struct {
ComputedStyle []*ComputedStyleProperty `json:"computedStyle,omitempty"` // Computed style for the specified DOM node.
}
// Do executes CSS.getComputedStyleForNode against the provided context.
//
// returns:
// computedStyle - Computed style for the specified DOM node.
func (p *GetComputedStyleForNodeParams) Do(ctx context.Context) (computedStyle []*ComputedStyleProperty, err error) {
// execute
var res GetComputedStyleForNodeReturns
err = cdp.Execute(ctx, CommandGetComputedStyleForNode, p, &res)
if err != nil {
return nil, err
}
return res.ComputedStyle, nil
}
// GetInlineStylesForNodeParams returns the styles defined inline (explicitly
// in the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
type GetInlineStylesForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetInlineStylesForNode returns the styles defined inline (explicitly in
// the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getInlineStylesForNode
//
// parameters:
// nodeID
func GetInlineStylesForNode(nodeID cdp.NodeID) *GetInlineStylesForNodeParams {
return &GetInlineStylesForNodeParams{
NodeID: nodeID,
}
}
// GetInlineStylesForNodeReturns return values.
type GetInlineStylesForNodeReturns struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // Inline style for the specified DOM node.
AttributesStyle *Style `json:"attributesStyle,omitempty"` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
}
// Do executes CSS.getInlineStylesForNode against the provided context.
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
func (p *GetInlineStylesForNodeParams) Do(ctx context.Context) (inlineStyle *Style, attributesStyle *Style, err error) {
// execute
var res GetInlineStylesForNodeReturns
err = cdp.Execute(ctx, CommandGetInlineStylesForNode, p, &res)
if err != nil {
return nil, nil, err
}
return res.InlineStyle, res.AttributesStyle, nil
}
// GetMatchedStylesForNodeParams returns requested styles for a DOM node
// identified by nodeId.
type GetMatchedStylesForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetMatchedStylesForNode returns requested styles for a DOM node identified
// by nodeId.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getMatchedStylesForNode
//
// parameters:
// nodeID
func GetMatchedStylesForNode(nodeID cdp.NodeID) *GetMatchedStylesForNodeParams {
return &GetMatchedStylesForNodeParams{
NodeID: nodeID,
}
}
// GetMatchedStylesForNodeReturns return values.
type GetMatchedStylesForNodeReturns struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // Inline style for the specified DOM node.
AttributesStyle *Style `json:"attributesStyle,omitempty"` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
MatchedCSSRules []*RuleMatch `json:"matchedCSSRules,omitempty"` // CSS rules matching this node, from all applicable stylesheets.
PseudoElements []*PseudoElementMatches `json:"pseudoElements,omitempty"` // Pseudo style matches for this node.
Inherited []*InheritedStyleEntry `json:"inherited,omitempty"` // A chain of inherited styles (from the immediate node parent up to the DOM tree root).
CSSKeyframesRules []*KeyframesRule `json:"cssKeyframesRules,omitempty"` // A list of CSS keyframed animations matching this node.
}
// Do executes CSS.getMatchedStylesForNode against the provided context.
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
// matchedCSSRules - CSS rules matching this node, from all applicable stylesheets.
// pseudoElements - Pseudo style matches for this node.
// inherited - A chain of inherited styles (from the immediate node parent up to the DOM tree root).
// cssKeyframesRules - A list of CSS keyframed animations matching this node.
func (p *GetMatchedStylesForNodeParams) Do(ctx context.Context) (inlineStyle *Style, attributesStyle *Style, matchedCSSRules []*RuleMatch, pseudoElements []*PseudoElementMatches, inherited []*InheritedStyleEntry, cssKeyframesRules []*KeyframesRule, err error) {
// execute
var res GetMatchedStylesForNodeReturns
err = cdp.Execute(ctx, CommandGetMatchedStylesForNode, p, &res)
if err != nil {
return nil, nil, nil, nil, nil, nil, err
}
return res.InlineStyle, res.AttributesStyle, res.MatchedCSSRules, res.PseudoElements, res.Inherited, res.CSSKeyframesRules, nil
}
// GetMediaQueriesParams returns all media queries parsed by the rendering
// engine.
type GetMediaQueriesParams struct{}
// GetMediaQueries returns all media queries parsed by the rendering engine.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getMediaQueries
func GetMediaQueries() *GetMediaQueriesParams {
return &GetMediaQueriesParams{}
}
// GetMediaQueriesReturns return values.
type GetMediaQueriesReturns struct {
Medias []*Media `json:"medias,omitempty"`
}
// Do executes CSS.getMediaQueries against the provided context.
//
// returns:
// medias
func (p *GetMediaQueriesParams) Do(ctx context.Context) (medias []*Media, err error) {
// execute
var res GetMediaQueriesReturns
err = cdp.Execute(ctx, CommandGetMediaQueries, nil, &res)
if err != nil {
return nil, err
}
return res.Medias, nil
}
// GetPlatformFontsForNodeParams requests information about platform fonts
// which we used to render child TextNodes in the given node.
type GetPlatformFontsForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetPlatformFontsForNode requests information about platform fonts which we
// used to render child TextNodes in the given node.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getPlatformFontsForNode
//
// parameters:
// nodeID
func GetPlatformFontsForNode(nodeID cdp.NodeID) *GetPlatformFontsForNodeParams {
return &GetPlatformFontsForNodeParams{
NodeID: nodeID,
}
}
// GetPlatformFontsForNodeReturns return values.
type GetPlatformFontsForNodeReturns struct {
Fonts []*PlatformFontUsage `json:"fonts,omitempty"` // Usage statistics for every employed platform font.
}
// Do executes CSS.getPlatformFontsForNode against the provided context.
//
// returns:
// fonts - Usage statistics for every employed platform font.
func (p *GetPlatformFontsForNodeParams) Do(ctx context.Context) (fonts []*PlatformFontUsage, err error) {
// execute
var res GetPlatformFontsForNodeReturns
err = cdp.Execute(ctx, CommandGetPlatformFontsForNode, p, &res)
if err != nil {
return nil, err
}
return res.Fonts, nil
}
// GetStyleSheetTextParams returns the current textual content for a
// stylesheet.
type GetStyleSheetTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// GetStyleSheetText returns the current textual content for a stylesheet.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-getStyleSheetText
//
// parameters:
// styleSheetID
func GetStyleSheetText(styleSheetID StyleSheetID) *GetStyleSheetTextParams {
return &GetStyleSheetTextParams{
StyleSheetID: styleSheetID,
}
}
// GetStyleSheetTextReturns return values.
type GetStyleSheetTextReturns struct {
Text string `json:"text,omitempty"` // The stylesheet text.
}
// Do executes CSS.getStyleSheetText against the provided context.
//
// returns:
// text - The stylesheet text.
func (p *GetStyleSheetTextParams) Do(ctx context.Context) (text string, err error) {
// execute
var res GetStyleSheetTextReturns
err = cdp.Execute(ctx, CommandGetStyleSheetText, p, &res)
if err != nil {
return "", err
}
return res.Text, nil
}
// SetEffectivePropertyValueForNodeParams find a rule with the given active
// property for the given node and set the new value for this property.
type SetEffectivePropertyValueForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"` // The element id for which to set property.
PropertyName string `json:"propertyName"`
Value string `json:"value"`
}
// SetEffectivePropertyValueForNode find a rule with the given active
// property for the given node and set the new value for this property.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setEffectivePropertyValueForNode
//
// parameters:
// nodeID - The element id for which to set property.
// propertyName
// value
func SetEffectivePropertyValueForNode(nodeID cdp.NodeID, propertyName string, value string) *SetEffectivePropertyValueForNodeParams {
return &SetEffectivePropertyValueForNodeParams{
NodeID: nodeID,
PropertyName: propertyName,
Value: value,
}
}
// Do executes CSS.setEffectivePropertyValueForNode against the provided context.
func (p *SetEffectivePropertyValueForNodeParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetEffectivePropertyValueForNode, p, nil)
}
// SetKeyframeKeyParams modifies the keyframe rule key text.
type SetKeyframeKeyParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
KeyText string `json:"keyText"`
}
// SetKeyframeKey modifies the keyframe rule key text.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setKeyframeKey
//
// parameters:
// styleSheetID
// range
// keyText
func SetKeyframeKey(styleSheetID StyleSheetID, rangeVal *SourceRange, keyText string) *SetKeyframeKeyParams {
return &SetKeyframeKeyParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
KeyText: keyText,
}
}
// SetKeyframeKeyReturns return values.
type SetKeyframeKeyReturns struct {
KeyText *Value `json:"keyText,omitempty"` // The resulting key text after modification.
}
// Do executes CSS.setKeyframeKey against the provided context.
//
// returns:
// keyText - The resulting key text after modification.
func (p *SetKeyframeKeyParams) Do(ctx context.Context) (keyText *Value, err error) {
// execute
var res SetKeyframeKeyReturns
err = cdp.Execute(ctx, CommandSetKeyframeKey, p, &res)
if err != nil {
return nil, err
}
return res.KeyText, nil
}
// SetMediaTextParams modifies the rule selector.
type SetMediaTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
Text string `json:"text"`
}
// SetMediaText modifies the rule selector.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setMediaText
//
// parameters:
// styleSheetID
// range
// text
func SetMediaText(styleSheetID StyleSheetID, rangeVal *SourceRange, text string) *SetMediaTextParams {
return &SetMediaTextParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
Text: text,
}
}
// SetMediaTextReturns return values.
type SetMediaTextReturns struct {
Media *Media `json:"media,omitempty"` // The resulting CSS media rule after modification.
}
// Do executes CSS.setMediaText against the provided context.
//
// returns:
// media - The resulting CSS media rule after modification.
func (p *SetMediaTextParams) Do(ctx context.Context) (media *Media, err error) {
// execute
var res SetMediaTextReturns
err = cdp.Execute(ctx, CommandSetMediaText, p, &res)
if err != nil {
return nil, err
}
return res.Media, nil
}
// SetRuleSelectorParams modifies the rule selector.
type SetRuleSelectorParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
Selector string `json:"selector"`
}
// SetRuleSelector modifies the rule selector.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setRuleSelector
//
// parameters:
// styleSheetID
// range
// selector
func SetRuleSelector(styleSheetID StyleSheetID, rangeVal *SourceRange, selector string) *SetRuleSelectorParams {
return &SetRuleSelectorParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
Selector: selector,
}
}
// SetRuleSelectorReturns return values.
type SetRuleSelectorReturns struct {
SelectorList *SelectorList `json:"selectorList,omitempty"` // The resulting selector list after modification.
}
// Do executes CSS.setRuleSelector against the provided context.
//
// returns:
// selectorList - The resulting selector list after modification.
func (p *SetRuleSelectorParams) Do(ctx context.Context) (selectorList *SelectorList, err error) {
// execute
var res SetRuleSelectorReturns
err = cdp.Execute(ctx, CommandSetRuleSelector, p, &res)
if err != nil {
return nil, err
}
return res.SelectorList, nil
}
// SetStyleSheetTextParams sets the new stylesheet text.
type SetStyleSheetTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Text string `json:"text"`
}
// SetStyleSheetText sets the new stylesheet text.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setStyleSheetText
//
// parameters:
// styleSheetID
// text
func SetStyleSheetText(styleSheetID StyleSheetID, text string) *SetStyleSheetTextParams {
return &SetStyleSheetTextParams{
StyleSheetID: styleSheetID,
Text: text,
}
}
// SetStyleSheetTextReturns return values.
type SetStyleSheetTextReturns struct {
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
}
// Do executes CSS.setStyleSheetText against the provided context.
//
// returns:
// sourceMapURL - URL of source map associated with script (if any).
func (p *SetStyleSheetTextParams) Do(ctx context.Context) (sourceMapURL string, err error) {
// execute
var res SetStyleSheetTextReturns
err = cdp.Execute(ctx, CommandSetStyleSheetText, p, &res)
if err != nil {
return "", err
}
return res.SourceMapURL, nil
}
// SetStyleTextsParams applies specified style edits one after another in the
// given order.
type SetStyleTextsParams struct {
Edits []*StyleDeclarationEdit `json:"edits"`
}
// SetStyleTexts applies specified style edits one after another in the given
// order.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-setStyleTexts
//
// parameters:
// edits
func SetStyleTexts(edits []*StyleDeclarationEdit) *SetStyleTextsParams {
return &SetStyleTextsParams{
Edits: edits,
}
}
// SetStyleTextsReturns return values.
type SetStyleTextsReturns struct {
Styles []*Style `json:"styles,omitempty"` // The resulting styles after modification.
}
// Do executes CSS.setStyleTexts against the provided context.
//
// returns:
// styles - The resulting styles after modification.
func (p *SetStyleTextsParams) Do(ctx context.Context) (styles []*Style, err error) {
// execute
var res SetStyleTextsReturns
err = cdp.Execute(ctx, CommandSetStyleTexts, p, &res)
if err != nil {
return nil, err
}
return res.Styles, nil
}
// StartRuleUsageTrackingParams enables the selector recording.
type StartRuleUsageTrackingParams struct{}
// StartRuleUsageTracking enables the selector recording.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-startRuleUsageTracking
func StartRuleUsageTracking() *StartRuleUsageTrackingParams {
return &StartRuleUsageTrackingParams{}
}
// Do executes CSS.startRuleUsageTracking against the provided context.
func (p *StartRuleUsageTrackingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStartRuleUsageTracking, nil, nil)
}
// StopRuleUsageTrackingParams stop tracking rule usage and return the list
// of rules that were used since last call to takeCoverageDelta (or since start
// of coverage instrumentation).
type StopRuleUsageTrackingParams struct{}
// StopRuleUsageTracking stop tracking rule usage and return the list of
// rules that were used since last call to takeCoverageDelta (or since start of
// coverage instrumentation).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-stopRuleUsageTracking
func StopRuleUsageTracking() *StopRuleUsageTrackingParams {
return &StopRuleUsageTrackingParams{}
}
// StopRuleUsageTrackingReturns return values.
type StopRuleUsageTrackingReturns struct {
RuleUsage []*RuleUsage `json:"ruleUsage,omitempty"`
}
// Do executes CSS.stopRuleUsageTracking against the provided context.
//
// returns:
// ruleUsage
func (p *StopRuleUsageTrackingParams) Do(ctx context.Context) (ruleUsage []*RuleUsage, err error) {
// execute
var res StopRuleUsageTrackingReturns
err = cdp.Execute(ctx, CommandStopRuleUsageTracking, nil, &res)
if err != nil {
return nil, err
}
return res.RuleUsage, nil
}
// TakeCoverageDeltaParams obtain list of rules that became used since last
// call to this method (or since start of coverage instrumentation).
type TakeCoverageDeltaParams struct{}
// TakeCoverageDelta obtain list of rules that became used since last call to
// this method (or since start of coverage instrumentation).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#method-takeCoverageDelta
func TakeCoverageDelta() *TakeCoverageDeltaParams {
return &TakeCoverageDeltaParams{}
}
// TakeCoverageDeltaReturns return values.
type TakeCoverageDeltaReturns struct {
Coverage []*RuleUsage `json:"coverage,omitempty"`
Timestamp float64 `json:"timestamp,omitempty"` // Monotonically increasing time, in seconds.
}
// Do executes CSS.takeCoverageDelta against the provided context.
//
// returns:
// coverage
// timestamp - Monotonically increasing time, in seconds.
func (p *TakeCoverageDeltaParams) Do(ctx context.Context) (coverage []*RuleUsage, timestamp float64, err error) {
// execute
var res TakeCoverageDeltaReturns
err = cdp.Execute(ctx, CommandTakeCoverageDelta, nil, &res)
if err != nil {
return nil, 0, err
}
return res.Coverage, res.Timestamp, nil
}
// Command names.
const (
CommandAddRule = "CSS.addRule"
CommandCollectClassNames = "CSS.collectClassNames"
CommandCreateStyleSheet = "CSS.createStyleSheet"
CommandDisable = "CSS.disable"
CommandEnable = "CSS.enable"
CommandForcePseudoState = "CSS.forcePseudoState"
CommandGetBackgroundColors = "CSS.getBackgroundColors"
CommandGetComputedStyleForNode = "CSS.getComputedStyleForNode"
CommandGetInlineStylesForNode = "CSS.getInlineStylesForNode"
CommandGetMatchedStylesForNode = "CSS.getMatchedStylesForNode"
CommandGetMediaQueries = "CSS.getMediaQueries"
CommandGetPlatformFontsForNode = "CSS.getPlatformFontsForNode"
CommandGetStyleSheetText = "CSS.getStyleSheetText"
CommandSetEffectivePropertyValueForNode = "CSS.setEffectivePropertyValueForNode"
CommandSetKeyframeKey = "CSS.setKeyframeKey"
CommandSetMediaText = "CSS.setMediaText"
CommandSetRuleSelector = "CSS.setRuleSelector"
CommandSetStyleSheetText = "CSS.setStyleSheetText"
CommandSetStyleTexts = "CSS.setStyleTexts"
CommandStartRuleUsageTracking = "CSS.startRuleUsageTracking"
CommandStopRuleUsageTracking = "CSS.stopRuleUsageTracking"
CommandTakeCoverageDelta = "CSS.takeCoverageDelta"
)

6214
vendor/github.com/chromedp/cdproto/css/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

42
vendor/github.com/chromedp/cdproto/css/events.go generated vendored Normal file
View File

@@ -0,0 +1,42 @@
package css
// Code generated by cdproto-gen. DO NOT EDIT.
// EventFontsUpdated fires whenever a web font is updated. A non-empty font
// parameter indicates a successfully loaded web font.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#event-fontsUpdated
type EventFontsUpdated struct {
Font *FontFace `json:"font,omitempty"` // The web font that has loaded.
}
// EventMediaQueryResultChanged fires whenever a MediaQuery result changes
// (for example, after a browser window has been resized.) The current
// implementation considers only viewport-dependent media features.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#event-mediaQueryResultChanged
type EventMediaQueryResultChanged struct{}
// EventStyleSheetAdded fired whenever an active document stylesheet is
// added.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#event-styleSheetAdded
type EventStyleSheetAdded struct {
Header *StyleSheetHeader `json:"header"` // Added stylesheet metainfo.
}
// EventStyleSheetChanged fired whenever a stylesheet is changed as a result
// of the client operation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#event-styleSheetChanged
type EventStyleSheetChanged struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// EventStyleSheetRemoved fired whenever an active document stylesheet is
// removed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#event-styleSheetRemoved
type EventStyleSheetRemoved struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // Identifier of the removed stylesheet.
}

348
vendor/github.com/chromedp/cdproto/css/types.go generated vendored Normal file
View File

@@ -0,0 +1,348 @@
package css
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// StyleSheetID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-StyleSheetId
type StyleSheetID string
// String returns the StyleSheetID as string value.
func (t StyleSheetID) String() string {
return string(t)
}
// StyleSheetOrigin stylesheet type: "injected" for stylesheets injected via
// extension, "user-agent" for user-agent stylesheets, "inspector" for
// stylesheets created by the inspector (i.e. those holding the "via inspector"
// rules), "regular" for regular stylesheets.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-StyleSheetOrigin
type StyleSheetOrigin string
// String returns the StyleSheetOrigin as string value.
func (t StyleSheetOrigin) String() string {
return string(t)
}
// StyleSheetOrigin values.
const (
StyleSheetOriginInjected StyleSheetOrigin = "injected"
StyleSheetOriginUserAgent StyleSheetOrigin = "user-agent"
StyleSheetOriginInspector StyleSheetOrigin = "inspector"
StyleSheetOriginRegular StyleSheetOrigin = "regular"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t StyleSheetOrigin) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t StyleSheetOrigin) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *StyleSheetOrigin) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch StyleSheetOrigin(in.String()) {
case StyleSheetOriginInjected:
*t = StyleSheetOriginInjected
case StyleSheetOriginUserAgent:
*t = StyleSheetOriginUserAgent
case StyleSheetOriginInspector:
*t = StyleSheetOriginInspector
case StyleSheetOriginRegular:
*t = StyleSheetOriginRegular
default:
in.AddError(errors.New("unknown StyleSheetOrigin value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *StyleSheetOrigin) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PseudoElementMatches CSS rule collection for a single pseudo style.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-PseudoElementMatches
type PseudoElementMatches struct {
PseudoType cdp.PseudoType `json:"pseudoType"` // Pseudo element type.
Matches []*RuleMatch `json:"matches"` // Matches of CSS rules applicable to the pseudo style.
}
// InheritedStyleEntry inherited CSS rule collection from ancestor node.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-InheritedStyleEntry
type InheritedStyleEntry struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // The ancestor node's inline style, if any, in the style inheritance chain.
MatchedCSSRules []*RuleMatch `json:"matchedCSSRules"` // Matches of CSS rules matching the ancestor node in the style inheritance chain.
}
// RuleMatch match data for a CSS rule.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-RuleMatch
type RuleMatch struct {
Rule *Rule `json:"rule"` // CSS rule in the match.
MatchingSelectors []int64 `json:"matchingSelectors"` // Matching selector indices in the rule's selectorList selectors (0-based).
}
// Value data for a simple selector (these are delimited by commas in a
// selector list).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-Value
type Value struct {
Text string `json:"text"` // Value text.
Range *SourceRange `json:"range,omitempty"` // Value range in the underlying resource (if available).
}
// SelectorList selector list data.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-SelectorList
type SelectorList struct {
Selectors []*Value `json:"selectors"` // Selectors in the list.
Text string `json:"text"` // Rule selector text.
}
// StyleSheetHeader CSS stylesheet metainformation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSStyleSheetHeader
type StyleSheetHeader struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The stylesheet identifier.
FrameID cdp.FrameID `json:"frameId"` // Owner frame identifier.
SourceURL string `json:"sourceURL"` // Stylesheet resource URL.
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with the stylesheet (if any).
Origin StyleSheetOrigin `json:"origin"` // Stylesheet origin.
Title string `json:"title"` // Stylesheet title.
OwnerNode cdp.BackendNodeID `json:"ownerNode,omitempty"` // The backend id for the owner node of the stylesheet.
Disabled bool `json:"disabled"` // Denotes whether the stylesheet is disabled.
HasSourceURL bool `json:"hasSourceURL,omitempty"` // Whether the sourceURL field value comes from the sourceURL comment.
IsInline bool `json:"isInline"` // Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags.
StartLine float64 `json:"startLine"` // Line offset of the stylesheet within the resource (zero based).
StartColumn float64 `json:"startColumn"` // Column offset of the stylesheet within the resource (zero based).
Length float64 `json:"length"` // Size of the content (in characters).
EndLine float64 `json:"endLine"` // Line offset of the end of the stylesheet within the resource (zero based).
EndColumn float64 `json:"endColumn"` // Column offset of the end of the stylesheet within the resource (zero based).
}
// Rule CSS rule representation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSRule
type Rule struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
SelectorList *SelectorList `json:"selectorList"` // Rule selector data.
Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin.
Style *Style `json:"style"` // Associated style declaration.
Media []*Media `json:"media,omitempty"` // Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards.
}
// RuleUsage CSS coverage information.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-RuleUsage
type RuleUsage struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
StartOffset float64 `json:"startOffset"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet.
EndOffset float64 `json:"endOffset"` // Offset of the end of the rule body from the beginning of the stylesheet.
Used bool `json:"used"` // Indicates whether the rule was actually used by some element in the page.
}
// SourceRange text range within a resource. All numbers are zero-based.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-SourceRange
type SourceRange struct {
StartLine int64 `json:"startLine"` // Start line of range.
StartColumn int64 `json:"startColumn"` // Start column of range (inclusive).
EndLine int64 `json:"endLine"` // End line of range
EndColumn int64 `json:"endColumn"` // End column of range (exclusive).
}
// ShorthandEntry [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-ShorthandEntry
type ShorthandEntry struct {
Name string `json:"name"` // Shorthand name.
Value string `json:"value"` // Shorthand value.
Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent).
}
// ComputedStyleProperty [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSComputedStyleProperty
type ComputedStyleProperty struct {
Name string `json:"name"` // Computed style property name.
Value string `json:"value"` // Computed style property value.
}
// Style CSS style representation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSStyle
type Style struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
CSSProperties []*Property `json:"cssProperties"` // CSS properties in the style.
ShorthandEntries []*ShorthandEntry `json:"shorthandEntries"` // Computed values for all shorthands found in the style.
CSSText string `json:"cssText,omitempty"` // Style declaration text (if available).
Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available).
}
// Property CSS property declaration data.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSProperty
type Property struct {
Name string `json:"name"` // The property name.
Value string `json:"value"` // The property value.
Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent).
Implicit bool `json:"implicit,omitempty"` // Whether the property is implicit (implies false if absent).
Text string `json:"text,omitempty"` // The full property text as specified in the style.
ParsedOk bool `json:"parsedOk,omitempty"` // Whether the property is understood by the browser (implies true if absent).
Disabled bool `json:"disabled,omitempty"` // Whether the property is disabled by the user (present for source-based properties only).
Range *SourceRange `json:"range,omitempty"` // The entire property range in the enclosing style declaration (if available).
}
// Media CSS media rule descriptor.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSMedia
type Media struct {
Text string `json:"text"` // Media query text.
Source MediaSource `json:"source"` // Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline stylesheet's STYLE tag.
SourceURL string `json:"sourceURL,omitempty"` // URL of the document containing the media query description.
Range *SourceRange `json:"range,omitempty"` // The associated rule (@media or @import) header range in the enclosing stylesheet (if available).
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the stylesheet containing this object (if exists).
MediaList []*MediaQuery `json:"mediaList,omitempty"` // Array of media queries.
}
// MediaQuery media query descriptor.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-MediaQuery
type MediaQuery struct {
Expressions []*MediaQueryExpression `json:"expressions"` // Array of media query expressions.
Active bool `json:"active"` // Whether the media query condition is satisfied.
}
// MediaQueryExpression media query expression descriptor.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-MediaQueryExpression
type MediaQueryExpression struct {
Value float64 `json:"value"` // Media query expression value.
Unit string `json:"unit"` // Media query expression units.
Feature string `json:"feature"` // Media query expression feature.
ValueRange *SourceRange `json:"valueRange,omitempty"` // The associated range of the value text in the enclosing stylesheet (if available).
ComputedLength float64 `json:"computedLength,omitempty"` // Computed length of media query expression (if applicable).
}
// PlatformFontUsage information about amount of glyphs that were rendered
// with given font.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-PlatformFontUsage
type PlatformFontUsage struct {
FamilyName string `json:"familyName"` // Font's family name reported by platform.
IsCustomFont bool `json:"isCustomFont"` // Indicates if the font was downloaded or resolved locally.
GlyphCount float64 `json:"glyphCount"` // Amount of glyphs that were rendered with this font.
}
// FontFace properties of a web font:
// https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-FontFace
type FontFace struct {
FontFamily string `json:"fontFamily"` // The font-family.
FontStyle string `json:"fontStyle"` // The font-style.
FontVariant string `json:"fontVariant"` // The font-variant.
FontWeight string `json:"fontWeight"` // The font-weight.
FontStretch string `json:"fontStretch"` // The font-stretch.
UnicodeRange string `json:"unicodeRange"` // The unicode-range.
Src string `json:"src"` // The src.
PlatformFontFamily string `json:"platformFontFamily"` // The resolved platform font family
}
// KeyframesRule CSS keyframes rule representation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSKeyframesRule
type KeyframesRule struct {
AnimationName *Value `json:"animationName"` // Animation name.
Keyframes []*KeyframeRule `json:"keyframes"` // List of keyframes.
}
// KeyframeRule CSS keyframe rule representation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSKeyframeRule
type KeyframeRule struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin.
KeyText *Value `json:"keyText"` // Associated key text.
Style *Style `json:"style"` // Associated style declaration.
}
// StyleDeclarationEdit a descriptor of operation to mutate style declaration
// text.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-StyleDeclarationEdit
type StyleDeclarationEdit struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier.
Range *SourceRange `json:"range"` // The range of the style text in the enclosing stylesheet.
Text string `json:"text"` // New style text.
}
// MediaSource source of the media query: "mediaRule" if specified by a
// @media rule, "importRule" if specified by an @import rule, "linkedSheet" if
// specified by a "media" attribute in a linked stylesheet's LINK tag,
// "inlineSheet" if specified by a "media" attribute in an inline stylesheet's
// STYLE tag.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/CSS#type-CSSMedia
type MediaSource string
// String returns the MediaSource as string value.
func (t MediaSource) String() string {
return string(t)
}
// MediaSource values.
const (
MediaSourceMediaRule MediaSource = "mediaRule"
MediaSourceImportRule MediaSource = "importRule"
MediaSourceLinkedSheet MediaSource = "linkedSheet"
MediaSourceInlineSheet MediaSource = "inlineSheet"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MediaSource) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MediaSource) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MediaSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MediaSource(in.String()) {
case MediaSourceMediaRule:
*t = MediaSourceMediaRule
case MediaSourceImportRule:
*t = MediaSourceImportRule
case MediaSourceLinkedSheet:
*t = MediaSourceLinkedSheet
case MediaSourceInlineSheet:
*t = MediaSourceInlineSheet
default:
in.AddError(errors.New("unknown MediaSource value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MediaSource) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

137
vendor/github.com/chromedp/cdproto/database/database.go generated vendored Normal file
View File

@@ -0,0 +1,137 @@
// Package database provides the Chrome DevTools Protocol
// commands, types, and events for the Database domain.
//
// Generated by the cdproto-gen command.
package database
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/mailru/easyjson"
)
// DisableParams disables database tracking, prevents database events from
// being sent to the client.
type DisableParams struct{}
// Disable disables database tracking, prevents database events from being
// sent to the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Database.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables database tracking, database events will now be
// delivered to the client.
type EnableParams struct{}
// Enable enables database tracking, database events will now be delivered to
// the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Database.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// ExecuteSQLParams [no description].
type ExecuteSQLParams struct {
DatabaseID ID `json:"databaseId"`
Query string `json:"query"`
}
// ExecuteSQL [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#method-executeSQL
//
// parameters:
// databaseID
// query
func ExecuteSQL(databaseID ID, query string) *ExecuteSQLParams {
return &ExecuteSQLParams{
DatabaseID: databaseID,
Query: query,
}
}
// ExecuteSQLReturns return values.
type ExecuteSQLReturns struct {
ColumnNames []string `json:"columnNames,omitempty"`
Values []easyjson.RawMessage `json:"values,omitempty"`
SQLError *Error `json:"sqlError,omitempty"`
}
// Do executes Database.executeSQL against the provided context.
//
// returns:
// columnNames
// values
// sqlError
func (p *ExecuteSQLParams) Do(ctx context.Context) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
// execute
var res ExecuteSQLReturns
err = cdp.Execute(ctx, CommandExecuteSQL, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.ColumnNames, res.Values, res.SQLError, nil
}
// GetDatabaseTableNamesParams [no description].
type GetDatabaseTableNamesParams struct {
DatabaseID ID `json:"databaseId"`
}
// GetDatabaseTableNames [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#method-getDatabaseTableNames
//
// parameters:
// databaseID
func GetDatabaseTableNames(databaseID ID) *GetDatabaseTableNamesParams {
return &GetDatabaseTableNamesParams{
DatabaseID: databaseID,
}
}
// GetDatabaseTableNamesReturns return values.
type GetDatabaseTableNamesReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Database.getDatabaseTableNames against the provided context.
//
// returns:
// tableNames
func (p *GetDatabaseTableNamesParams) Do(ctx context.Context) (tableNames []string, err error) {
// execute
var res GetDatabaseTableNamesReturns
err = cdp.Execute(ctx, CommandGetDatabaseTableNames, p, &res)
if err != nil {
return nil, err
}
return res.TableNames, nil
}
// Command names.
const (
CommandDisable = "Database.disable"
CommandEnable = "Database.enable"
CommandExecuteSQL = "Database.executeSQL"
CommandGetDatabaseTableNames = "Database.getDatabaseTableNames"
)

770
vendor/github.com/chromedp/cdproto/database/easyjson.go generated vendored Normal file
View File

@@ -0,0 +1,770 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package database
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
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 "tableNames":
if in.IsNull() {
in.Skip()
out.TableNames = nil
} else {
in.Delim('[')
if out.TableNames == nil {
if !in.IsDelim(']') {
out.TableNames = make([]string, 0, 4)
} else {
out.TableNames = []string{}
}
} else {
out.TableNames = (out.TableNames)[:0]
}
for !in.IsDelim(']') {
var v1 string
v1 = string(in.String())
out.TableNames = append(out.TableNames, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.TableNames) != 0 {
const prefix string = ",\"tableNames\":"
first = false
out.RawString(prefix[1:])
{
out.RawByte('[')
for v2, v3 := range in.TableNames {
if v2 > 0 {
out.RawByte(',')
}
out.String(string(v3))
}
out.RawByte(']')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase1(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
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 "databaseId":
out.DatabaseID = ID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase1(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"databaseId\":"
out.RawString(prefix[1:])
out.String(string(in.DatabaseID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase2(in *jlexer.Lexer, out *ExecuteSQLReturns) {
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 "columnNames":
if in.IsNull() {
in.Skip()
out.ColumnNames = nil
} else {
in.Delim('[')
if out.ColumnNames == nil {
if !in.IsDelim(']') {
out.ColumnNames = make([]string, 0, 4)
} else {
out.ColumnNames = []string{}
}
} else {
out.ColumnNames = (out.ColumnNames)[:0]
}
for !in.IsDelim(']') {
var v4 string
v4 = string(in.String())
out.ColumnNames = append(out.ColumnNames, v4)
in.WantComma()
}
in.Delim(']')
}
case "values":
if in.IsNull() {
in.Skip()
out.Values = nil
} else {
in.Delim('[')
if out.Values == nil {
if !in.IsDelim(']') {
out.Values = make([]easyjson.RawMessage, 0, 2)
} else {
out.Values = []easyjson.RawMessage{}
}
} else {
out.Values = (out.Values)[:0]
}
for !in.IsDelim(']') {
var v5 easyjson.RawMessage
(v5).UnmarshalEasyJSON(in)
out.Values = append(out.Values, v5)
in.WantComma()
}
in.Delim(']')
}
case "sqlError":
if in.IsNull() {
in.Skip()
out.SQLError = nil
} else {
if out.SQLError == nil {
out.SQLError = new(Error)
}
(*out.SQLError).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase2(out *jwriter.Writer, in ExecuteSQLReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.ColumnNames) != 0 {
const prefix string = ",\"columnNames\":"
first = false
out.RawString(prefix[1:])
{
out.RawByte('[')
for v6, v7 := range in.ColumnNames {
if v6 > 0 {
out.RawByte(',')
}
out.String(string(v7))
}
out.RawByte(']')
}
}
if len(in.Values) != 0 {
const prefix string = ",\"values\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v8, v9 := range in.Values {
if v8 > 0 {
out.RawByte(',')
}
(v9).MarshalEasyJSON(out)
}
out.RawByte(']')
}
}
if in.SQLError != nil {
const prefix string = ",\"sqlError\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.SQLError).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ExecuteSQLReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ExecuteSQLReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ExecuteSQLReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ExecuteSQLReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase3(in *jlexer.Lexer, out *ExecuteSQLParams) {
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 "databaseId":
out.DatabaseID = ID(in.String())
case "query":
out.Query = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase3(out *jwriter.Writer, in ExecuteSQLParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"databaseId\":"
out.RawString(prefix[1:])
out.String(string(in.DatabaseID))
}
{
const prefix string = ",\"query\":"
out.RawString(prefix)
out.String(string(in.Query))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ExecuteSQLParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ExecuteSQLParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ExecuteSQLParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ExecuteSQLParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase4(in *jlexer.Lexer, out *EventAddDatabase) {
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 "database":
if in.IsNull() {
in.Skip()
out.Database = nil
} else {
if out.Database == nil {
out.Database = new(Database)
}
(*out.Database).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase4(out *jwriter.Writer, in EventAddDatabase) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"database\":"
out.RawString(prefix[1:])
if in.Database == nil {
out.RawString("null")
} else {
(*in.Database).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventAddDatabase) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventAddDatabase) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventAddDatabase) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventAddDatabase) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase5(in *jlexer.Lexer, out *Error) {
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 "message":
out.Message = string(in.String())
case "code":
out.Code = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase5(out *jwriter.Writer, in Error) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"message\":"
out.RawString(prefix[1:])
out.String(string(in.Message))
}
{
const prefix string = ",\"code\":"
out.RawString(prefix)
out.Int64(int64(in.Code))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Error) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Error) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase6(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase6(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase6(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase7(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase7(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase7(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase8(in *jlexer.Lexer, out *Database) {
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 "id":
out.ID = ID(in.String())
case "domain":
out.Domain = string(in.String())
case "name":
out.Name = string(in.String())
case "version":
out.Version = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase8(out *jwriter.Writer, in Database) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"id\":"
out.RawString(prefix[1:])
out.String(string(in.ID))
}
{
const prefix string = ",\"domain\":"
out.RawString(prefix)
out.String(string(in.Domain))
}
{
const prefix string = ",\"name\":"
out.RawString(prefix)
out.String(string(in.Name))
}
{
const prefix string = ",\"version\":"
out.RawString(prefix)
out.String(string(in.Version))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Database) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Database) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase8(l, v)
}

10
vendor/github.com/chromedp/cdproto/database/events.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
package database
// Code generated by cdproto-gen. DO NOT EDIT.
// EventAddDatabase [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#event-addDatabase
type EventAddDatabase struct {
Database *Database `json:"database"`
}

31
vendor/github.com/chromedp/cdproto/database/types.go generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package database
// Code generated by cdproto-gen. DO NOT EDIT.
// ID unique identifier of Database object.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#type-DatabaseId
type ID string
// String returns the ID as string value.
func (t ID) String() string {
return string(t)
}
// Database database object.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#type-Database
type Database struct {
ID ID `json:"id"` // Database ID.
Domain string `json:"domain"` // Database domain.
Name string `json:"name"` // Database name.
Version string `json:"version"` // Database version.
}
// Error database error.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Database#type-Error
type Error struct {
Message string `json:"message"` // Error message.
Code int64 `json:"code"` // Error code.
}

1133
vendor/github.com/chromedp/cdproto/debugger/debugger.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

4991
vendor/github.com/chromedp/cdproto/debugger/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

83
vendor/github.com/chromedp/cdproto/debugger/events.go generated vendored Normal file
View File

@@ -0,0 +1,83 @@
package debugger
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
)
// EventBreakpointResolved fired when breakpoint is resolved to an actual
// script and location.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-breakpointResolved
type EventBreakpointResolved struct {
BreakpointID BreakpointID `json:"breakpointId"` // Breakpoint unique identifier.
Location *Location `json:"location"` // Actual breakpoint location.
}
// EventPaused fired when the virtual machine stopped on breakpoint or
// exception or any other stop criteria.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-paused
type EventPaused struct {
CallFrames []*CallFrame `json:"callFrames"` // Call stack the virtual machine stopped on.
Reason PausedReason `json:"reason"` // Pause reason.
Data easyjson.RawMessage `json:"data,omitempty"`
HitBreakpoints []string `json:"hitBreakpoints,omitempty"` // Hit breakpoints IDs
AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any.
AsyncStackTraceID *runtime.StackTraceID `json:"asyncStackTraceId,omitempty"` // Async stack trace, if any.
}
// EventResumed fired when the virtual machine resumed execution.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-resumed
type EventResumed struct{}
// EventScriptFailedToParse fired when virtual machine fails to parse the
// script.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-scriptFailedToParse
type EventScriptFailedToParse struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed.
URL string `json:"url"` // URL or name of the script parsed (if any).
StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags).
StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL.
EndLine int64 `json:"endLine"` // Last line of the script.
EndColumn int64 `json:"endColumn"` // Length of the last line of the script.
ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context.
Hash string `json:"hash"` // Content hash of the script.
ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"`
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
HasSourceURL bool `json:"hasSourceURL,omitempty"` // True, if this script has sourceURL.
IsModule bool `json:"isModule,omitempty"` // True, if this script is ES6 module.
Length int64 `json:"length,omitempty"` // This script length.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript top stack frame of where the script parsed event was triggered if available.
CodeOffset int64 `json:"codeOffset,omitempty"` // If the scriptLanguage is WebAssembly, the code section offset in the module.
ScriptLanguage ScriptLanguage `json:"scriptLanguage,omitempty"` // The language of the script.
}
// EventScriptParsed fired when virtual machine parses script. This event is
// also fired for all known and uncollected scripts upon enabling debugger.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-scriptParsed
type EventScriptParsed struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed.
URL string `json:"url"` // URL or name of the script parsed (if any).
StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags).
StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL.
EndLine int64 `json:"endLine"` // Last line of the script.
EndColumn int64 `json:"endColumn"` // Length of the last line of the script.
ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context.
Hash string `json:"hash"` // Content hash of the script.
ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"`
IsLiveEdit bool `json:"isLiveEdit,omitempty"` // True, if this script is generated as a result of the live edit operation.
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
HasSourceURL bool `json:"hasSourceURL,omitempty"` // True, if this script has sourceURL.
IsModule bool `json:"isModule,omitempty"` // True, if this script is ES6 module.
Length int64 `json:"length,omitempty"` // This script length.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript top stack frame of where the script parsed event was triggered if available.
CodeOffset int64 `json:"codeOffset,omitempty"` // If the scriptLanguage is WebAssembly, the code section offset in the module.
ScriptLanguage ScriptLanguage `json:"scriptLanguage,omitempty"` // The language of the script.
DebugSymbols *DebugSymbols `json:"debugSymbols,omitempty"` // If the scriptLanguage is WebASsembly, the source of debug symbols for the module.
}

515
vendor/github.com/chromedp/cdproto/debugger/types.go generated vendored Normal file
View File

@@ -0,0 +1,515 @@
package debugger
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// BreakpointID breakpoint identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-BreakpointId
type BreakpointID string
// String returns the BreakpointID as string value.
func (t BreakpointID) String() string {
return string(t)
}
// CallFrameID call frame identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-CallFrameId
type CallFrameID string
// String returns the CallFrameID as string value.
func (t CallFrameID) String() string {
return string(t)
}
// Location location in the source code.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-Location
type Location struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
}
// ScriptPosition location in the source code.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-ScriptPosition
type ScriptPosition struct {
LineNumber int64 `json:"lineNumber"`
ColumnNumber int64 `json:"columnNumber"`
}
// CallFrame JavaScript call frame. Array of call frames form the call stack.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-CallFrame
type CallFrame struct {
CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier. This identifier is only valid while the virtual machine is paused.
FunctionName string `json:"functionName"` // Name of the JavaScript function called on this call frame.
FunctionLocation *Location `json:"functionLocation,omitempty"` // Location in the source code.
Location *Location `json:"location"` // Location in the source code.
URL string `json:"url"` // JavaScript script name or url.
ScopeChain []*Scope `json:"scopeChain"` // Scope chain for this call frame.
This *runtime.RemoteObject `json:"this"` // this object for this call frame.
ReturnValue *runtime.RemoteObject `json:"returnValue,omitempty"` // The value being returned, if the function is at return point.
}
// Scope scope description.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-Scope
type Scope struct {
Type ScopeType `json:"type"` // Scope type.
Object *runtime.RemoteObject `json:"object"` // Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
Name string `json:"name,omitempty"`
StartLocation *Location `json:"startLocation,omitempty"` // Location in the source code where scope starts
EndLocation *Location `json:"endLocation,omitempty"` // Location in the source code where scope ends
}
// SearchMatch search match for resource.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-SearchMatch
type SearchMatch struct {
LineNumber float64 `json:"lineNumber"` // Line number in resource content.
LineContent string `json:"lineContent"` // Line with match content.
}
// BreakLocation [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-BreakLocation
type BreakLocation struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
Type BreakLocationType `json:"type,omitempty"`
}
// ScriptLanguage enum of possible script languages.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-ScriptLanguage
type ScriptLanguage string
// String returns the ScriptLanguage as string value.
func (t ScriptLanguage) String() string {
return string(t)
}
// ScriptLanguage values.
const (
ScriptLanguageJavaScript ScriptLanguage = "JavaScript"
ScriptLanguageWebAssembly ScriptLanguage = "WebAssembly"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScriptLanguage) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScriptLanguage) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScriptLanguage) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScriptLanguage(in.String()) {
case ScriptLanguageJavaScript:
*t = ScriptLanguageJavaScript
case ScriptLanguageWebAssembly:
*t = ScriptLanguageWebAssembly
default:
in.AddError(errors.New("unknown ScriptLanguage value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScriptLanguage) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// DebugSymbols debug symbols available for a wasm script.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-DebugSymbols
type DebugSymbols struct {
Type DebugSymbolsType `json:"type"` // Type of the debug symbols.
ExternalURL string `json:"externalURL,omitempty"` // URL of the external symbol source.
}
// ScopeType scope type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-Scope
type ScopeType string
// String returns the ScopeType as string value.
func (t ScopeType) String() string {
return string(t)
}
// ScopeType values.
const (
ScopeTypeGlobal ScopeType = "global"
ScopeTypeLocal ScopeType = "local"
ScopeTypeWith ScopeType = "with"
ScopeTypeClosure ScopeType = "closure"
ScopeTypeCatch ScopeType = "catch"
ScopeTypeBlock ScopeType = "block"
ScopeTypeScript ScopeType = "script"
ScopeTypeEval ScopeType = "eval"
ScopeTypeModule ScopeType = "module"
ScopeTypeWasmExpressionStack ScopeType = "wasm-expression-stack"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScopeType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScopeType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScopeType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScopeType(in.String()) {
case ScopeTypeGlobal:
*t = ScopeTypeGlobal
case ScopeTypeLocal:
*t = ScopeTypeLocal
case ScopeTypeWith:
*t = ScopeTypeWith
case ScopeTypeClosure:
*t = ScopeTypeClosure
case ScopeTypeCatch:
*t = ScopeTypeCatch
case ScopeTypeBlock:
*t = ScopeTypeBlock
case ScopeTypeScript:
*t = ScopeTypeScript
case ScopeTypeEval:
*t = ScopeTypeEval
case ScopeTypeModule:
*t = ScopeTypeModule
case ScopeTypeWasmExpressionStack:
*t = ScopeTypeWasmExpressionStack
default:
in.AddError(errors.New("unknown ScopeType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScopeType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// BreakLocationType [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-BreakLocation
type BreakLocationType string
// String returns the BreakLocationType as string value.
func (t BreakLocationType) String() string {
return string(t)
}
// BreakLocationType values.
const (
BreakLocationTypeDebuggerStatement BreakLocationType = "debuggerStatement"
BreakLocationTypeCall BreakLocationType = "call"
BreakLocationTypeReturn BreakLocationType = "return"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t BreakLocationType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t BreakLocationType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *BreakLocationType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch BreakLocationType(in.String()) {
case BreakLocationTypeDebuggerStatement:
*t = BreakLocationTypeDebuggerStatement
case BreakLocationTypeCall:
*t = BreakLocationTypeCall
case BreakLocationTypeReturn:
*t = BreakLocationTypeReturn
default:
in.AddError(errors.New("unknown BreakLocationType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *BreakLocationType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// DebugSymbolsType type of the debug symbols.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#type-DebugSymbols
type DebugSymbolsType string
// String returns the DebugSymbolsType as string value.
func (t DebugSymbolsType) String() string {
return string(t)
}
// DebugSymbolsType values.
const (
DebugSymbolsTypeNone DebugSymbolsType = "None"
DebugSymbolsTypeSourceMap DebugSymbolsType = "SourceMap"
DebugSymbolsTypeEmbeddedDWARF DebugSymbolsType = "EmbeddedDWARF"
DebugSymbolsTypeExternalDWARF DebugSymbolsType = "ExternalDWARF"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DebugSymbolsType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DebugSymbolsType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DebugSymbolsType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch DebugSymbolsType(in.String()) {
case DebugSymbolsTypeNone:
*t = DebugSymbolsTypeNone
case DebugSymbolsTypeSourceMap:
*t = DebugSymbolsTypeSourceMap
case DebugSymbolsTypeEmbeddedDWARF:
*t = DebugSymbolsTypeEmbeddedDWARF
case DebugSymbolsTypeExternalDWARF:
*t = DebugSymbolsTypeExternalDWARF
default:
in.AddError(errors.New("unknown DebugSymbolsType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DebugSymbolsType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PausedReason pause reason.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#event-paused
type PausedReason string
// String returns the PausedReason as string value.
func (t PausedReason) String() string {
return string(t)
}
// PausedReason values.
const (
PausedReasonAmbiguous PausedReason = "ambiguous"
PausedReasonAssert PausedReason = "assert"
PausedReasonDebugCommand PausedReason = "debugCommand"
PausedReasonDOM PausedReason = "DOM"
PausedReasonEventListener PausedReason = "EventListener"
PausedReasonException PausedReason = "exception"
PausedReasonInstrumentation PausedReason = "instrumentation"
PausedReasonOOM PausedReason = "OOM"
PausedReasonOther PausedReason = "other"
PausedReasonPromiseRejection PausedReason = "promiseRejection"
PausedReasonXHR PausedReason = "XHR"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PausedReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PausedReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PausedReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PausedReason(in.String()) {
case PausedReasonAmbiguous:
*t = PausedReasonAmbiguous
case PausedReasonAssert:
*t = PausedReasonAssert
case PausedReasonDebugCommand:
*t = PausedReasonDebugCommand
case PausedReasonDOM:
*t = PausedReasonDOM
case PausedReasonEventListener:
*t = PausedReasonEventListener
case PausedReasonException:
*t = PausedReasonException
case PausedReasonInstrumentation:
*t = PausedReasonInstrumentation
case PausedReasonOOM:
*t = PausedReasonOOM
case PausedReasonOther:
*t = PausedReasonOther
case PausedReasonPromiseRejection:
*t = PausedReasonPromiseRejection
case PausedReasonXHR:
*t = PausedReasonXHR
default:
in.AddError(errors.New("unknown PausedReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PausedReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ContinueToLocationTargetCallFrames [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-continueToLocation
type ContinueToLocationTargetCallFrames string
// String returns the ContinueToLocationTargetCallFrames as string value.
func (t ContinueToLocationTargetCallFrames) String() string {
return string(t)
}
// ContinueToLocationTargetCallFrames values.
const (
ContinueToLocationTargetCallFramesAny ContinueToLocationTargetCallFrames = "any"
ContinueToLocationTargetCallFramesCurrent ContinueToLocationTargetCallFrames = "current"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ContinueToLocationTargetCallFrames) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ContinueToLocationTargetCallFrames) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ContinueToLocationTargetCallFrames) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ContinueToLocationTargetCallFrames(in.String()) {
case ContinueToLocationTargetCallFramesAny:
*t = ContinueToLocationTargetCallFramesAny
case ContinueToLocationTargetCallFramesCurrent:
*t = ContinueToLocationTargetCallFramesCurrent
default:
in.AddError(errors.New("unknown ContinueToLocationTargetCallFrames value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ContinueToLocationTargetCallFrames) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SetInstrumentationBreakpointInstrumentation instrumentation name.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-setInstrumentationBreakpoint
type SetInstrumentationBreakpointInstrumentation string
// String returns the SetInstrumentationBreakpointInstrumentation as string value.
func (t SetInstrumentationBreakpointInstrumentation) String() string {
return string(t)
}
// SetInstrumentationBreakpointInstrumentation values.
const (
SetInstrumentationBreakpointInstrumentationBeforeScriptExecution SetInstrumentationBreakpointInstrumentation = "beforeScriptExecution"
SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution SetInstrumentationBreakpointInstrumentation = "beforeScriptWithSourceMapExecution"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SetInstrumentationBreakpointInstrumentation) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SetInstrumentationBreakpointInstrumentation) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SetInstrumentationBreakpointInstrumentation) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetInstrumentationBreakpointInstrumentation(in.String()) {
case SetInstrumentationBreakpointInstrumentationBeforeScriptExecution:
*t = SetInstrumentationBreakpointInstrumentationBeforeScriptExecution
case SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution:
*t = SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution
default:
in.AddError(errors.New("unknown SetInstrumentationBreakpointInstrumentation value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SetInstrumentationBreakpointInstrumentation) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ExceptionsState pause on exceptions mode.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Debugger#method-setPauseOnExceptions
type ExceptionsState string
// String returns the ExceptionsState as string value.
func (t ExceptionsState) String() string {
return string(t)
}
// ExceptionsState values.
const (
ExceptionsStateNone ExceptionsState = "none"
ExceptionsStateUncaught ExceptionsState = "uncaught"
ExceptionsStateAll ExceptionsState = "all"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ExceptionsState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ExceptionsState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ExceptionsState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ExceptionsState(in.String()) {
case ExceptionsStateNone:
*t = ExceptionsStateNone
case ExceptionsStateUncaught:
*t = ExceptionsStateUncaught
case ExceptionsStateAll:
*t = ExceptionsStateAll
default:
in.AddError(errors.New("unknown ExceptionsState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ExceptionsState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@@ -0,0 +1,63 @@
// Package deviceorientation provides the Chrome DevTools Protocol
// commands, types, and events for the DeviceOrientation domain.
//
// Generated by the cdproto-gen command.
package deviceorientation
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// ClearDeviceOrientationOverrideParams clears the overridden Device
// Orientation.
type ClearDeviceOrientationOverrideParams struct{}
// ClearDeviceOrientationOverride clears the overridden Device Orientation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceOrientation#method-clearDeviceOrientationOverride
func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
return &ClearDeviceOrientationOverrideParams{}
}
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context.
func (p *ClearDeviceOrientationOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClearDeviceOrientationOverride, nil, nil)
}
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
type SetDeviceOrientationOverrideParams struct {
Alpha float64 `json:"alpha"` // Mock alpha
Beta float64 `json:"beta"` // Mock beta
Gamma float64 `json:"gamma"` // Mock gamma
}
// SetDeviceOrientationOverride overrides the Device Orientation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceOrientation#method-setDeviceOrientationOverride
//
// parameters:
// alpha - Mock alpha
// beta - Mock beta
// gamma - Mock gamma
func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *SetDeviceOrientationOverrideParams {
return &SetDeviceOrientationOverrideParams{
Alpha: alpha,
Beta: beta,
Gamma: gamma,
}
}
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context.
func (p *SetDeviceOrientationOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDeviceOrientationOverride, p, nil)
}
// Command names.
const (
CommandClearDeviceOrientationOverride = "DeviceOrientation.clearDeviceOrientationOverride"
CommandSetDeviceOrientationOverride = "DeviceOrientation.setDeviceOrientationOverride"
)

View File

@@ -0,0 +1,158 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package deviceorientation
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation(in *jlexer.Lexer, out *SetDeviceOrientationOverrideParams) {
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 "alpha":
out.Alpha = float64(in.Float64())
case "beta":
out.Beta = float64(in.Float64())
case "gamma":
out.Gamma = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"alpha\":"
out.RawString(prefix[1:])
out.Float64(float64(in.Alpha))
}
{
const prefix string = ",\"beta\":"
out.RawString(prefix)
out.Float64(float64(in.Beta))
}
{
const prefix string = ",\"gamma\":"
out.RawString(prefix)
out.Float64(float64(in.Gamma))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation1(in *jlexer.Lexer, out *ClearDeviceOrientationOverrideParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation1(out *jwriter.Writer, in ClearDeviceOrientationOverrideParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ClearDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDeviceorientation1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation1(l, v)
}

1696
vendor/github.com/chromedp/cdproto/dom/dom.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

6882
vendor/github.com/chromedp/cdproto/dom/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

124
vendor/github.com/chromedp/cdproto/dom/events.go generated vendored Normal file
View File

@@ -0,0 +1,124 @@
package dom
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
)
// EventAttributeModified fired when Element's attribute is modified.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-attributeModified
type EventAttributeModified struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
Name string `json:"name"` // Attribute name.
Value string `json:"value"` // Attribute value.
}
// EventAttributeRemoved fired when Element's attribute is removed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-attributeRemoved
type EventAttributeRemoved struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
Name string `json:"name"` // A ttribute name.
}
// EventCharacterDataModified mirrors DOMCharacterDataModified event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-characterDataModified
type EventCharacterDataModified struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
CharacterData string `json:"characterData"` // New text value.
}
// EventChildNodeCountUpdated fired when Container's child node count has
// changed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-childNodeCountUpdated
type EventChildNodeCountUpdated struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
ChildNodeCount int64 `json:"childNodeCount"` // New node count.
}
// EventChildNodeInserted mirrors DOMNodeInserted event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-childNodeInserted
type EventChildNodeInserted struct {
ParentNodeID cdp.NodeID `json:"parentNodeId"` // Id of the node that has changed.
PreviousNodeID cdp.NodeID `json:"previousNodeId"` // If of the previous siblint.
Node *cdp.Node `json:"node"` // Inserted node data.
}
// EventChildNodeRemoved mirrors DOMNodeRemoved event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-childNodeRemoved
type EventChildNodeRemoved struct {
ParentNodeID cdp.NodeID `json:"parentNodeId"` // Parent id.
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has been removed.
}
// EventDistributedNodesUpdated called when distribution is changed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-distributedNodesUpdated
type EventDistributedNodesUpdated struct {
InsertionPointID cdp.NodeID `json:"insertionPointId"` // Insertion point where distributed nodes were updated.
DistributedNodes []*cdp.BackendNode `json:"distributedNodes"` // Distributed nodes for given insertion point.
}
// EventDocumentUpdated fired when Document has been totally updated. Node
// ids are no longer valid.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-documentUpdated
type EventDocumentUpdated struct{}
// EventInlineStyleInvalidated fired when Element's inline style is modified
// via a CSS property modification.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-inlineStyleInvalidated
type EventInlineStyleInvalidated struct {
NodeIds []cdp.NodeID `json:"nodeIds"` // Ids of the nodes for which the inline styles have been invalidated.
}
// EventPseudoElementAdded called when a pseudo element is added to an
// element.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-pseudoElementAdded
type EventPseudoElementAdded struct {
ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id.
PseudoElement *cdp.Node `json:"pseudoElement"` // The added pseudo element.
}
// EventPseudoElementRemoved called when a pseudo element is removed from an
// element.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-pseudoElementRemoved
type EventPseudoElementRemoved struct {
ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id.
PseudoElementID cdp.NodeID `json:"pseudoElementId"` // The removed pseudo element id.
}
// EventSetChildNodes fired when backend wants to provide client with the
// missing DOM structure. This happens upon most of the calls requesting node
// ids.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-setChildNodes
type EventSetChildNodes struct {
ParentID cdp.NodeID `json:"parentId"` // Parent node id to populate with children.
Nodes []*cdp.Node `json:"nodes"` // Child nodes array.
}
// EventShadowRootPopped called when shadow root is popped from the element.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-shadowRootPopped
type EventShadowRootPopped struct {
HostID cdp.NodeID `json:"hostId"` // Host element id.
RootID cdp.NodeID `json:"rootId"` // Shadow root id.
}
// EventShadowRootPushed called when shadow root is pushed into the element.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#event-shadowRootPushed
type EventShadowRootPushed struct {
HostID cdp.NodeID `json:"hostId"` // Host element id.
Root *cdp.Node `json:"root"` // Shadow root.
}

45
vendor/github.com/chromedp/cdproto/dom/types.go generated vendored Normal file
View File

@@ -0,0 +1,45 @@
package dom
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/mailru/easyjson"
)
// Quad an array of quad vertices, x immediately followed by y for each
// point, points clock-wise.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-Quad
type Quad []float64
// BoxModel box model.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-BoxModel
type BoxModel struct {
Content Quad `json:"content"` // Content box
Padding Quad `json:"padding"` // Padding box
Border Quad `json:"border"` // Border box
Margin Quad `json:"margin"` // Margin box
Width int64 `json:"width"` // Node width
Height int64 `json:"height"` // Node height
ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates
}
// ShapeOutsideInfo CSS Shape Outside details.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-ShapeOutsideInfo
type ShapeOutsideInfo struct {
Bounds Quad `json:"bounds"` // Shape bounds
Shape []easyjson.RawMessage `json:"shape"` // Shape coordinate details
MarginShape []easyjson.RawMessage `json:"marginShape"` // Margin shape bounds
}
// Rect Rectangle.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-Rect
type Rect struct {
X float64 `json:"x"` // X coordinate
Y float64 `json:"y"` // Y coordinate
Width float64 `json:"width"` // Rectangle width
Height float64 `json:"height"` // Rectangle height
}

View File

@@ -0,0 +1,289 @@
// Package domdebugger provides the Chrome DevTools Protocol
// commands, types, and events for the DOMDebugger domain.
//
// DOM debugging allows setting breakpoints on particular DOM operations and
// events. JavaScript execution will stop on these operations as if there was a
// regular breakpoint set.
//
// Generated by the cdproto-gen command.
package domdebugger
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
)
// GetEventListenersParams returns event listeners of the given object.
type GetEventListenersParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to return listeners for.
Depth int64 `json:"depth,omitempty"` // The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
Pierce bool `json:"pierce,omitempty"` // Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled.
}
// GetEventListeners returns event listeners of the given object.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-getEventListeners
//
// parameters:
// objectID - Identifier of the object to return listeners for.
func GetEventListeners(objectID runtime.RemoteObjectID) *GetEventListenersParams {
return &GetEventListenersParams{
ObjectID: objectID,
}
}
// WithDepth the maximum depth at which Node children should be retrieved,
// defaults to 1. Use -1 for the entire subtree or provide an integer larger
// than 0.
func (p GetEventListenersParams) WithDepth(depth int64) *GetEventListenersParams {
p.Depth = depth
return &p
}
// WithPierce whether or not iframes and shadow roots should be traversed
// when returning the subtree (default is false). Reports listeners for all
// contexts if pierce is enabled.
func (p GetEventListenersParams) WithPierce(pierce bool) *GetEventListenersParams {
p.Pierce = pierce
return &p
}
// GetEventListenersReturns return values.
type GetEventListenersReturns struct {
Listeners []*EventListener `json:"listeners,omitempty"` // Array of relevant listeners.
}
// Do executes DOMDebugger.getEventListeners against the provided context.
//
// returns:
// listeners - Array of relevant listeners.
func (p *GetEventListenersParams) Do(ctx context.Context) (listeners []*EventListener, err error) {
// execute
var res GetEventListenersReturns
err = cdp.Execute(ctx, CommandGetEventListeners, p, &res)
if err != nil {
return nil, err
}
return res.Listeners, nil
}
// RemoveDOMBreakpointParams removes DOM breakpoint that was set using
// setDOMBreakpoint.
type RemoveDOMBreakpointParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to remove breakpoint from.
Type DOMBreakpointType `json:"type"` // Type of the breakpoint to remove.
}
// RemoveDOMBreakpoint removes DOM breakpoint that was set using
// setDOMBreakpoint.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-removeDOMBreakpoint
//
// parameters:
// nodeID - Identifier of the node to remove breakpoint from.
// type - Type of the breakpoint to remove.
func RemoveDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *RemoveDOMBreakpointParams {
return &RemoveDOMBreakpointParams{
NodeID: nodeID,
Type: typeVal,
}
}
// Do executes DOMDebugger.removeDOMBreakpoint against the provided context.
func (p *RemoveDOMBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveDOMBreakpoint, p, nil)
}
// RemoveEventListenerBreakpointParams removes breakpoint on particular DOM
// event.
type RemoveEventListenerBreakpointParams struct {
EventName string `json:"eventName"` // Event name.
TargetName string `json:"targetName,omitempty"` // EventTarget interface name.
}
// RemoveEventListenerBreakpoint removes breakpoint on particular DOM event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-removeEventListenerBreakpoint
//
// parameters:
// eventName - Event name.
func RemoveEventListenerBreakpoint(eventName string) *RemoveEventListenerBreakpointParams {
return &RemoveEventListenerBreakpointParams{
EventName: eventName,
}
}
// WithTargetName eventTarget interface name.
func (p RemoveEventListenerBreakpointParams) WithTargetName(targetName string) *RemoveEventListenerBreakpointParams {
p.TargetName = targetName
return &p
}
// Do executes DOMDebugger.removeEventListenerBreakpoint against the provided context.
func (p *RemoveEventListenerBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveEventListenerBreakpoint, p, nil)
}
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
// native event.
type RemoveInstrumentationBreakpointParams struct {
EventName string `json:"eventName"` // Instrumentation name to stop on.
}
// RemoveInstrumentationBreakpoint removes breakpoint on particular native
// event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-removeInstrumentationBreakpoint
//
// parameters:
// eventName - Instrumentation name to stop on.
func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBreakpointParams {
return &RemoveInstrumentationBreakpointParams{
EventName: eventName,
}
}
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context.
func (p *RemoveInstrumentationBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveInstrumentationBreakpoint, p, nil)
}
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
type RemoveXHRBreakpointParams struct {
URL string `json:"url"` // Resource URL substring.
}
// RemoveXHRBreakpoint removes breakpoint from XMLHttpRequest.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-removeXHRBreakpoint
//
// parameters:
// url - Resource URL substring.
func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
return &RemoveXHRBreakpointParams{
URL: url,
}
}
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context.
func (p *RemoveXHRBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveXHRBreakpoint, p, nil)
}
// SetDOMBreakpointParams sets breakpoint on particular operation with DOM.
type SetDOMBreakpointParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to set breakpoint on.
Type DOMBreakpointType `json:"type"` // Type of the operation to stop upon.
}
// SetDOMBreakpoint sets breakpoint on particular operation with DOM.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-setDOMBreakpoint
//
// parameters:
// nodeID - Identifier of the node to set breakpoint on.
// type - Type of the operation to stop upon.
func SetDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *SetDOMBreakpointParams {
return &SetDOMBreakpointParams{
NodeID: nodeID,
Type: typeVal,
}
}
// Do executes DOMDebugger.setDOMBreakpoint against the provided context.
func (p *SetDOMBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDOMBreakpoint, p, nil)
}
// SetEventListenerBreakpointParams sets breakpoint on particular DOM event.
type SetEventListenerBreakpointParams struct {
EventName string `json:"eventName"` // DOM Event name to stop on (any DOM event will do).
TargetName string `json:"targetName,omitempty"` // EventTarget interface name to stop on. If equal to "*" or not provided, will stop on any EventTarget.
}
// SetEventListenerBreakpoint sets breakpoint on particular DOM event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-setEventListenerBreakpoint
//
// parameters:
// eventName - DOM Event name to stop on (any DOM event will do).
func SetEventListenerBreakpoint(eventName string) *SetEventListenerBreakpointParams {
return &SetEventListenerBreakpointParams{
EventName: eventName,
}
}
// WithTargetName eventTarget interface name to stop on. If equal to "*" or
// not provided, will stop on any EventTarget.
func (p SetEventListenerBreakpointParams) WithTargetName(targetName string) *SetEventListenerBreakpointParams {
p.TargetName = targetName
return &p
}
// Do executes DOMDebugger.setEventListenerBreakpoint against the provided context.
func (p *SetEventListenerBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetEventListenerBreakpoint, p, nil)
}
// SetInstrumentationBreakpointParams sets breakpoint on particular native
// event.
type SetInstrumentationBreakpointParams struct {
EventName string `json:"eventName"` // Instrumentation name to stop on.
}
// SetInstrumentationBreakpoint sets breakpoint on particular native event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-setInstrumentationBreakpoint
//
// parameters:
// eventName - Instrumentation name to stop on.
func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpointParams {
return &SetInstrumentationBreakpointParams{
EventName: eventName,
}
}
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context.
func (p *SetInstrumentationBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetInstrumentationBreakpoint, p, nil)
}
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
type SetXHRBreakpointParams struct {
URL string `json:"url"` // Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
}
// SetXHRBreakpoint sets breakpoint on XMLHttpRequest.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#method-setXHRBreakpoint
//
// parameters:
// url - Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
return &SetXHRBreakpointParams{
URL: url,
}
}
// Do executes DOMDebugger.setXHRBreakpoint against the provided context.
func (p *SetXHRBreakpointParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetXHRBreakpoint, p, nil)
}
// Command names.
const (
CommandGetEventListeners = "DOMDebugger.getEventListeners"
CommandRemoveDOMBreakpoint = "DOMDebugger.removeDOMBreakpoint"
CommandRemoveEventListenerBreakpoint = "DOMDebugger.removeEventListenerBreakpoint"
CommandRemoveInstrumentationBreakpoint = "DOMDebugger.removeInstrumentationBreakpoint"
CommandRemoveXHRBreakpoint = "DOMDebugger.removeXHRBreakpoint"
CommandSetDOMBreakpoint = "DOMDebugger.setDOMBreakpoint"
CommandSetEventListenerBreakpoint = "DOMDebugger.setEventListenerBreakpoint"
CommandSetInstrumentationBreakpoint = "DOMDebugger.setInstrumentationBreakpoint"
CommandSetXHRBreakpoint = "DOMDebugger.setXHRBreakpoint"
)

View File

@@ -0,0 +1,910 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package domdebugger
import (
json "encoding/json"
runtime "github.com/chromedp/cdproto/runtime"
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger(in *jlexer.Lexer, out *SetXHRBreakpointParams) {
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 "url":
out.URL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger(out *jwriter.Writer, in SetXHRBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"url\":"
out.RawString(prefix[1:])
out.String(string(in.URL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetXHRBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetXHRBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetXHRBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetXHRBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger1(in *jlexer.Lexer, out *SetInstrumentationBreakpointParams) {
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 "eventName":
out.EventName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger1(out *jwriter.Writer, in SetInstrumentationBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"eventName\":"
out.RawString(prefix[1:])
out.String(string(in.EventName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetInstrumentationBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetInstrumentationBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetInstrumentationBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetInstrumentationBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger2(in *jlexer.Lexer, out *SetEventListenerBreakpointParams) {
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 "eventName":
out.EventName = string(in.String())
case "targetName":
out.TargetName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger2(out *jwriter.Writer, in SetEventListenerBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"eventName\":"
out.RawString(prefix[1:])
out.String(string(in.EventName))
}
if in.TargetName != "" {
const prefix string = ",\"targetName\":"
out.RawString(prefix)
out.String(string(in.TargetName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetEventListenerBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetEventListenerBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetEventListenerBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetEventListenerBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger3(in *jlexer.Lexer, out *SetDOMBreakpointParams) {
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 "nodeId":
(out.NodeID).UnmarshalEasyJSON(in)
case "type":
(out.Type).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger3(out *jwriter.Writer, in SetDOMBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"nodeId\":"
out.RawString(prefix[1:])
out.Int64(int64(in.NodeID))
}
{
const prefix string = ",\"type\":"
out.RawString(prefix)
(in.Type).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetDOMBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDOMBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDOMBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDOMBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger4(in *jlexer.Lexer, out *RemoveXHRBreakpointParams) {
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 "url":
out.URL = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger4(out *jwriter.Writer, in RemoveXHRBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"url\":"
out.RawString(prefix[1:])
out.String(string(in.URL))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RemoveXHRBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RemoveXHRBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RemoveXHRBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RemoveXHRBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger4(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger5(in *jlexer.Lexer, out *RemoveInstrumentationBreakpointParams) {
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 "eventName":
out.EventName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger5(out *jwriter.Writer, in RemoveInstrumentationBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"eventName\":"
out.RawString(prefix[1:])
out.String(string(in.EventName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RemoveInstrumentationBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RemoveInstrumentationBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RemoveInstrumentationBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RemoveInstrumentationBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger5(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger6(in *jlexer.Lexer, out *RemoveEventListenerBreakpointParams) {
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 "eventName":
out.EventName = string(in.String())
case "targetName":
out.TargetName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger6(out *jwriter.Writer, in RemoveEventListenerBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"eventName\":"
out.RawString(prefix[1:])
out.String(string(in.EventName))
}
if in.TargetName != "" {
const prefix string = ",\"targetName\":"
out.RawString(prefix)
out.String(string(in.TargetName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RemoveEventListenerBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RemoveEventListenerBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RemoveEventListenerBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RemoveEventListenerBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger6(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger7(in *jlexer.Lexer, out *RemoveDOMBreakpointParams) {
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 "nodeId":
(out.NodeID).UnmarshalEasyJSON(in)
case "type":
(out.Type).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger7(out *jwriter.Writer, in RemoveDOMBreakpointParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"nodeId\":"
out.RawString(prefix[1:])
out.Int64(int64(in.NodeID))
}
{
const prefix string = ",\"type\":"
out.RawString(prefix)
(in.Type).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v RemoveDOMBreakpointParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RemoveDOMBreakpointParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RemoveDOMBreakpointParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RemoveDOMBreakpointParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger7(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger8(in *jlexer.Lexer, out *GetEventListenersReturns) {
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 "listeners":
if in.IsNull() {
in.Skip()
out.Listeners = nil
} else {
in.Delim('[')
if out.Listeners == nil {
if !in.IsDelim(']') {
out.Listeners = make([]*EventListener, 0, 8)
} else {
out.Listeners = []*EventListener{}
}
} else {
out.Listeners = (out.Listeners)[:0]
}
for !in.IsDelim(']') {
var v1 *EventListener
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(EventListener)
}
(*v1).UnmarshalEasyJSON(in)
}
out.Listeners = append(out.Listeners, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger8(out *jwriter.Writer, in GetEventListenersReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.Listeners) != 0 {
const prefix string = ",\"listeners\":"
first = false
out.RawString(prefix[1:])
{
out.RawByte('[')
for v2, v3 := range in.Listeners {
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 GetEventListenersReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetEventListenersReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetEventListenersReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetEventListenersReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger8(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger9(in *jlexer.Lexer, out *GetEventListenersParams) {
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 "objectId":
out.ObjectID = runtime.RemoteObjectID(in.String())
case "depth":
out.Depth = int64(in.Int64())
case "pierce":
out.Pierce = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger9(out *jwriter.Writer, in GetEventListenersParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"objectId\":"
out.RawString(prefix[1:])
out.String(string(in.ObjectID))
}
if in.Depth != 0 {
const prefix string = ",\"depth\":"
out.RawString(prefix)
out.Int64(int64(in.Depth))
}
if in.Pierce {
const prefix string = ",\"pierce\":"
out.RawString(prefix)
out.Bool(bool(in.Pierce))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetEventListenersParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger9(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetEventListenersParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger9(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetEventListenersParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger9(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetEventListenersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger9(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger10(in *jlexer.Lexer, out *EventListener) {
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 "type":
out.Type = string(in.String())
case "useCapture":
out.UseCapture = bool(in.Bool())
case "passive":
out.Passive = bool(in.Bool())
case "once":
out.Once = bool(in.Bool())
case "scriptId":
out.ScriptID = runtime.ScriptID(in.String())
case "lineNumber":
out.LineNumber = int64(in.Int64())
case "columnNumber":
out.ColumnNumber = int64(in.Int64())
case "handler":
if in.IsNull() {
in.Skip()
out.Handler = nil
} else {
if out.Handler == nil {
out.Handler = new(runtime.RemoteObject)
}
(*out.Handler).UnmarshalEasyJSON(in)
}
case "originalHandler":
if in.IsNull() {
in.Skip()
out.OriginalHandler = nil
} else {
if out.OriginalHandler == nil {
out.OriginalHandler = new(runtime.RemoteObject)
}
(*out.OriginalHandler).UnmarshalEasyJSON(in)
}
case "backendNodeId":
(out.BackendNodeID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger10(out *jwriter.Writer, in EventListener) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"type\":"
out.RawString(prefix[1:])
out.String(string(in.Type))
}
{
const prefix string = ",\"useCapture\":"
out.RawString(prefix)
out.Bool(bool(in.UseCapture))
}
{
const prefix string = ",\"passive\":"
out.RawString(prefix)
out.Bool(bool(in.Passive))
}
{
const prefix string = ",\"once\":"
out.RawString(prefix)
out.Bool(bool(in.Once))
}
{
const prefix string = ",\"scriptId\":"
out.RawString(prefix)
out.String(string(in.ScriptID))
}
{
const prefix string = ",\"lineNumber\":"
out.RawString(prefix)
out.Int64(int64(in.LineNumber))
}
{
const prefix string = ",\"columnNumber\":"
out.RawString(prefix)
out.Int64(int64(in.ColumnNumber))
}
if in.Handler != nil {
const prefix string = ",\"handler\":"
out.RawString(prefix)
(*in.Handler).MarshalEasyJSON(out)
}
if in.OriginalHandler != nil {
const prefix string = ",\"originalHandler\":"
out.RawString(prefix)
(*in.OriginalHandler).MarshalEasyJSON(out)
}
if in.BackendNodeID != 0 {
const prefix string = ",\"backendNodeId\":"
out.RawString(prefix)
out.Int64(int64(in.BackendNodeID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventListener) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger10(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventListener) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger10(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventListener) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger10(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventListener) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger10(l, v)
}

View File

@@ -0,0 +1,76 @@
package domdebugger
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// DOMBreakpointType DOM breakpoint type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#type-DOMBreakpointType
type DOMBreakpointType string
// String returns the DOMBreakpointType as string value.
func (t DOMBreakpointType) String() string {
return string(t)
}
// DOMBreakpointType values.
const (
DOMBreakpointTypeSubtreeModified DOMBreakpointType = "subtree-modified"
DOMBreakpointTypeAttributeModified DOMBreakpointType = "attribute-modified"
DOMBreakpointTypeNodeRemoved DOMBreakpointType = "node-removed"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DOMBreakpointType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DOMBreakpointType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DOMBreakpointType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch DOMBreakpointType(in.String()) {
case DOMBreakpointTypeSubtreeModified:
*t = DOMBreakpointTypeSubtreeModified
case DOMBreakpointTypeAttributeModified:
*t = DOMBreakpointTypeAttributeModified
case DOMBreakpointTypeNodeRemoved:
*t = DOMBreakpointTypeNodeRemoved
default:
in.AddError(errors.New("unknown DOMBreakpointType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DOMBreakpointType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// EventListener object event listener.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMDebugger#type-EventListener
type EventListener struct {
Type string `json:"type"` // EventListener's type.
UseCapture bool `json:"useCapture"` // EventListener's useCapture.
Passive bool `json:"passive"` // EventListener's passive flag.
Once bool `json:"once"` // EventListener's once flag.
ScriptID runtime.ScriptID `json:"scriptId"` // Script id of the handler code.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber"` // Column number in the script (0-based).
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event handler function value.
OriginalHandler *runtime.RemoteObject `json:"originalHandler,omitempty"` // Event original handler function value.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any).
}

View File

@@ -0,0 +1,116 @@
// Package domsnapshot provides the Chrome DevTools Protocol
// commands, types, and events for the DOMSnapshot domain.
//
// This domain facilitates obtaining document snapshots with DOM, layout, and
// style information.
//
// Generated by the cdproto-gen command.
package domsnapshot
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// DisableParams disables DOM snapshot agent for the given page.
type DisableParams struct{}
// Disable disables DOM snapshot agent for the given page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOMSnapshot.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables DOM snapshot agent for the given page.
type EnableParams struct{}
// Enable enables DOM snapshot agent for the given page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOMSnapshot.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// CaptureSnapshotParams returns a document snapshot, including the full DOM
// tree of the root node (including iframes, template contents, and imported
// documents) in a flattened array, as well as layout and white-listed computed
// style information for the nodes. Shadow DOM in the returned DOM tree is
// flattened.
type CaptureSnapshotParams struct {
ComputedStyles []string `json:"computedStyles"` // Whitelist of computed styles to return.
IncludePaintOrder bool `json:"includePaintOrder,omitempty"` // Whether to include layout object paint orders into the snapshot.
IncludeDOMRects bool `json:"includeDOMRects,omitempty"` // Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
}
// CaptureSnapshot returns a document snapshot, including the full DOM tree
// of the root node (including iframes, template contents, and imported
// documents) in a flattened array, as well as layout and white-listed computed
// style information for the nodes. Shadow DOM in the returned DOM tree is
// flattened.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#method-captureSnapshot
//
// parameters:
// computedStyles - Whitelist of computed styles to return.
func CaptureSnapshot(computedStyles []string) *CaptureSnapshotParams {
return &CaptureSnapshotParams{
ComputedStyles: computedStyles,
}
}
// WithIncludePaintOrder whether to include layout object paint orders into
// the snapshot.
func (p CaptureSnapshotParams) WithIncludePaintOrder(includePaintOrder bool) *CaptureSnapshotParams {
p.IncludePaintOrder = includePaintOrder
return &p
}
// WithIncludeDOMRects whether to include DOM rectangles (offsetRects,
// clientRects, scrollRects) into the snapshot.
func (p CaptureSnapshotParams) WithIncludeDOMRects(includeDOMRects bool) *CaptureSnapshotParams {
p.IncludeDOMRects = includeDOMRects
return &p
}
// CaptureSnapshotReturns return values.
type CaptureSnapshotReturns struct {
Documents []*DocumentSnapshot `json:"documents,omitempty"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
Strings []string `json:"strings,omitempty"` // Shared string table that all string properties refer to with indexes.
}
// Do executes DOMSnapshot.captureSnapshot against the provided context.
//
// returns:
// documents - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
// strings - Shared string table that all string properties refer to with indexes.
func (p *CaptureSnapshotParams) Do(ctx context.Context) (documents []*DocumentSnapshot, strings []string, err error) {
// execute
var res CaptureSnapshotReturns
err = cdp.Execute(ctx, CommandCaptureSnapshot, p, &res)
if err != nil {
return nil, nil, err
}
return res.Documents, res.Strings, nil
}
// Command names.
const (
CommandDisable = "DOMSnapshot.disable"
CommandEnable = "DOMSnapshot.enable"
CommandCaptureSnapshot = "DOMSnapshot.captureSnapshot"
)

File diff suppressed because it is too large Load Diff

195
vendor/github.com/chromedp/cdproto/domsnapshot/types.go generated vendored Normal file
View File

@@ -0,0 +1,195 @@
package domsnapshot
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/dom"
"github.com/chromedp/cdproto/domdebugger"
)
// DOMNode a Node in the DOM tree.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-DOMNode
type DOMNode struct {
NodeType cdp.NodeType `json:"nodeType"` // Node's nodeType.
NodeName string `json:"nodeName"` // Node's nodeName.
NodeValue string `json:"nodeValue"` // Node's nodeValue.
TextValue string `json:"textValue,omitempty"` // Only set for textarea elements, contains the text value.
InputValue string `json:"inputValue,omitempty"` // Only set for input elements, contains the input's associated text value.
InputChecked bool `json:"inputChecked,omitempty"` // Only set for radio and checkbox input elements, indicates if the element has been checked
OptionSelected bool `json:"optionSelected,omitempty"` // Only set for option elements, indicates if the element has been selected
BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Node's id, corresponds to DOM.Node.backendNodeId.
ChildNodeIndexes []int64 `json:"childNodeIndexes,omitempty"` // The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if any.
Attributes []*NameValue `json:"attributes,omitempty"` // Attributes of an Element node.
PseudoElementIndexes []int64 `json:"pseudoElementIndexes,omitempty"` // Indexes of pseudo elements associated with this node in the domNodes array returned by getSnapshot, if any.
LayoutNodeIndex int64 `json:"layoutNodeIndex,omitempty"` // The index of the node's related layout tree node in the layoutTreeNodes array returned by getSnapshot, if any.
DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to.
BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion.
ContentLanguage string `json:"contentLanguage,omitempty"` // Only set for documents, contains the document's content language.
DocumentEncoding string `json:"documentEncoding,omitempty"` // Only set for documents, contains the document's character set encoding.
PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements and also for the document node.
ContentDocumentIndex int64 `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any.
PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Type of a pseudo element node.
ShadowRootType cdp.ShadowRootType `json:"shadowRootType,omitempty"` // Shadow root type.
IsClickable bool `json:"isClickable,omitempty"` // Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked.
EventListeners []*domdebugger.EventListener `json:"eventListeners,omitempty"` // Details of the node's event listeners, if any.
CurrentSourceURL string `json:"currentSourceURL,omitempty"` // The selected url for nodes with a srcset attribute.
OriginURL string `json:"originURL,omitempty"` // The url of the script (if any) that generates this node.
ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Scroll offsets, set when this node is a Document.
ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"`
}
// InlineTextBox details of post layout rendered text positions. The exact
// layout should not be regarded as stable and may change between versions.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-InlineTextBox
type InlineTextBox struct {
BoundingBox *dom.Rect `json:"boundingBox"` // The bounding box in document coordinates. Note that scroll offset of the document is ignored.
StartCharacterIndex int64 `json:"startCharacterIndex"` // The starting index in characters, for this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.
NumCharacters int64 `json:"numCharacters"` // The number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.
}
// LayoutTreeNode details of an element in the DOM tree with a LayoutObject.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-LayoutTreeNode
type LayoutTreeNode struct {
DomNodeIndex int64 `json:"domNodeIndex"` // The index of the related DOM node in the domNodes array returned by getSnapshot.
BoundingBox *dom.Rect `json:"boundingBox"` // The bounding box in document coordinates. Note that scroll offset of the document is ignored.
LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText, if any.
InlineTextNodes []*InlineTextBox `json:"inlineTextNodes,omitempty"` // The post-layout inline text nodes, if any.
StyleIndex int64 `json:"styleIndex,omitempty"` // Index into the computedStyles array returned by getSnapshot.
PaintOrder int64 `json:"paintOrder,omitempty"` // Global paint order index, which is determined by the stacking order of the nodes. Nodes that are painted together will have the same index. Only provided if includePaintOrder in getSnapshot was true.
IsStackingContext bool `json:"isStackingContext,omitempty"` // Set to true to indicate the element begins a new stacking context.
}
// ComputedStyle a subset of the full ComputedStyle as defined by the request
// whitelist.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-ComputedStyle
type ComputedStyle struct {
Properties []*NameValue `json:"properties"` // Name/value pairs of computed style properties.
}
// NameValue a name/value pair.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-NameValue
type NameValue struct {
Name string `json:"name"` // Attribute/property name.
Value string `json:"value"` // Attribute/property value.
}
// StringIndex index of the string in the strings table.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-StringIndex
type StringIndex int64
// Int64 returns the StringIndex as int64 value.
func (t StringIndex) Int64() int64 {
return int64(t)
}
// ArrayOfStrings index of the string in the strings table.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-ArrayOfStrings
type ArrayOfStrings []int64
// RareStringData data that is only present on rare nodes.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-RareStringData
type RareStringData struct {
Index []int64 `json:"index"`
Value []StringIndex `json:"value"`
}
// RareBooleanData [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-RareBooleanData
type RareBooleanData struct {
Index []int64 `json:"index"`
}
// RareIntegerData [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-RareIntegerData
type RareIntegerData struct {
Index []int64 `json:"index"`
Value []int64 `json:"value"`
}
// Rectangle [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-Rectangle
type Rectangle []float64
// DocumentSnapshot document snapshot.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-DocumentSnapshot
type DocumentSnapshot struct {
DocumentURL StringIndex `json:"documentURL"` // Document URL that Document or FrameOwner node points to.
Title StringIndex `json:"title"` // Document title.
BaseURL StringIndex `json:"baseURL"` // Base URL that Document or FrameOwner node uses for URL completion.
ContentLanguage StringIndex `json:"contentLanguage"` // Contains the document's content language.
EncodingName StringIndex `json:"encodingName"` // Contains the document's character set encoding.
PublicID StringIndex `json:"publicId"` // DocumentType node's publicId.
SystemID StringIndex `json:"systemId"` // DocumentType node's systemId.
FrameID StringIndex `json:"frameId"` // Frame ID for frame owner elements and also for the document node.
Nodes *NodeTreeSnapshot `json:"nodes"` // A table with dom nodes.
Layout *LayoutTreeSnapshot `json:"layout"` // The nodes in the layout tree.
TextBoxes *TextBoxSnapshot `json:"textBoxes"` // The post-layout inline text nodes.
ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Horizontal scroll offset.
ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"` // Vertical scroll offset.
ContentWidth float64 `json:"contentWidth,omitempty"` // Document content width.
ContentHeight float64 `json:"contentHeight,omitempty"` // Document content height.
}
// NodeTreeSnapshot table containing nodes.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-NodeTreeSnapshot
type NodeTreeSnapshot struct {
ParentIndex []int64 `json:"parentIndex,omitempty"` // Parent node index.
NodeType []int64 `json:"nodeType,omitempty"` // Node's nodeType.
NodeName []StringIndex `json:"nodeName,omitempty"` // Node's nodeName.
NodeValue []StringIndex `json:"nodeValue,omitempty"` // Node's nodeValue.
BackendNodeID []cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node's id, corresponds to DOM.Node.backendNodeId.
Attributes []ArrayOfStrings `json:"attributes,omitempty"` // Attributes of an Element node. Flatten name, value pairs.
TextValue *RareStringData `json:"textValue,omitempty"` // Only set for textarea elements, contains the text value.
InputValue *RareStringData `json:"inputValue,omitempty"` // Only set for input elements, contains the input's associated text value.
InputChecked *RareBooleanData `json:"inputChecked,omitempty"` // Only set for radio and checkbox input elements, indicates if the element has been checked
OptionSelected *RareBooleanData `json:"optionSelected,omitempty"` // Only set for option elements, indicates if the element has been selected
ContentDocumentIndex *RareIntegerData `json:"contentDocumentIndex,omitempty"` // The index of the document in the list of the snapshot documents.
PseudoType *RareStringData `json:"pseudoType,omitempty"` // Type of a pseudo element node.
IsClickable *RareBooleanData `json:"isClickable,omitempty"` // Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked.
CurrentSourceURL *RareStringData `json:"currentSourceURL,omitempty"` // The selected url for nodes with a srcset attribute.
OriginURL *RareStringData `json:"originURL,omitempty"` // The url of the script (if any) that generates this node.
}
// LayoutTreeSnapshot table of details of an element in the DOM tree with a
// LayoutObject.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-LayoutTreeSnapshot
type LayoutTreeSnapshot struct {
NodeIndex []int64 `json:"nodeIndex"` // Index of the corresponding node in the NodeTreeSnapshot array returned by captureSnapshot.
Styles []ArrayOfStrings `json:"styles"` // Array of indexes specifying computed style strings, filtered according to the computedStyles parameter passed to captureSnapshot.
Bounds []Rectangle `json:"bounds"` // The absolute position bounding box.
Text []StringIndex `json:"text"` // Contents of the LayoutText, if any.
StackingContexts *RareBooleanData `json:"stackingContexts"` // Stacking context information.
PaintOrders []int64 `json:"paintOrders,omitempty"` // Global paint order index, which is determined by the stacking order of the nodes. Nodes that are painted together will have the same index. Only provided if includePaintOrder in captureSnapshot was true.
OffsetRects []Rectangle `json:"offsetRects,omitempty"` // The offset rect of nodes. Only available when includeDOMRects is set to true
ScrollRects []Rectangle `json:"scrollRects,omitempty"` // The scroll rect of nodes. Only available when includeDOMRects is set to true
ClientRects []Rectangle `json:"clientRects,omitempty"` // The client rect of nodes. Only available when includeDOMRects is set to true
}
// TextBoxSnapshot table of details of the post layout rendered text
// positions. The exact layout should not be regarded as stable and may change
// between versions.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot#type-TextBoxSnapshot
type TextBoxSnapshot struct {
LayoutIndex []int64 `json:"layoutIndex"` // Index of the layout tree node that owns this box collection.
Bounds []Rectangle `json:"bounds"` // The absolute position bounding box.
Start []int64 `json:"start"` // The starting index in characters, for this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.
Length []int64 `json:"length"` // The number of characters in this post layout textbox substring. Characters that would be represented as a surrogate pair in UTF-16 have length 2.
}

View File

@@ -0,0 +1,171 @@
// Package domstorage provides the Chrome DevTools Protocol
// commands, types, and events for the DOMStorage domain.
//
// Query and modify DOM storage.
//
// Generated by the cdproto-gen command.
package domstorage
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// ClearParams [no description].
type ClearParams struct {
StorageID *StorageID `json:"storageId"`
}
// Clear [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-clear
//
// parameters:
// storageID
func Clear(storageID *StorageID) *ClearParams {
return &ClearParams{
StorageID: storageID,
}
}
// Do executes DOMStorage.clear against the provided context.
func (p *ClearParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClear, p, nil)
}
// DisableParams disables storage tracking, prevents storage events from
// being sent to the client.
type DisableParams struct{}
// Disable disables storage tracking, prevents storage events from being sent
// to the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOMStorage.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables storage tracking, storage events will now be
// delivered to the client.
type EnableParams struct{}
// Enable enables storage tracking, storage events will now be delivered to
// the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOMStorage.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetDOMStorageItemsParams [no description].
type GetDOMStorageItemsParams struct {
StorageID *StorageID `json:"storageId"`
}
// GetDOMStorageItems [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-getDOMStorageItems
//
// parameters:
// storageID
func GetDOMStorageItems(storageID *StorageID) *GetDOMStorageItemsParams {
return &GetDOMStorageItemsParams{
StorageID: storageID,
}
}
// GetDOMStorageItemsReturns return values.
type GetDOMStorageItemsReturns struct {
Entries []Item `json:"entries,omitempty"`
}
// Do executes DOMStorage.getDOMStorageItems against the provided context.
//
// returns:
// entries
func (p *GetDOMStorageItemsParams) Do(ctx context.Context) (entries []Item, err error) {
// execute
var res GetDOMStorageItemsReturns
err = cdp.Execute(ctx, CommandGetDOMStorageItems, p, &res)
if err != nil {
return nil, err
}
return res.Entries, nil
}
// RemoveDOMStorageItemParams [no description].
type RemoveDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
// RemoveDOMStorageItem [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-removeDOMStorageItem
//
// parameters:
// storageID
// key
func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageItemParams {
return &RemoveDOMStorageItemParams{
StorageID: storageID,
Key: key,
}
}
// Do executes DOMStorage.removeDOMStorageItem against the provided context.
func (p *RemoveDOMStorageItemParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveDOMStorageItem, p, nil)
}
// SetDOMStorageItemParams [no description].
type SetDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
Value string `json:"value"`
}
// SetDOMStorageItem [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-setDOMStorageItem
//
// parameters:
// storageID
// key
// value
func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMStorageItemParams {
return &SetDOMStorageItemParams{
StorageID: storageID,
Key: key,
Value: value,
}
}
// Do executes DOMStorage.setDOMStorageItem against the provided context.
func (p *SetDOMStorageItemParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDOMStorageItem, p, nil)
}
// Command names.
const (
CommandClear = "DOMStorage.clear"
CommandDisable = "DOMStorage.disable"
CommandEnable = "DOMStorage.enable"
CommandGetDOMStorageItems = "DOMStorage.getDOMStorageItems"
CommandRemoveDOMStorageItem = "DOMStorage.removeDOMStorageItem"
CommandSetDOMStorageItem = "DOMStorage.setDOMStorageItem"
)

1026
vendor/github.com/chromedp/cdproto/domstorage/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
package domstorage
// Code generated by cdproto-gen. DO NOT EDIT.
// EventDomStorageItemAdded [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#event-domStorageItemAdded
type EventDomStorageItemAdded struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
NewValue string `json:"newValue"`
}
// EventDomStorageItemRemoved [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#event-domStorageItemRemoved
type EventDomStorageItemRemoved struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
// EventDomStorageItemUpdated [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#event-domStorageItemUpdated
type EventDomStorageItemUpdated struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
OldValue string `json:"oldValue"`
NewValue string `json:"newValue"`
}
// EventDomStorageItemsCleared [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#event-domStorageItemsCleared
type EventDomStorageItemsCleared struct {
StorageID *StorageID `json:"storageId"`
}

16
vendor/github.com/chromedp/cdproto/domstorage/types.go generated vendored Normal file
View File

@@ -0,0 +1,16 @@
package domstorage
// Code generated by cdproto-gen. DO NOT EDIT.
// StorageID DOM Storage identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#type-StorageId
type StorageID struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin for the storage.
IsLocalStorage bool `json:"isLocalStorage"` // Whether the storage is local storage (not session storage).
}
// Item DOM Storage item.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#type-Item
type Item []string

287
vendor/github.com/chromedp/cdproto/easyjson.go generated vendored Normal file
View File

@@ -0,0 +1,287 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package cdproto
import (
json "encoding/json"
target "github.com/chromedp/cdproto/target"
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 easyjsonC5a4559bDecodeGithubComChromedpCdproto(in *jlexer.Lexer, out *empty) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdproto(out *jwriter.Writer, in empty) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v empty) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdproto(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v empty) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdproto(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *empty) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdproto(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *empty) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdproto(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdproto1(in *jlexer.Lexer, out *Message) {
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 "id":
out.ID = int64(in.Int64())
case "sessionId":
out.SessionID = target.SessionID(in.String())
case "method":
out.Method = MethodType(in.String())
case "params":
(out.Params).UnmarshalEasyJSON(in)
case "result":
(out.Result).UnmarshalEasyJSON(in)
case "error":
if in.IsNull() {
in.Skip()
out.Error = nil
} else {
if out.Error == nil {
out.Error = new(Error)
}
(*out.Error).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdproto1(out *jwriter.Writer, in Message) {
out.RawByte('{')
first := true
_ = first
if in.ID != 0 {
const prefix string = ",\"id\":"
first = false
out.RawString(prefix[1:])
out.Int64(int64(in.ID))
}
if in.SessionID != "" {
const prefix string = ",\"sessionId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.SessionID))
}
if in.Method != "" {
const prefix string = ",\"method\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Method))
}
if (in.Params).IsDefined() {
const prefix string = ",\"params\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Params).MarshalEasyJSON(out)
}
if (in.Result).IsDefined() {
const prefix string = ",\"result\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Result).MarshalEasyJSON(out)
}
if in.Error != nil {
const prefix string = ",\"error\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Error).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Message) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdproto1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Message) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdproto1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Message) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdproto1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdproto1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdproto2(in *jlexer.Lexer, out *Error) {
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 "code":
out.Code = int64(in.Int64())
case "message":
out.Message = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdproto2(out *jwriter.Writer, in Error) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"code\":"
out.RawString(prefix[1:])
out.Int64(int64(in.Code))
}
{
const prefix string = ",\"message\":"
out.RawString(prefix)
out.String(string(in.Message))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Error) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdproto2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdproto2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Error) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdproto2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdproto2(l, v)
}

2205
vendor/github.com/chromedp/cdproto/emulation/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,714 @@
// Package emulation provides the Chrome DevTools Protocol
// commands, types, and events for the Emulation domain.
//
// This domain emulates different environments for the page.
//
// Generated by the cdproto-gen command.
package emulation
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/page"
)
// CanEmulateParams tells whether emulation is supported.
type CanEmulateParams struct{}
// CanEmulate tells whether emulation is supported.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-canEmulate
func CanEmulate() *CanEmulateParams {
return &CanEmulateParams{}
}
// CanEmulateReturns return values.
type CanEmulateReturns struct {
Result bool `json:"result,omitempty"` // True if emulation is supported.
}
// Do executes Emulation.canEmulate against the provided context.
//
// returns:
// result - True if emulation is supported.
func (p *CanEmulateParams) Do(ctx context.Context) (result bool, err error) {
// execute
var res CanEmulateReturns
err = cdp.Execute(ctx, CommandCanEmulate, nil, &res)
if err != nil {
return false, err
}
return res.Result, nil
}
// ClearDeviceMetricsOverrideParams clears the overridden device metrics.
type ClearDeviceMetricsOverrideParams struct{}
// ClearDeviceMetricsOverride clears the overridden device metrics.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearDeviceMetricsOverride
func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
return &ClearDeviceMetricsOverrideParams{}
}
// Do executes Emulation.clearDeviceMetricsOverride against the provided context.
func (p *ClearDeviceMetricsOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClearDeviceMetricsOverride, nil, nil)
}
// ClearGeolocationOverrideParams clears the overridden Geolocation Position
// and Error.
type ClearGeolocationOverrideParams struct{}
// ClearGeolocationOverride clears the overridden Geolocation Position and
// Error.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearGeolocationOverride
func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
return &ClearGeolocationOverrideParams{}
}
// Do executes Emulation.clearGeolocationOverride against the provided context.
func (p *ClearGeolocationOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClearGeolocationOverride, nil, nil)
}
// ResetPageScaleFactorParams requests that page scale factor is reset to
// initial values.
type ResetPageScaleFactorParams struct{}
// ResetPageScaleFactor requests that page scale factor is reset to initial
// values.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-resetPageScaleFactor
func ResetPageScaleFactor() *ResetPageScaleFactorParams {
return &ResetPageScaleFactorParams{}
}
// Do executes Emulation.resetPageScaleFactor against the provided context.
func (p *ResetPageScaleFactorParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandResetPageScaleFactor, nil, nil)
}
// SetFocusEmulationEnabledParams enables or disables simulating a focused
// and active page.
type SetFocusEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether to enable to disable focus emulation.
}
// SetFocusEmulationEnabled enables or disables simulating a focused and
// active page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setFocusEmulationEnabled
//
// parameters:
// enabled - Whether to enable to disable focus emulation.
func SetFocusEmulationEnabled(enabled bool) *SetFocusEmulationEnabledParams {
return &SetFocusEmulationEnabledParams{
Enabled: enabled,
}
}
// Do executes Emulation.setFocusEmulationEnabled against the provided context.
func (p *SetFocusEmulationEnabledParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetFocusEmulationEnabled, p, nil)
}
// SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
type SetCPUThrottlingRateParams struct {
Rate float64 `json:"rate"` // Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
}
// SetCPUThrottlingRate enables CPU throttling to emulate slow CPUs.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setCPUThrottlingRate
//
// parameters:
// rate - Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams {
return &SetCPUThrottlingRateParams{
Rate: rate,
}
}
// Do executes Emulation.setCPUThrottlingRate against the provided context.
func (p *SetCPUThrottlingRateParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetCPUThrottlingRate, p, nil)
}
// SetDefaultBackgroundColorOverrideParams sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
type SetDefaultBackgroundColorOverrideParams struct {
Color *cdp.RGBA `json:"color,omitempty"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
// SetDefaultBackgroundColorOverride sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDefaultBackgroundColorOverride
//
// parameters:
func SetDefaultBackgroundColorOverride() *SetDefaultBackgroundColorOverrideParams {
return &SetDefaultBackgroundColorOverrideParams{}
}
// WithColor rGBA of the default background color. If not specified, any
// existing override will be cleared.
func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *SetDefaultBackgroundColorOverrideParams {
p.Color = color
return &p
}
// Do executes Emulation.setDefaultBackgroundColorOverride against the provided context.
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDefaultBackgroundColorOverride, p, nil)
}
// SetDeviceMetricsOverrideParams overrides the values of device screen
// dimensions (window.screen.width, window.screen.height, window.innerWidth,
// window.innerHeight, and "device-width"/"device-height"-related CSS media
// query results).
type SetDeviceMetricsOverrideParams struct {
Width int64 `json:"width"` // Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
Height int64 `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override.
Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
Scale float64 `json:"scale,omitempty"` // Scale to apply to resulting view image.
ScreenWidth int64 `json:"screenWidth,omitempty"` // Overriding screen width value in pixels (minimum 0, maximum 10000000).
ScreenHeight int64 `json:"screenHeight,omitempty"` // Overriding screen height value in pixels (minimum 0, maximum 10000000).
PositionX int64 `json:"positionX,omitempty"` // Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
PositionY int64 `json:"positionY,omitempty"` // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
DontSetVisibleSize bool `json:"dontSetVisibleSize,omitempty"` // Do not set visible view size, rely upon explicit setVisibleSize call.
ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override.
Viewport *page.Viewport `json:"viewport,omitempty"` // If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
}
// SetDeviceMetricsOverride overrides the values of device screen dimensions
// (window.screen.width, window.screen.height, window.innerWidth,
// window.innerHeight, and "device-width"/"device-height"-related CSS media
// query results).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDeviceMetricsOverride
//
// parameters:
// width - Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
// height - Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
// deviceScaleFactor - Overriding device scale factor value. 0 disables the override.
// mobile - Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
func SetDeviceMetricsOverride(width int64, height int64, deviceScaleFactor float64, mobile bool) *SetDeviceMetricsOverrideParams {
return &SetDeviceMetricsOverrideParams{
Width: width,
Height: height,
DeviceScaleFactor: deviceScaleFactor,
Mobile: mobile,
}
}
// WithScale scale to apply to resulting view image.
func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams {
p.Scale = scale
return &p
}
// WithScreenWidth overriding screen width value in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithScreenWidth(screenWidth int64) *SetDeviceMetricsOverrideParams {
p.ScreenWidth = screenWidth
return &p
}
// WithScreenHeight overriding screen height value in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithScreenHeight(screenHeight int64) *SetDeviceMetricsOverrideParams {
p.ScreenHeight = screenHeight
return &p
}
// WithPositionX overriding view X position on screen in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithPositionX(positionX int64) *SetDeviceMetricsOverrideParams {
p.PositionX = positionX
return &p
}
// WithPositionY overriding view Y position on screen in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDeviceMetricsOverrideParams {
p.PositionY = positionY
return &p
}
// WithDontSetVisibleSize do not set visible view size, rely upon explicit
// setVisibleSize call.
func (p SetDeviceMetricsOverrideParams) WithDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideParams {
p.DontSetVisibleSize = dontSetVisibleSize
return &p
}
// WithScreenOrientation screen orientation override.
func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams {
p.ScreenOrientation = screenOrientation
return &p
}
// WithViewport if set, the visible area of the page will be overridden to
// this viewport. This viewport change is not observed by the page, e.g.
// viewport-relative elements do not change positions.
func (p SetDeviceMetricsOverrideParams) WithViewport(viewport *page.Viewport) *SetDeviceMetricsOverrideParams {
p.Viewport = viewport
return &p
}
// Do executes Emulation.setDeviceMetricsOverride against the provided context.
func (p *SetDeviceMetricsOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDeviceMetricsOverride, p, nil)
}
// SetScrollbarsHiddenParams [no description].
type SetScrollbarsHiddenParams struct {
Hidden bool `json:"hidden"` // Whether scrollbars should be always hidden.
}
// SetScrollbarsHidden [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setScrollbarsHidden
//
// parameters:
// hidden - Whether scrollbars should be always hidden.
func SetScrollbarsHidden(hidden bool) *SetScrollbarsHiddenParams {
return &SetScrollbarsHiddenParams{
Hidden: hidden,
}
}
// Do executes Emulation.setScrollbarsHidden against the provided context.
func (p *SetScrollbarsHiddenParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetScrollbarsHidden, p, nil)
}
// SetDocumentCookieDisabledParams [no description].
type SetDocumentCookieDisabledParams struct {
Disabled bool `json:"disabled"` // Whether document.coookie API should be disabled.
}
// SetDocumentCookieDisabled [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDocumentCookieDisabled
//
// parameters:
// disabled - Whether document.coookie API should be disabled.
func SetDocumentCookieDisabled(disabled bool) *SetDocumentCookieDisabledParams {
return &SetDocumentCookieDisabledParams{
Disabled: disabled,
}
}
// Do executes Emulation.setDocumentCookieDisabled against the provided context.
func (p *SetDocumentCookieDisabledParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDocumentCookieDisabled, p, nil)
}
// SetEmitTouchEventsForMouseParams [no description].
type SetEmitTouchEventsForMouseParams struct {
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
Configuration SetEmitTouchEventsForMouseConfiguration `json:"configuration,omitempty"` // Touch/gesture events configuration. Default: current platform.
}
// SetEmitTouchEventsForMouse [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmitTouchEventsForMouse
//
// parameters:
// enabled - Whether touch emulation based on mouse input should be enabled.
func SetEmitTouchEventsForMouse(enabled bool) *SetEmitTouchEventsForMouseParams {
return &SetEmitTouchEventsForMouseParams{
Enabled: enabled,
}
}
// WithConfiguration touch/gesture events configuration. Default: current
// platform.
func (p SetEmitTouchEventsForMouseParams) WithConfiguration(configuration SetEmitTouchEventsForMouseConfiguration) *SetEmitTouchEventsForMouseParams {
p.Configuration = configuration
return &p
}
// Do executes Emulation.setEmitTouchEventsForMouse against the provided context.
func (p *SetEmitTouchEventsForMouseParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetEmitTouchEventsForMouse, p, nil)
}
// SetEmulatedMediaParams emulates the given media type or media feature for
// CSS media queries.
type SetEmulatedMediaParams struct {
Media string `json:"media,omitempty"` // Media type to emulate. Empty string disables the override.
Features []*MediaFeature `json:"features,omitempty"` // Media features to emulate.
}
// SetEmulatedMedia emulates the given media type or media feature for CSS
// media queries.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedMedia
//
// parameters:
func SetEmulatedMedia() *SetEmulatedMediaParams {
return &SetEmulatedMediaParams{}
}
// WithMedia media type to emulate. Empty string disables the override.
func (p SetEmulatedMediaParams) WithMedia(media string) *SetEmulatedMediaParams {
p.Media = media
return &p
}
// WithFeatures media features to emulate.
func (p SetEmulatedMediaParams) WithFeatures(features []*MediaFeature) *SetEmulatedMediaParams {
p.Features = features
return &p
}
// Do executes Emulation.setEmulatedMedia against the provided context.
func (p *SetEmulatedMediaParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetEmulatedMedia, p, nil)
}
// SetEmulatedVisionDeficiencyParams emulates the given vision deficiency.
type SetEmulatedVisionDeficiencyParams struct {
Type SetEmulatedVisionDeficiencyType `json:"type"` // Vision deficiency to emulate.
}
// SetEmulatedVisionDeficiency emulates the given vision deficiency.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedVisionDeficiency
//
// parameters:
// type - Vision deficiency to emulate.
func SetEmulatedVisionDeficiency(typeVal SetEmulatedVisionDeficiencyType) *SetEmulatedVisionDeficiencyParams {
return &SetEmulatedVisionDeficiencyParams{
Type: typeVal,
}
}
// Do executes Emulation.setEmulatedVisionDeficiency against the provided context.
func (p *SetEmulatedVisionDeficiencyParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetEmulatedVisionDeficiency, p, nil)
}
// SetGeolocationOverrideParams overrides the Geolocation Position or Error.
// Omitting any of the parameters emulates position unavailable.
type SetGeolocationOverrideParams struct {
Latitude float64 `json:"latitude,omitempty"` // Mock latitude
Longitude float64 `json:"longitude,omitempty"` // Mock longitude
Accuracy float64 `json:"accuracy,omitempty"` // Mock accuracy
}
// SetGeolocationOverride overrides the Geolocation Position or Error.
// Omitting any of the parameters emulates position unavailable.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setGeolocationOverride
//
// parameters:
func SetGeolocationOverride() *SetGeolocationOverrideParams {
return &SetGeolocationOverrideParams{}
}
// WithLatitude mock latitude.
func (p SetGeolocationOverrideParams) WithLatitude(latitude float64) *SetGeolocationOverrideParams {
p.Latitude = latitude
return &p
}
// WithLongitude mock longitude.
func (p SetGeolocationOverrideParams) WithLongitude(longitude float64) *SetGeolocationOverrideParams {
p.Longitude = longitude
return &p
}
// WithAccuracy mock accuracy.
func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeolocationOverrideParams {
p.Accuracy = accuracy
return &p
}
// Do executes Emulation.setGeolocationOverride against the provided context.
func (p *SetGeolocationOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetGeolocationOverride, p, nil)
}
// SetPageScaleFactorParams sets a specified page scale factor.
type SetPageScaleFactorParams struct {
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
}
// SetPageScaleFactor sets a specified page scale factor.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setPageScaleFactor
//
// parameters:
// pageScaleFactor - Page scale factor.
func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams {
return &SetPageScaleFactorParams{
PageScaleFactor: pageScaleFactor,
}
}
// Do executes Emulation.setPageScaleFactor against the provided context.
func (p *SetPageScaleFactorParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetPageScaleFactor, p, nil)
}
// SetScriptExecutionDisabledParams switches script execution in the page.
type SetScriptExecutionDisabledParams struct {
Value bool `json:"value"` // Whether script execution should be disabled in the page.
}
// SetScriptExecutionDisabled switches script execution in the page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setScriptExecutionDisabled
//
// parameters:
// value - Whether script execution should be disabled in the page.
func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams {
return &SetScriptExecutionDisabledParams{
Value: value,
}
}
// Do executes Emulation.setScriptExecutionDisabled against the provided context.
func (p *SetScriptExecutionDisabledParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetScriptExecutionDisabled, p, nil)
}
// SetTouchEmulationEnabledParams enables touch on platforms which do not
// support them.
type SetTouchEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
MaxTouchPoints int64 `json:"maxTouchPoints,omitempty"` // Maximum touch points supported. Defaults to one.
}
// SetTouchEmulationEnabled enables touch on platforms which do not support
// them.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setTouchEmulationEnabled
//
// parameters:
// enabled - Whether the touch event emulation should be enabled.
func SetTouchEmulationEnabled(enabled bool) *SetTouchEmulationEnabledParams {
return &SetTouchEmulationEnabledParams{
Enabled: enabled,
}
}
// WithMaxTouchPoints maximum touch points supported. Defaults to one.
func (p SetTouchEmulationEnabledParams) WithMaxTouchPoints(maxTouchPoints int64) *SetTouchEmulationEnabledParams {
p.MaxTouchPoints = maxTouchPoints
return &p
}
// Do executes Emulation.setTouchEmulationEnabled against the provided context.
func (p *SetTouchEmulationEnabledParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetTouchEmulationEnabled, p, nil)
}
// SetVirtualTimePolicyParams turns on virtual time for all frames (replacing
// real-time with a synthetic time source) and sets the current virtual time
// policy. Note this supersedes any previous time budget.
type SetVirtualTimePolicyParams struct {
Policy VirtualTimePolicy `json:"policy"`
Budget float64 `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
MaxVirtualTimeTaskStarvationCount int64 `json:"maxVirtualTimeTaskStarvationCount,omitempty"` // If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
WaitForNavigation bool `json:"waitForNavigation,omitempty"` // If set the virtual time policy change should be deferred until any frame starts navigating. Note any previous deferred policy change is superseded.
InitialVirtualTime *cdp.TimeSinceEpoch `json:"initialVirtualTime,omitempty"` // If set, base::Time::Now will be overridden to initially return this value.
}
// SetVirtualTimePolicy turns on virtual time for all frames (replacing
// real-time with a synthetic time source) and sets the current virtual time
// policy. Note this supersedes any previous time budget.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setVirtualTimePolicy
//
// parameters:
// policy
func SetVirtualTimePolicy(policy VirtualTimePolicy) *SetVirtualTimePolicyParams {
return &SetVirtualTimePolicyParams{
Policy: policy,
}
}
// WithBudget if set, after this many virtual milliseconds have elapsed
// virtual time will be paused and a virtualTimeBudgetExpired event is sent.
func (p SetVirtualTimePolicyParams) WithBudget(budget float64) *SetVirtualTimePolicyParams {
p.Budget = budget
return &p
}
// WithMaxVirtualTimeTaskStarvationCount if set this specifies the maximum
// number of tasks that can be run before virtual is forced forwards to prevent
// deadlock.
func (p SetVirtualTimePolicyParams) WithMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int64) *SetVirtualTimePolicyParams {
p.MaxVirtualTimeTaskStarvationCount = maxVirtualTimeTaskStarvationCount
return &p
}
// WithWaitForNavigation if set the virtual time policy change should be
// deferred until any frame starts navigating. Note any previous deferred policy
// change is superseded.
func (p SetVirtualTimePolicyParams) WithWaitForNavigation(waitForNavigation bool) *SetVirtualTimePolicyParams {
p.WaitForNavigation = waitForNavigation
return &p
}
// WithInitialVirtualTime if set, base::Time::Now will be overridden to
// initially return this value.
func (p SetVirtualTimePolicyParams) WithInitialVirtualTime(initialVirtualTime *cdp.TimeSinceEpoch) *SetVirtualTimePolicyParams {
p.InitialVirtualTime = initialVirtualTime
return &p
}
// SetVirtualTimePolicyReturns return values.
type SetVirtualTimePolicyReturns struct {
VirtualTimeTicksBase float64 `json:"virtualTimeTicksBase,omitempty"` // Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
}
// Do executes Emulation.setVirtualTimePolicy against the provided context.
//
// returns:
// virtualTimeTicksBase - Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
func (p *SetVirtualTimePolicyParams) Do(ctx context.Context) (virtualTimeTicksBase float64, err error) {
// execute
var res SetVirtualTimePolicyReturns
err = cdp.Execute(ctx, CommandSetVirtualTimePolicy, p, &res)
if err != nil {
return 0, err
}
return res.VirtualTimeTicksBase, nil
}
// SetLocaleOverrideParams overrides default host system locale with the
// specified one.
type SetLocaleOverrideParams struct {
Locale string `json:"locale,omitempty"` // ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
}
// SetLocaleOverride overrides default host system locale with the specified
// one.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setLocaleOverride
//
// parameters:
func SetLocaleOverride() *SetLocaleOverrideParams {
return &SetLocaleOverrideParams{}
}
// WithLocale iCU style C locale (e.g. "en_US"). If not specified or empty,
// disables the override and restores default host system locale.
func (p SetLocaleOverrideParams) WithLocale(locale string) *SetLocaleOverrideParams {
p.Locale = locale
return &p
}
// Do executes Emulation.setLocaleOverride against the provided context.
func (p *SetLocaleOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetLocaleOverride, p, nil)
}
// SetTimezoneOverrideParams overrides default host system timezone with the
// specified one.
type SetTimezoneOverrideParams struct {
TimezoneID string `json:"timezoneId"` // The timezone identifier. If empty, disables the override and restores default host system timezone.
}
// SetTimezoneOverride overrides default host system timezone with the
// specified one.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setTimezoneOverride
//
// parameters:
// timezoneID - The timezone identifier. If empty, disables the override and restores default host system timezone.
func SetTimezoneOverride(timezoneID string) *SetTimezoneOverrideParams {
return &SetTimezoneOverrideParams{
TimezoneID: timezoneID,
}
}
// Do executes Emulation.setTimezoneOverride against the provided context.
func (p *SetTimezoneOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetTimezoneOverride, p, nil)
}
// SetUserAgentOverrideParams allows overriding user agent with the given
// string.
type SetUserAgentOverrideParams struct {
UserAgent string `json:"userAgent"` // User agent to use.
AcceptLanguage string `json:"acceptLanguage,omitempty"` // Browser langugage to emulate.
Platform string `json:"platform,omitempty"` // The platform navigator.platform should return.
UserAgentMetadata *UserAgentMetadata `json:"userAgentMetadata,omitempty"` // To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
}
// SetUserAgentOverride allows overriding user agent with the given string.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setUserAgentOverride
//
// parameters:
// userAgent - User agent to use.
func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams {
return &SetUserAgentOverrideParams{
UserAgent: userAgent,
}
}
// WithAcceptLanguage browser langugage to emulate.
func (p SetUserAgentOverrideParams) WithAcceptLanguage(acceptLanguage string) *SetUserAgentOverrideParams {
p.AcceptLanguage = acceptLanguage
return &p
}
// WithPlatform the platform navigator.platform should return.
func (p SetUserAgentOverrideParams) WithPlatform(platform string) *SetUserAgentOverrideParams {
p.Platform = platform
return &p
}
// WithUserAgentMetadata to be sent in Sec-CH-UA-* headers and returned in
// navigator.userAgentData.
func (p SetUserAgentOverrideParams) WithUserAgentMetadata(userAgentMetadata *UserAgentMetadata) *SetUserAgentOverrideParams {
p.UserAgentMetadata = userAgentMetadata
return &p
}
// Do executes Emulation.setUserAgentOverride against the provided context.
func (p *SetUserAgentOverrideParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetUserAgentOverride, p, nil)
}
// Command names.
const (
CommandCanEmulate = "Emulation.canEmulate"
CommandClearDeviceMetricsOverride = "Emulation.clearDeviceMetricsOverride"
CommandClearGeolocationOverride = "Emulation.clearGeolocationOverride"
CommandResetPageScaleFactor = "Emulation.resetPageScaleFactor"
CommandSetFocusEmulationEnabled = "Emulation.setFocusEmulationEnabled"
CommandSetCPUThrottlingRate = "Emulation.setCPUThrottlingRate"
CommandSetDefaultBackgroundColorOverride = "Emulation.setDefaultBackgroundColorOverride"
CommandSetDeviceMetricsOverride = "Emulation.setDeviceMetricsOverride"
CommandSetScrollbarsHidden = "Emulation.setScrollbarsHidden"
CommandSetDocumentCookieDisabled = "Emulation.setDocumentCookieDisabled"
CommandSetEmitTouchEventsForMouse = "Emulation.setEmitTouchEventsForMouse"
CommandSetEmulatedMedia = "Emulation.setEmulatedMedia"
CommandSetEmulatedVisionDeficiency = "Emulation.setEmulatedVisionDeficiency"
CommandSetGeolocationOverride = "Emulation.setGeolocationOverride"
CommandSetPageScaleFactor = "Emulation.setPageScaleFactor"
CommandSetScriptExecutionDisabled = "Emulation.setScriptExecutionDisabled"
CommandSetTouchEmulationEnabled = "Emulation.setTouchEmulationEnabled"
CommandSetVirtualTimePolicy = "Emulation.setVirtualTimePolicy"
CommandSetLocaleOverride = "Emulation.setLocaleOverride"
CommandSetTimezoneOverride = "Emulation.setTimezoneOverride"
CommandSetUserAgentOverride = "Emulation.setUserAgentOverride"
)

View File

@@ -0,0 +1,9 @@
package emulation
// Code generated by cdproto-gen. DO NOT EDIT.
// EventVirtualTimeBudgetExpired notification sent after the virtual time
// budget for the current VirtualTimePolicy has run out.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#event-virtualTimeBudgetExpired
type EventVirtualTimeBudgetExpired struct{}

252
vendor/github.com/chromedp/cdproto/emulation/types.go generated vendored Normal file
View File

@@ -0,0 +1,252 @@
package emulation
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// ScreenOrientation screen orientation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenOrientation
type ScreenOrientation struct {
Type OrientationType `json:"type"` // Orientation type.
Angle int64 `json:"angle"` // Orientation angle.
}
// MediaFeature [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-MediaFeature
type MediaFeature struct {
Name string `json:"name"`
Value string `json:"value"`
}
// VirtualTimePolicy advance: If the scheduler runs out of immediate work,
// the virtual time base may fast forward to allow the next delayed task (if
// any) to run; pause: The virtual time base may not advance;
// pauseIfNetworkFetchesPending: The virtual time base may not advance if there
// are any pending resource fetches.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-VirtualTimePolicy
type VirtualTimePolicy string
// String returns the VirtualTimePolicy as string value.
func (t VirtualTimePolicy) String() string {
return string(t)
}
// VirtualTimePolicy values.
const (
VirtualTimePolicyAdvance VirtualTimePolicy = "advance"
VirtualTimePolicyPause VirtualTimePolicy = "pause"
VirtualTimePolicyPauseIfNetworkFetchesPending VirtualTimePolicy = "pauseIfNetworkFetchesPending"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t VirtualTimePolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t VirtualTimePolicy) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *VirtualTimePolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch VirtualTimePolicy(in.String()) {
case VirtualTimePolicyAdvance:
*t = VirtualTimePolicyAdvance
case VirtualTimePolicyPause:
*t = VirtualTimePolicyPause
case VirtualTimePolicyPauseIfNetworkFetchesPending:
*t = VirtualTimePolicyPauseIfNetworkFetchesPending
default:
in.AddError(errors.New("unknown VirtualTimePolicy value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *VirtualTimePolicy) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// UserAgentBrandVersion used to specify User Agent Cient Hints to emulate.
// See https://wicg.github.io/ua-client-hints.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-UserAgentBrandVersion
type UserAgentBrandVersion struct {
Brand string `json:"brand"`
Version string `json:"version"`
}
// UserAgentMetadata used to specify User Agent Cient Hints to emulate. See
// https://wicg.github.io/ua-client-hints.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-UserAgentMetadata
type UserAgentMetadata struct {
Brands []*UserAgentBrandVersion `json:"brands"`
FullVersion string `json:"fullVersion"`
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
Architecture string `json:"architecture"`
Model string `json:"model"`
Mobile bool `json:"mobile"`
}
// OrientationType orientation type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenOrientation
type OrientationType string
// String returns the OrientationType as string value.
func (t OrientationType) String() string {
return string(t)
}
// OrientationType values.
const (
OrientationTypePortraitPrimary OrientationType = "portraitPrimary"
OrientationTypePortraitSecondary OrientationType = "portraitSecondary"
OrientationTypeLandscapePrimary OrientationType = "landscapePrimary"
OrientationTypeLandscapeSecondary OrientationType = "landscapeSecondary"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t OrientationType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t OrientationType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *OrientationType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch OrientationType(in.String()) {
case OrientationTypePortraitPrimary:
*t = OrientationTypePortraitPrimary
case OrientationTypePortraitSecondary:
*t = OrientationTypePortraitSecondary
case OrientationTypeLandscapePrimary:
*t = OrientationTypeLandscapePrimary
case OrientationTypeLandscapeSecondary:
*t = OrientationTypeLandscapeSecondary
default:
in.AddError(errors.New("unknown OrientationType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *OrientationType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SetEmitTouchEventsForMouseConfiguration touch/gesture events
// configuration. Default: current platform.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmitTouchEventsForMouse
type SetEmitTouchEventsForMouseConfiguration string
// String returns the SetEmitTouchEventsForMouseConfiguration as string value.
func (t SetEmitTouchEventsForMouseConfiguration) String() string {
return string(t)
}
// SetEmitTouchEventsForMouseConfiguration values.
const (
SetEmitTouchEventsForMouseConfigurationMobile SetEmitTouchEventsForMouseConfiguration = "mobile"
SetEmitTouchEventsForMouseConfigurationDesktop SetEmitTouchEventsForMouseConfiguration = "desktop"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SetEmitTouchEventsForMouseConfiguration) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SetEmitTouchEventsForMouseConfiguration) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetEmitTouchEventsForMouseConfiguration(in.String()) {
case SetEmitTouchEventsForMouseConfigurationMobile:
*t = SetEmitTouchEventsForMouseConfigurationMobile
case SetEmitTouchEventsForMouseConfigurationDesktop:
*t = SetEmitTouchEventsForMouseConfigurationDesktop
default:
in.AddError(errors.New("unknown SetEmitTouchEventsForMouseConfiguration value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SetEmulatedVisionDeficiencyType vision deficiency to emulate.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedVisionDeficiency
type SetEmulatedVisionDeficiencyType string
// String returns the SetEmulatedVisionDeficiencyType as string value.
func (t SetEmulatedVisionDeficiencyType) String() string {
return string(t)
}
// SetEmulatedVisionDeficiencyType values.
const (
SetEmulatedVisionDeficiencyTypeNone SetEmulatedVisionDeficiencyType = "none"
SetEmulatedVisionDeficiencyTypeAchromatopsia SetEmulatedVisionDeficiencyType = "achromatopsia"
SetEmulatedVisionDeficiencyTypeBlurredVision SetEmulatedVisionDeficiencyType = "blurredVision"
SetEmulatedVisionDeficiencyTypeDeuteranopia SetEmulatedVisionDeficiencyType = "deuteranopia"
SetEmulatedVisionDeficiencyTypeProtanopia SetEmulatedVisionDeficiencyType = "protanopia"
SetEmulatedVisionDeficiencyTypeTritanopia SetEmulatedVisionDeficiencyType = "tritanopia"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SetEmulatedVisionDeficiencyType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SetEmulatedVisionDeficiencyType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SetEmulatedVisionDeficiencyType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetEmulatedVisionDeficiencyType(in.String()) {
case SetEmulatedVisionDeficiencyTypeNone:
*t = SetEmulatedVisionDeficiencyTypeNone
case SetEmulatedVisionDeficiencyTypeAchromatopsia:
*t = SetEmulatedVisionDeficiencyTypeAchromatopsia
case SetEmulatedVisionDeficiencyTypeBlurredVision:
*t = SetEmulatedVisionDeficiencyTypeBlurredVision
case SetEmulatedVisionDeficiencyTypeDeuteranopia:
*t = SetEmulatedVisionDeficiencyTypeDeuteranopia
case SetEmulatedVisionDeficiencyTypeProtanopia:
*t = SetEmulatedVisionDeficiencyTypeProtanopia
case SetEmulatedVisionDeficiencyTypeTritanopia:
*t = SetEmulatedVisionDeficiencyTypeTritanopia
default:
in.AddError(errors.New("unknown SetEmulatedVisionDeficiencyType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SetEmulatedVisionDeficiencyType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

1540
vendor/github.com/chromedp/cdproto/fetch/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

40
vendor/github.com/chromedp/cdproto/fetch/events.go generated vendored Normal file
View File

@@ -0,0 +1,40 @@
package fetch
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/network"
)
// EventRequestPaused issued when the domain is enabled and the request URL
// matches the specified filter. The request is paused until the client responds
// with one of continueRequest, failRequest or fulfillRequest. The stage of the
// request can be determined by presence of responseErrorReason and
// responseStatusCode -- the request is at the response stage if either of these
// fields is present and in the request stage otherwise.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#event-requestPaused
type EventRequestPaused struct {
RequestID RequestID `json:"requestId"` // Each request the page makes will have a unique id.
Request *network.Request `json:"request"` // The details of the request.
FrameID cdp.FrameID `json:"frameId"` // The id of the frame that initiated the request.
ResourceType network.ResourceType `json:"resourceType"` // How the requested resource will be used.
ResponseErrorReason network.ErrorReason `json:"responseErrorReason,omitempty"` // Response error if intercepted at response stage.
ResponseStatusCode int64 `json:"responseStatusCode,omitempty"` // Response code if intercepted at response stage.
ResponseHeaders []*HeaderEntry `json:"responseHeaders,omitempty"` // Response headers if intercepted at the response stage.
NetworkID RequestID `json:"networkId,omitempty"` // If the intercepted request had a corresponding Network.requestWillBeSent event fired for it, then this networkId will be the same as the requestId present in the requestWillBeSent event.
}
// EventAuthRequired issued when the domain is enabled with
// handleAuthRequests set to true. The request is paused until client responds
// with continueWithAuth.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#event-authRequired
type EventAuthRequired struct {
RequestID RequestID `json:"requestId"` // Each request the page makes will have a unique id.
Request *network.Request `json:"request"` // The details of the request.
FrameID cdp.FrameID `json:"frameId"` // The id of the frame that initiated the request.
ResourceType network.ResourceType `json:"resourceType"` // How the requested resource will be used.
AuthChallenge *AuthChallenge `json:"authChallenge"` // Details of the Authorization Challenge encountered. If this is set, client should respond with continueRequest that contains AuthChallengeResponse.
}

356
vendor/github.com/chromedp/cdproto/fetch/fetch.go generated vendored Normal file
View File

@@ -0,0 +1,356 @@
// Package fetch provides the Chrome DevTools Protocol
// commands, types, and events for the Fetch domain.
//
// A domain for letting clients substitute browser's network layer with
// client code.
//
// Generated by the cdproto-gen command.
package fetch
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"encoding/base64"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/io"
"github.com/chromedp/cdproto/network"
)
// DisableParams disables the fetch domain.
type DisableParams struct{}
// Disable disables the fetch domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Fetch.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables issuing of requestPaused events. A request will be
// paused until client calls one of failRequest, fulfillRequest or
// continueRequest/continueWithAuth.
type EnableParams struct {
Patterns []*RequestPattern `json:"patterns,omitempty"` // If specified, only requests matching any of these patterns will produce fetchRequested event and will be paused until clients response. If not set, all requests will be affected.
HandleAuthRequests bool `json:"handleAuthRequests,omitempty"` // If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.
}
// Enable enables issuing of requestPaused events. A request will be paused
// until client calls one of failRequest, fulfillRequest or
// continueRequest/continueWithAuth.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-enable
//
// parameters:
func Enable() *EnableParams {
return &EnableParams{}
}
// WithPatterns if specified, only requests matching any of these patterns
// will produce fetchRequested event and will be paused until clients response.
// If not set, all requests will be affected.
func (p EnableParams) WithPatterns(patterns []*RequestPattern) *EnableParams {
p.Patterns = patterns
return &p
}
// WithHandleAuthRequests if true, authRequired events will be issued and
// requests will be paused expecting a call to continueWithAuth.
func (p EnableParams) WithHandleAuthRequests(handleAuthRequests bool) *EnableParams {
p.HandleAuthRequests = handleAuthRequests
return &p
}
// Do executes Fetch.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, p, nil)
}
// FailRequestParams causes the request to fail with specified reason.
type FailRequestParams struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
ErrorReason network.ErrorReason `json:"errorReason"` // Causes the request to fail with the given reason.
}
// FailRequest causes the request to fail with specified reason.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-failRequest
//
// parameters:
// requestID - An id the client received in requestPaused event.
// errorReason - Causes the request to fail with the given reason.
func FailRequest(requestID RequestID, errorReason network.ErrorReason) *FailRequestParams {
return &FailRequestParams{
RequestID: requestID,
ErrorReason: errorReason,
}
}
// Do executes Fetch.failRequest against the provided context.
func (p *FailRequestParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandFailRequest, p, nil)
}
// FulfillRequestParams provides response to the request.
type FulfillRequestParams struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
ResponseCode int64 `json:"responseCode"` // An HTTP response code.
ResponseHeaders []*HeaderEntry `json:"responseHeaders,omitempty"` // Response headers.
BinaryResponseHeaders string `json:"binaryResponseHeaders,omitempty"` // Alternative way of specifying response headers as a \0-separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text.
Body string `json:"body,omitempty"` // A response body.
ResponsePhrase string `json:"responsePhrase,omitempty"` // A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
}
// FulfillRequest provides response to the request.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-fulfillRequest
//
// parameters:
// requestID - An id the client received in requestPaused event.
// responseCode - An HTTP response code.
func FulfillRequest(requestID RequestID, responseCode int64) *FulfillRequestParams {
return &FulfillRequestParams{
RequestID: requestID,
ResponseCode: responseCode,
}
}
// WithResponseHeaders response headers.
func (p FulfillRequestParams) WithResponseHeaders(responseHeaders []*HeaderEntry) *FulfillRequestParams {
p.ResponseHeaders = responseHeaders
return &p
}
// WithBinaryResponseHeaders alternative way of specifying response headers
// as a \0-separated series of name: value pairs. Prefer the above method unless
// you need to represent some non-UTF8 values that can't be transmitted over the
// protocol as text.
func (p FulfillRequestParams) WithBinaryResponseHeaders(binaryResponseHeaders string) *FulfillRequestParams {
p.BinaryResponseHeaders = binaryResponseHeaders
return &p
}
// WithBody a response body.
func (p FulfillRequestParams) WithBody(body string) *FulfillRequestParams {
p.Body = body
return &p
}
// WithResponsePhrase a textual representation of responseCode. If absent, a
// standard phrase matching responseCode is used.
func (p FulfillRequestParams) WithResponsePhrase(responsePhrase string) *FulfillRequestParams {
p.ResponsePhrase = responsePhrase
return &p
}
// Do executes Fetch.fulfillRequest against the provided context.
func (p *FulfillRequestParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandFulfillRequest, p, nil)
}
// ContinueRequestParams continues the request, optionally modifying some of
// its parameters.
type ContinueRequestParams struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
URL string `json:"url,omitempty"` // If set, the request url will be modified in a way that's not observable by page.
Method string `json:"method,omitempty"` // If set, the request method is overridden.
PostData string `json:"postData,omitempty"` // If set, overrides the post data in the request.
Headers []*HeaderEntry `json:"headers,omitempty"` // If set, overrides the request headers.
}
// ContinueRequest continues the request, optionally modifying some of its
// parameters.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueRequest
//
// parameters:
// requestID - An id the client received in requestPaused event.
func ContinueRequest(requestID RequestID) *ContinueRequestParams {
return &ContinueRequestParams{
RequestID: requestID,
}
}
// WithURL if set, the request url will be modified in a way that's not
// observable by page.
func (p ContinueRequestParams) WithURL(url string) *ContinueRequestParams {
p.URL = url
return &p
}
// WithMethod if set, the request method is overridden.
func (p ContinueRequestParams) WithMethod(method string) *ContinueRequestParams {
p.Method = method
return &p
}
// WithPostData if set, overrides the post data in the request.
func (p ContinueRequestParams) WithPostData(postData string) *ContinueRequestParams {
p.PostData = postData
return &p
}
// WithHeaders if set, overrides the request headers.
func (p ContinueRequestParams) WithHeaders(headers []*HeaderEntry) *ContinueRequestParams {
p.Headers = headers
return &p
}
// Do executes Fetch.continueRequest against the provided context.
func (p *ContinueRequestParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandContinueRequest, p, nil)
}
// ContinueWithAuthParams continues a request supplying authChallengeResponse
// following authRequired event.
type ContinueWithAuthParams struct {
RequestID RequestID `json:"requestId"` // An id the client received in authRequired event.
AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse"` // Response to with an authChallenge.
}
// ContinueWithAuth continues a request supplying authChallengeResponse
// following authRequired event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueWithAuth
//
// parameters:
// requestID - An id the client received in authRequired event.
// authChallengeResponse - Response to with an authChallenge.
func ContinueWithAuth(requestID RequestID, authChallengeResponse *AuthChallengeResponse) *ContinueWithAuthParams {
return &ContinueWithAuthParams{
RequestID: requestID,
AuthChallengeResponse: authChallengeResponse,
}
}
// Do executes Fetch.continueWithAuth against the provided context.
func (p *ContinueWithAuthParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandContinueWithAuth, p, nil)
}
// GetResponseBodyParams causes the body of the response to be received from
// the server and returned as a single string. May only be issued for a request
// that is paused in the Response stage and is mutually exclusive with
// takeResponseBodyForInterceptionAsStream. Calling other methods that affect
// the request or disabling fetch domain before body is received results in an
// undefined behavior.
type GetResponseBodyParams struct {
RequestID RequestID `json:"requestId"` // Identifier for the intercepted request to get body for.
}
// GetResponseBody causes the body of the response to be received from the
// server and returned as a single string. May only be issued for a request that
// is paused in the Response stage and is mutually exclusive with
// takeResponseBodyForInterceptionAsStream. Calling other methods that affect
// the request or disabling fetch domain before body is received results in an
// undefined behavior.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-getResponseBody
//
// parameters:
// requestID - Identifier for the intercepted request to get body for.
func GetResponseBody(requestID RequestID) *GetResponseBodyParams {
return &GetResponseBodyParams{
RequestID: requestID,
}
}
// GetResponseBodyReturns return values.
type GetResponseBodyReturns struct {
Body string `json:"body,omitempty"` // Response body.
Base64encoded bool `json:"base64Encoded,omitempty"` // True, if content was sent as base64.
}
// Do executes Fetch.getResponseBody against the provided context.
//
// returns:
// body - Response body.
func (p *GetResponseBodyParams) Do(ctx context.Context) (body []byte, err error) {
// execute
var res GetResponseBodyReturns
err = cdp.Execute(ctx, CommandGetResponseBody, p, &res)
if err != nil {
return nil, err
}
// decode
var dec []byte
if res.Base64encoded {
dec, err = base64.StdEncoding.DecodeString(res.Body)
if err != nil {
return nil, err
}
} else {
dec = []byte(res.Body)
}
return dec, nil
}
// TakeResponseBodyAsStreamParams returns a handle to the stream representing
// the response body. The request must be paused in the HeadersReceived stage.
// Note that after this command the request can't be continued as is -- client
// either needs to cancel it or to provide the response body. The stream only
// supports sequential read, IO.read will fail if the position is specified.
// This method is mutually exclusive with getResponseBody. Calling other methods
// that affect the request or disabling fetch domain before body is received
// results in an undefined behavior.
type TakeResponseBodyAsStreamParams struct {
RequestID RequestID `json:"requestId"`
}
// TakeResponseBodyAsStream returns a handle to the stream representing the
// response body. The request must be paused in the HeadersReceived stage. Note
// that after this command the request can't be continued as is -- client either
// needs to cancel it or to provide the response body. The stream only supports
// sequential read, IO.read will fail if the position is specified. This method
// is mutually exclusive with getResponseBody. Calling other methods that affect
// the request or disabling fetch domain before body is received results in an
// undefined behavior.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-takeResponseBodyAsStream
//
// parameters:
// requestID
func TakeResponseBodyAsStream(requestID RequestID) *TakeResponseBodyAsStreamParams {
return &TakeResponseBodyAsStreamParams{
RequestID: requestID,
}
}
// TakeResponseBodyAsStreamReturns return values.
type TakeResponseBodyAsStreamReturns struct {
Stream io.StreamHandle `json:"stream,omitempty"`
}
// Do executes Fetch.takeResponseBodyAsStream against the provided context.
//
// returns:
// stream
func (p *TakeResponseBodyAsStreamParams) Do(ctx context.Context) (stream io.StreamHandle, err error) {
// execute
var res TakeResponseBodyAsStreamReturns
err = cdp.Execute(ctx, CommandTakeResponseBodyAsStream, p, &res)
if err != nil {
return "", err
}
return res.Stream, nil
}
// Command names.
const (
CommandDisable = "Fetch.disable"
CommandEnable = "Fetch.enable"
CommandFailRequest = "Fetch.failRequest"
CommandFulfillRequest = "Fetch.fulfillRequest"
CommandContinueRequest = "Fetch.continueRequest"
CommandContinueWithAuth = "Fetch.continueWithAuth"
CommandGetResponseBody = "Fetch.getResponseBody"
CommandTakeResponseBodyAsStream = "Fetch.takeResponseBodyAsStream"
)

198
vendor/github.com/chromedp/cdproto/fetch/types.go generated vendored Normal file
View File

@@ -0,0 +1,198 @@
package fetch
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/chromedp/cdproto/network"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// RequestID unique request identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestId
type RequestID string
// String returns the RequestID as string value.
func (t RequestID) String() string {
return string(t)
}
// RequestStage stages of the request to handle. Request will intercept
// before the request is sent. Response will intercept after the response is
// received (but before response body is received.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestStage
type RequestStage string
// String returns the RequestStage as string value.
func (t RequestStage) String() string {
return string(t)
}
// RequestStage values.
const (
RequestStageRequest RequestStage = "Request"
RequestStageResponse RequestStage = "Response"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t RequestStage) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t RequestStage) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *RequestStage) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch RequestStage(in.String()) {
case RequestStageRequest:
*t = RequestStageRequest
case RequestStageResponse:
*t = RequestStageResponse
default:
in.AddError(errors.New("unknown RequestStage value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *RequestStage) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// RequestPattern [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestPattern
type RequestPattern struct {
URLPattern string `json:"urlPattern,omitempty"` // Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to "*".
ResourceType network.ResourceType `json:"resourceType,omitempty"` // If set, only requests for matching resource types will be intercepted.
RequestStage RequestStage `json:"requestStage,omitempty"` // Stage at which to begin intercepting requests. Default is Request.
}
// HeaderEntry response HTTP header entry.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-HeaderEntry
type HeaderEntry struct {
Name string `json:"name"`
Value string `json:"value"`
}
// AuthChallenge authorization challenge for HTTP status code 401 or 407.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallenge
type AuthChallenge struct {
Source AuthChallengeSource `json:"source,omitempty"` // Source of the authentication challenge.
Origin string `json:"origin"` // Origin of the challenger.
Scheme string `json:"scheme"` // The authentication scheme used, such as basic or digest
Realm string `json:"realm"` // The realm of the challenge. May be empty.
}
// AuthChallengeResponse response to an AuthChallenge.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallengeResponse
type AuthChallengeResponse struct {
Response AuthChallengeResponseResponse `json:"response"` // The decision on what to do in response to the authorization challenge. Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box.
Username string `json:"username,omitempty"` // The username to provide, possibly empty. Should only be set if response is ProvideCredentials.
Password string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
}
// AuthChallengeSource source of the authentication challenge.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallenge
type AuthChallengeSource string
// String returns the AuthChallengeSource as string value.
func (t AuthChallengeSource) String() string {
return string(t)
}
// AuthChallengeSource values.
const (
AuthChallengeSourceServer AuthChallengeSource = "Server"
AuthChallengeSourceProxy AuthChallengeSource = "Proxy"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeSource) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeSource) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeSource(in.String()) {
case AuthChallengeSourceServer:
*t = AuthChallengeSourceServer
case AuthChallengeSourceProxy:
*t = AuthChallengeSourceProxy
default:
in.AddError(errors.New("unknown AuthChallengeSource value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AuthChallengeResponseResponse the decision on what to do in response to
// the authorization challenge. Default means deferring to the default behavior
// of the net stack, which will likely either the Cancel authentication or
// display a popup dialog box.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-AuthChallengeResponse
type AuthChallengeResponseResponse string
// String returns the AuthChallengeResponseResponse as string value.
func (t AuthChallengeResponseResponse) String() string {
return string(t)
}
// AuthChallengeResponseResponse values.
const (
AuthChallengeResponseResponseDefault AuthChallengeResponseResponse = "Default"
AuthChallengeResponseResponseCancelAuth AuthChallengeResponseResponse = "CancelAuth"
AuthChallengeResponseResponseProvideCredentials AuthChallengeResponseResponse = "ProvideCredentials"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeResponseResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeResponseResponse) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeResponseResponse(in.String()) {
case AuthChallengeResponseResponseDefault:
*t = AuthChallengeResponseResponseDefault
case AuthChallengeResponseResponseCancelAuth:
*t = AuthChallengeResponseResponseCancelAuth
case AuthChallengeResponseResponseProvideCredentials:
*t = AuthChallengeResponseResponseProvideCredentials
default:
in.AddError(errors.New("unknown AuthChallengeResponseResponse value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

8
vendor/github.com/chromedp/cdproto/go.mod generated vendored Normal file
View File

@@ -0,0 +1,8 @@
module github.com/chromedp/cdproto
require (
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08
github.com/mailru/easyjson v0.7.1
)
go 1.14

4
vendor/github.com/chromedp/cdproto/go.sum generated vendored Normal file
View File

@@ -0,0 +1,4 @@
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08 h1:V0an7KRw92wmJysvFvtqtKMAPmvS5O0jtB0nYo6t+gs=
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08/go.mod h1:dFWs1zEqDjFtnBXsd1vPOZaLsESovai349994nHx3e0=
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=

View File

@@ -0,0 +1,406 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package headlessexperimental
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 easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(in *jlexer.Lexer, out *ScreenshotParams) {
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 "format":
(out.Format).UnmarshalEasyJSON(in)
case "quality":
out.Quality = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(out *jwriter.Writer, in ScreenshotParams) {
out.RawByte('{')
first := true
_ = first
if in.Format != "" {
const prefix string = ",\"format\":"
first = false
out.RawString(prefix[1:])
(in.Format).MarshalEasyJSON(out)
}
if in.Quality != 0 {
const prefix string = ",\"quality\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Quality))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ScreenshotParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ScreenshotParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental3(in *jlexer.Lexer, out *BeginFrameReturns) {
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 "hasDamage":
out.HasDamage = bool(in.Bool())
case "screenshotData":
out.ScreenshotData = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental3(out *jwriter.Writer, in BeginFrameReturns) {
out.RawByte('{')
first := true
_ = first
if in.HasDamage {
const prefix string = ",\"hasDamage\":"
first = false
out.RawString(prefix[1:])
out.Bool(bool(in.HasDamage))
}
if in.ScreenshotData != "" {
const prefix string = ",\"screenshotData\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.ScreenshotData))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v BeginFrameReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v BeginFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *BeginFrameReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BeginFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental3(l, v)
}
func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental4(in *jlexer.Lexer, out *BeginFrameParams) {
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 "frameTimeTicks":
out.FrameTimeTicks = float64(in.Float64())
case "interval":
out.Interval = float64(in.Float64())
case "noDisplayUpdates":
out.NoDisplayUpdates = bool(in.Bool())
case "screenshot":
if in.IsNull() {
in.Skip()
out.Screenshot = nil
} else {
if out.Screenshot == nil {
out.Screenshot = new(ScreenshotParams)
}
(*out.Screenshot).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental4(out *jwriter.Writer, in BeginFrameParams) {
out.RawByte('{')
first := true
_ = first
if in.FrameTimeTicks != 0 {
const prefix string = ",\"frameTimeTicks\":"
first = false
out.RawString(prefix[1:])
out.Float64(float64(in.FrameTimeTicks))
}
if in.Interval != 0 {
const prefix string = ",\"interval\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Interval))
}
if in.NoDisplayUpdates {
const prefix string = ",\"noDisplayUpdates\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.NoDisplayUpdates))
}
if in.Screenshot != nil {
const prefix string = ",\"screenshot\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Screenshot).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v BeginFrameParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v BeginFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *BeginFrameParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BeginFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental4(l, v)
}

View File

@@ -0,0 +1,140 @@
// Package headlessexperimental provides the Chrome DevTools Protocol
// commands, types, and events for the HeadlessExperimental domain.
//
// This domain provides experimental commands only supported in headless
// mode.
//
// Generated by the cdproto-gen command.
package headlessexperimental
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"encoding/base64"
"github.com/chromedp/cdproto/cdp"
)
// BeginFrameParams sends a BeginFrame to the target and returns when the
// frame was completed. Optionally captures a screenshot from the resulting
// frame. Requires that the target was created with enabled BeginFrameControl.
// Designed for use with --run-all-compositor-stages-before-draw, see also
// https://goo.gl/3zHXhB for more background.
type BeginFrameParams struct {
FrameTimeTicks float64 `json:"frameTimeTicks,omitempty"` // Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
Interval float64 `json:"interval,omitempty"` // The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
NoDisplayUpdates bool `json:"noDisplayUpdates,omitempty"` // Whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.
Screenshot *ScreenshotParams `json:"screenshot,omitempty"` // If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.
}
// BeginFrame sends a BeginFrame to the target and returns when the frame was
// completed. Optionally captures a screenshot from the resulting frame.
// Requires that the target was created with enabled BeginFrameControl. Designed
// for use with --run-all-compositor-stages-before-draw, see also
// https://goo.gl/3zHXhB for more background.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#method-beginFrame
//
// parameters:
func BeginFrame() *BeginFrameParams {
return &BeginFrameParams{}
}
// WithFrameTimeTicks timestamp of this BeginFrame in Renderer TimeTicks
// (milliseconds of uptime). If not set, the current time will be used.
func (p BeginFrameParams) WithFrameTimeTicks(frameTimeTicks float64) *BeginFrameParams {
p.FrameTimeTicks = frameTimeTicks
return &p
}
// WithInterval the interval between BeginFrames that is reported to the
// compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e.
// about 16.666 milliseconds.
func (p BeginFrameParams) WithInterval(interval float64) *BeginFrameParams {
p.Interval = interval
return &p
}
// WithNoDisplayUpdates whether updates should not be committed and drawn
// onto the display. False by default. If true, only side effects of the
// BeginFrame will be run, such as layout and animations, but any visual updates
// may not be visible on the display or in screenshots.
func (p BeginFrameParams) WithNoDisplayUpdates(noDisplayUpdates bool) *BeginFrameParams {
p.NoDisplayUpdates = noDisplayUpdates
return &p
}
// WithScreenshot if set, a screenshot of the frame will be captured and
// returned in the response. Otherwise, no screenshot will be captured. Note
// that capturing a screenshot can fail, for example, during renderer
// initialization. In such a case, no screenshot data will be returned.
func (p BeginFrameParams) WithScreenshot(screenshot *ScreenshotParams) *BeginFrameParams {
p.Screenshot = screenshot
return &p
}
// BeginFrameReturns return values.
type BeginFrameReturns struct {
HasDamage bool `json:"hasDamage,omitempty"` // Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
ScreenshotData string `json:"screenshotData,omitempty"` // Base64-encoded image data of the screenshot, if one was requested and successfully taken.
}
// Do executes HeadlessExperimental.beginFrame against the provided context.
//
// returns:
// hasDamage - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
// screenshotData - Base64-encoded image data of the screenshot, if one was requested and successfully taken.
func (p *BeginFrameParams) Do(ctx context.Context) (hasDamage bool, screenshotData []byte, err error) {
// execute
var res BeginFrameReturns
err = cdp.Execute(ctx, CommandBeginFrame, p, &res)
if err != nil {
return false, nil, err
}
// decode
var dec []byte
dec, err = base64.StdEncoding.DecodeString(res.ScreenshotData)
if err != nil {
return false, nil, err
}
return res.HasDamage, dec, nil
}
// DisableParams disables headless events for the target.
type DisableParams struct{}
// Disable disables headless events for the target.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes HeadlessExperimental.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables headless events for the target.
type EnableParams struct{}
// Enable enables headless events for the target.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes HeadlessExperimental.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// Command names.
const (
CommandBeginFrame = "HeadlessExperimental.beginFrame"
CommandDisable = "HeadlessExperimental.disable"
CommandEnable = "HeadlessExperimental.enable"
)

View File

@@ -0,0 +1,63 @@
package headlessexperimental
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// ScreenshotParams encoding options for a screenshot.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#type-ScreenshotParams
type ScreenshotParams struct {
Format ScreenshotParamsFormat `json:"format,omitempty"` // Image compression format (defaults to png).
Quality int64 `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
}
// ScreenshotParamsFormat image compression format (defaults to png).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#type-ScreenshotParams
type ScreenshotParamsFormat string
// String returns the ScreenshotParamsFormat as string value.
func (t ScreenshotParamsFormat) String() string {
return string(t)
}
// ScreenshotParamsFormat values.
const (
ScreenshotParamsFormatJpeg ScreenshotParamsFormat = "jpeg"
ScreenshotParamsFormatPng ScreenshotParamsFormat = "png"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScreenshotParamsFormat) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScreenshotParamsFormat) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScreenshotParamsFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScreenshotParamsFormat(in.String()) {
case ScreenshotParamsFormatJpeg:
*t = ScreenshotParamsFormatJpeg
case ScreenshotParamsFormatPng:
*t = ScreenshotParamsFormatPng
default:
in.AddError(errors.New("unknown ScreenshotParamsFormat value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScreenshotParamsFormat) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
package heapprofiler
// Code generated by cdproto-gen. DO NOT EDIT.
// EventAddHeapSnapshotChunk [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#event-addHeapSnapshotChunk
type EventAddHeapSnapshotChunk struct {
Chunk string `json:"chunk"`
}
// EventHeapStatsUpdate if heap objects tracking has been started then
// backend may send update for one or more fragments.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#event-heapStatsUpdate
type EventHeapStatsUpdate struct {
StatsUpdate []int64 `json:"statsUpdate"` // An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
}
// EventLastSeenObjectID if heap objects tracking has been started then
// backend regularly sends a current value for last seen object id and
// corresponding timestamp. If the were changes in the heap since last event
// then one or more heapStatsUpdate events will be sent before a new
// lastSeenObjectId event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#event-lastSeenObjectId
type EventLastSeenObjectID struct {
LastSeenObjectID int64 `json:"lastSeenObjectId"`
Timestamp float64 `json:"timestamp"`
}
// EventReportHeapSnapshotProgress [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#event-reportHeapSnapshotProgress
type EventReportHeapSnapshotProgress struct {
Done int64 `json:"done"`
Total int64 `json:"total"`
Finished bool `json:"finished,omitempty"`
}
// EventResetProfiles [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#event-resetProfiles
type EventResetProfiles struct{}

View File

@@ -0,0 +1,359 @@
// Package heapprofiler provides the Chrome DevTools Protocol
// commands, types, and events for the HeapProfiler domain.
//
// Generated by the cdproto-gen command.
package heapprofiler
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
)
// AddInspectedHeapObjectParams enables console to refer to the node with
// given id via $x (see Command Line API for more details $x functions).
type AddInspectedHeapObjectParams struct {
HeapObjectID HeapSnapshotObjectID `json:"heapObjectId"` // Heap snapshot object id to be accessible by means of $x command line API.
}
// AddInspectedHeapObject enables console to refer to the node with given id
// via $x (see Command Line API for more details $x functions).
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-addInspectedHeapObject
//
// parameters:
// heapObjectID - Heap snapshot object id to be accessible by means of $x command line API.
func AddInspectedHeapObject(heapObjectID HeapSnapshotObjectID) *AddInspectedHeapObjectParams {
return &AddInspectedHeapObjectParams{
HeapObjectID: heapObjectID,
}
}
// Do executes HeapProfiler.addInspectedHeapObject against the provided context.
func (p *AddInspectedHeapObjectParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandAddInspectedHeapObject, p, nil)
}
// CollectGarbageParams [no description].
type CollectGarbageParams struct{}
// CollectGarbage [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-collectGarbage
func CollectGarbage() *CollectGarbageParams {
return &CollectGarbageParams{}
}
// Do executes HeapProfiler.collectGarbage against the provided context.
func (p *CollectGarbageParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandCollectGarbage, nil, nil)
}
// DisableParams [no description].
type DisableParams struct{}
// Disable [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes HeapProfiler.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams [no description].
type EnableParams struct{}
// Enable [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes HeapProfiler.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetHeapObjectIDParams [no description].
type GetHeapObjectIDParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to get heap object id for.
}
// GetHeapObjectID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-getHeapObjectId
//
// parameters:
// objectID - Identifier of the object to get heap object id for.
func GetHeapObjectID(objectID runtime.RemoteObjectID) *GetHeapObjectIDParams {
return &GetHeapObjectIDParams{
ObjectID: objectID,
}
}
// GetHeapObjectIDReturns return values.
type GetHeapObjectIDReturns struct {
HeapSnapshotObjectID HeapSnapshotObjectID `json:"heapSnapshotObjectId,omitempty"` // Id of the heap snapshot object corresponding to the passed remote object id.
}
// Do executes HeapProfiler.getHeapObjectId against the provided context.
//
// returns:
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
func (p *GetHeapObjectIDParams) Do(ctx context.Context) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
// execute
var res GetHeapObjectIDReturns
err = cdp.Execute(ctx, CommandGetHeapObjectID, p, &res)
if err != nil {
return "", err
}
return res.HeapSnapshotObjectID, nil
}
// GetObjectByHeapObjectIDParams [no description].
type GetObjectByHeapObjectIDParams struct {
ObjectID HeapSnapshotObjectID `json:"objectId"`
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
}
// GetObjectByHeapObjectID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-getObjectByHeapObjectId
//
// parameters:
// objectID
func GetObjectByHeapObjectID(objectID HeapSnapshotObjectID) *GetObjectByHeapObjectIDParams {
return &GetObjectByHeapObjectIDParams{
ObjectID: objectID,
}
}
// WithObjectGroup symbolic group name that can be used to release multiple
// objects.
func (p GetObjectByHeapObjectIDParams) WithObjectGroup(objectGroup string) *GetObjectByHeapObjectIDParams {
p.ObjectGroup = objectGroup
return &p
}
// GetObjectByHeapObjectIDReturns return values.
type GetObjectByHeapObjectIDReturns struct {
Result *runtime.RemoteObject `json:"result,omitempty"` // Evaluation result.
}
// Do executes HeapProfiler.getObjectByHeapObjectId against the provided context.
//
// returns:
// result - Evaluation result.
func (p *GetObjectByHeapObjectIDParams) Do(ctx context.Context) (result *runtime.RemoteObject, err error) {
// execute
var res GetObjectByHeapObjectIDReturns
err = cdp.Execute(ctx, CommandGetObjectByHeapObjectID, p, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}
// GetSamplingProfileParams [no description].
type GetSamplingProfileParams struct{}
// GetSamplingProfile [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-getSamplingProfile
func GetSamplingProfile() *GetSamplingProfileParams {
return &GetSamplingProfileParams{}
}
// GetSamplingProfileReturns return values.
type GetSamplingProfileReturns struct {
Profile *SamplingHeapProfile `json:"profile,omitempty"` // Return the sampling profile being collected.
}
// Do executes HeapProfiler.getSamplingProfile against the provided context.
//
// returns:
// profile - Return the sampling profile being collected.
func (p *GetSamplingProfileParams) Do(ctx context.Context) (profile *SamplingHeapProfile, err error) {
// execute
var res GetSamplingProfileReturns
err = cdp.Execute(ctx, CommandGetSamplingProfile, nil, &res)
if err != nil {
return nil, err
}
return res.Profile, nil
}
// StartSamplingParams [no description].
type StartSamplingParams struct {
SamplingInterval float64 `json:"samplingInterval,omitempty"` // Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
}
// StartSampling [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-startSampling
//
// parameters:
func StartSampling() *StartSamplingParams {
return &StartSamplingParams{}
}
// WithSamplingInterval average sample interval in bytes. Poisson
// distribution is used for the intervals. The default value is 32768 bytes.
func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *StartSamplingParams {
p.SamplingInterval = samplingInterval
return &p
}
// Do executes HeapProfiler.startSampling against the provided context.
func (p *StartSamplingParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStartSampling, p, nil)
}
// StartTrackingHeapObjectsParams [no description].
type StartTrackingHeapObjectsParams struct {
TrackAllocations bool `json:"trackAllocations,omitempty"`
}
// StartTrackingHeapObjects [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-startTrackingHeapObjects
//
// parameters:
func StartTrackingHeapObjects() *StartTrackingHeapObjectsParams {
return &StartTrackingHeapObjectsParams{}
}
// WithTrackAllocations [no description].
func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bool) *StartTrackingHeapObjectsParams {
p.TrackAllocations = trackAllocations
return &p
}
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context.
func (p *StartTrackingHeapObjectsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStartTrackingHeapObjects, p, nil)
}
// StopSamplingParams [no description].
type StopSamplingParams struct{}
// StopSampling [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-stopSampling
func StopSampling() *StopSamplingParams {
return &StopSamplingParams{}
}
// StopSamplingReturns return values.
type StopSamplingReturns struct {
Profile *SamplingHeapProfile `json:"profile,omitempty"` // Recorded sampling heap profile.
}
// Do executes HeapProfiler.stopSampling against the provided context.
//
// returns:
// profile - Recorded sampling heap profile.
func (p *StopSamplingParams) Do(ctx context.Context) (profile *SamplingHeapProfile, err error) {
// execute
var res StopSamplingReturns
err = cdp.Execute(ctx, CommandStopSampling, nil, &res)
if err != nil {
return nil, err
}
return res.Profile, nil
}
// StopTrackingHeapObjectsParams [no description].
type StopTrackingHeapObjectsParams struct {
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
TreatGlobalObjectsAsRoots bool `json:"treatGlobalObjectsAsRoots,omitempty"`
}
// StopTrackingHeapObjects [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-stopTrackingHeapObjects
//
// parameters:
func StopTrackingHeapObjects() *StopTrackingHeapObjectsParams {
return &StopTrackingHeapObjectsParams{}
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken when the tracking is stopped.
func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *StopTrackingHeapObjectsParams {
p.ReportProgress = reportProgress
return &p
}
// WithTreatGlobalObjectsAsRoots [no description].
func (p StopTrackingHeapObjectsParams) WithTreatGlobalObjectsAsRoots(treatGlobalObjectsAsRoots bool) *StopTrackingHeapObjectsParams {
p.TreatGlobalObjectsAsRoots = treatGlobalObjectsAsRoots
return &p
}
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context.
func (p *StopTrackingHeapObjectsParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandStopTrackingHeapObjects, p, nil)
}
// TakeHeapSnapshotParams [no description].
type TakeHeapSnapshotParams struct {
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
TreatGlobalObjectsAsRoots bool `json:"treatGlobalObjectsAsRoots,omitempty"` // If true, a raw snapshot without artificial roots will be generated
}
// TakeHeapSnapshot [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#method-takeHeapSnapshot
//
// parameters:
func TakeHeapSnapshot() *TakeHeapSnapshotParams {
return &TakeHeapSnapshotParams{}
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken.
func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHeapSnapshotParams {
p.ReportProgress = reportProgress
return &p
}
// WithTreatGlobalObjectsAsRoots if true, a raw snapshot without artificial
// roots will be generated.
func (p TakeHeapSnapshotParams) WithTreatGlobalObjectsAsRoots(treatGlobalObjectsAsRoots bool) *TakeHeapSnapshotParams {
p.TreatGlobalObjectsAsRoots = treatGlobalObjectsAsRoots
return &p
}
// Do executes HeapProfiler.takeHeapSnapshot against the provided context.
func (p *TakeHeapSnapshotParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandTakeHeapSnapshot, p, nil)
}
// Command names.
const (
CommandAddInspectedHeapObject = "HeapProfiler.addInspectedHeapObject"
CommandCollectGarbage = "HeapProfiler.collectGarbage"
CommandDisable = "HeapProfiler.disable"
CommandEnable = "HeapProfiler.enable"
CommandGetHeapObjectID = "HeapProfiler.getHeapObjectId"
CommandGetObjectByHeapObjectID = "HeapProfiler.getObjectByHeapObjectId"
CommandGetSamplingProfile = "HeapProfiler.getSamplingProfile"
CommandStartSampling = "HeapProfiler.startSampling"
CommandStartTrackingHeapObjects = "HeapProfiler.startTrackingHeapObjects"
CommandStopSampling = "HeapProfiler.stopSampling"
CommandStopTrackingHeapObjects = "HeapProfiler.stopTrackingHeapObjects"
CommandTakeHeapSnapshot = "HeapProfiler.takeHeapSnapshot"
)

View File

@@ -0,0 +1,45 @@
package heapprofiler
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"github.com/chromedp/cdproto/runtime"
)
// HeapSnapshotObjectID heap snapshot object id.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#type-HeapSnapshotObjectId
type HeapSnapshotObjectID string
// String returns the HeapSnapshotObjectID as string value.
func (t HeapSnapshotObjectID) String() string {
return string(t)
}
// SamplingHeapProfileNode sampling Heap Profile node. Holds callsite
// information, allocation statistics and child nodes.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#type-SamplingHeapProfileNode
type SamplingHeapProfileNode struct {
CallFrame *runtime.CallFrame `json:"callFrame"` // Function location.
SelfSize float64 `json:"selfSize"` // Allocations size in bytes for the node excluding children.
ID int64 `json:"id"` // Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
Children []*SamplingHeapProfileNode `json:"children"` // Child nodes.
}
// SamplingHeapProfileSample a single sample from a sampling profile.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#type-SamplingHeapProfileSample
type SamplingHeapProfileSample struct {
Size float64 `json:"size"` // Allocation size in bytes attributed to the sample.
NodeID int64 `json:"nodeId"` // Id of the corresponding profile tree node.
Ordinal float64 `json:"ordinal"` // Time-ordered sample ordinal number. It is unique across all profiles retrieved between startSampling and stopSampling.
}
// SamplingHeapProfile sampling profile.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler#type-SamplingHeapProfile
type SamplingHeapProfile struct {
Head *SamplingHeapProfileNode `json:"head"`
Samples []*SamplingHeapProfileSample `json:"samples"`
}

1939
vendor/github.com/chromedp/cdproto/indexeddb/easyjson.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More