mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Update chromedp to fix console errors (#1521)
This commit is contained in:
165
vendor/github.com/chromedp/cdproto/page/page.go
generated
vendored
165
vendor/github.com/chromedp/cdproto/page/page.go
generated
vendored
@@ -23,8 +23,9 @@ import (
|
||||
// AddScriptToEvaluateOnNewDocumentParams evaluates given script in every
|
||||
// frame upon creation (before loading frame's scripts).
|
||||
type AddScriptToEvaluateOnNewDocumentParams struct {
|
||||
Source string `json:"source"`
|
||||
WorldName string `json:"worldName,omitempty"` // If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
|
||||
Source string `json:"source"`
|
||||
WorldName string `json:"worldName,omitempty"` // If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
|
||||
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Specifies whether command line API should be available to the script, defaults to false.
|
||||
}
|
||||
|
||||
// AddScriptToEvaluateOnNewDocument evaluates given script in every frame
|
||||
@@ -48,6 +49,13 @@ func (p AddScriptToEvaluateOnNewDocumentParams) WithWorldName(worldName string)
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithIncludeCommandLineAPI specifies whether command line API should be
|
||||
// available to the script, defaults to false.
|
||||
func (p AddScriptToEvaluateOnNewDocumentParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *AddScriptToEvaluateOnNewDocumentParams {
|
||||
p.IncludeCommandLineAPI = includeCommandLineAPI
|
||||
return &p
|
||||
}
|
||||
|
||||
// AddScriptToEvaluateOnNewDocumentReturns return values.
|
||||
type AddScriptToEvaluateOnNewDocumentReturns struct {
|
||||
Identifier ScriptIdentifier `json:"identifier,omitempty"` // Identifier of the added script.
|
||||
@@ -85,10 +93,11 @@ func (p *BringToFrontParams) Do(ctx context.Context) (err error) {
|
||||
|
||||
// CaptureScreenshotParams capture page screenshot.
|
||||
type CaptureScreenshotParams struct {
|
||||
Format CaptureScreenshotFormat `json:"format,omitempty"` // Image compression format (defaults to png).
|
||||
Quality int64 `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
|
||||
Clip *Viewport `json:"clip,omitempty"` // Capture the screenshot of a given region only.
|
||||
FromSurface bool `json:"fromSurface,omitempty"` // Capture the screenshot from the surface, rather than the view. Defaults to true.
|
||||
Format CaptureScreenshotFormat `json:"format,omitempty"` // Image compression format (defaults to png).
|
||||
Quality int64 `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
|
||||
Clip *Viewport `json:"clip,omitempty"` // Capture the screenshot of a given region only.
|
||||
FromSurface bool `json:"fromSurface,omitempty"` // Capture the screenshot from the surface, rather than the view. Defaults to true.
|
||||
CaptureBeyondViewport bool `json:"captureBeyondViewport,omitempty"` // Capture the screenshot beyond the viewport. Defaults to false.
|
||||
}
|
||||
|
||||
// CaptureScreenshot capture page screenshot.
|
||||
@@ -125,6 +134,13 @@ func (p CaptureScreenshotParams) WithFromSurface(fromSurface bool) *CaptureScree
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithCaptureBeyondViewport capture the screenshot beyond the viewport.
|
||||
// Defaults to false.
|
||||
func (p CaptureScreenshotParams) WithCaptureBeyondViewport(captureBeyondViewport bool) *CaptureScreenshotParams {
|
||||
p.CaptureBeyondViewport = captureBeyondViewport
|
||||
return &p
|
||||
}
|
||||
|
||||
// CaptureScreenshotReturns return values.
|
||||
type CaptureScreenshotReturns struct {
|
||||
Data string `json:"data,omitempty"` // Base64-encoded image data.
|
||||
@@ -423,26 +439,32 @@ func GetLayoutMetrics() *GetLayoutMetricsParams {
|
||||
|
||||
// GetLayoutMetricsReturns return values.
|
||||
type GetLayoutMetricsReturns struct {
|
||||
LayoutViewport *LayoutViewport `json:"layoutViewport,omitempty"` // Metrics relating to the layout viewport.
|
||||
VisualViewport *VisualViewport `json:"visualViewport,omitempty"` // Metrics relating to the visual viewport.
|
||||
ContentSize *dom.Rect `json:"contentSize,omitempty"` // Size of scrollable area.
|
||||
LayoutViewport *LayoutViewport `json:"layoutViewport"` // Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssLayoutViewport instead.
|
||||
VisualViewport *VisualViewport `json:"visualViewport"` // Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssVisualViewport instead.
|
||||
ContentSize *dom.Rect `json:"contentSize"` // Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssContentSize instead.
|
||||
CSSLayoutViewport *LayoutViewport `json:"cssLayoutViewport"` // Metrics relating to the layout viewport in CSS pixels.
|
||||
CSSVisualViewport *VisualViewport `json:"cssVisualViewport"` // Metrics relating to the visual viewport in CSS pixels.
|
||||
CSSContentSize *dom.Rect `json:"cssContentSize"` // Size of scrollable area in CSS pixels.
|
||||
}
|
||||
|
||||
// Do executes Page.getLayoutMetrics against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// layoutViewport - Metrics relating to the layout viewport.
|
||||
// visualViewport - Metrics relating to the visual viewport.
|
||||
// contentSize - Size of scrollable area.
|
||||
func (p *GetLayoutMetricsParams) Do(ctx context.Context) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, contentSize *dom.Rect, err error) {
|
||||
// layoutViewport - Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssLayoutViewport instead.
|
||||
// visualViewport - Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssVisualViewport instead.
|
||||
// contentSize - Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the enable-use-zoom-for-dsf flag. Use cssContentSize instead.
|
||||
// cssLayoutViewport - Metrics relating to the layout viewport in CSS pixels.
|
||||
// cssVisualViewport - Metrics relating to the visual viewport in CSS pixels.
|
||||
// cssContentSize - Size of scrollable area in CSS pixels.
|
||||
func (p *GetLayoutMetricsParams) Do(ctx context.Context) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, contentSize *dom.Rect, cssLayoutViewport *LayoutViewport, cssVisualViewport *VisualViewport, cssContentSize *dom.Rect, err error) {
|
||||
// execute
|
||||
var res GetLayoutMetricsReturns
|
||||
err = cdp.Execute(ctx, CommandGetLayoutMetrics, nil, &res)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
return nil, nil, nil, nil, nil, nil, err
|
||||
}
|
||||
|
||||
return res.LayoutViewport, res.VisualViewport, res.ContentSize, nil
|
||||
return res.LayoutViewport, res.VisualViewport, res.ContentSize, res.CSSLayoutViewport, res.CSSVisualViewport, res.CSSContentSize, nil
|
||||
}
|
||||
|
||||
// GetNavigationHistoryParams returns navigation history for the current
|
||||
@@ -1047,6 +1069,44 @@ func (p *SetBypassCSPParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetBypassCSP, p, nil)
|
||||
}
|
||||
|
||||
// GetPermissionsPolicyStateParams get Permissions Policy state on given
|
||||
// frame.
|
||||
type GetPermissionsPolicyStateParams struct {
|
||||
FrameID cdp.FrameID `json:"frameId"`
|
||||
}
|
||||
|
||||
// GetPermissionsPolicyState get Permissions Policy state on given frame.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-getPermissionsPolicyState
|
||||
//
|
||||
// parameters:
|
||||
// frameID
|
||||
func GetPermissionsPolicyState(frameID cdp.FrameID) *GetPermissionsPolicyStateParams {
|
||||
return &GetPermissionsPolicyStateParams{
|
||||
FrameID: frameID,
|
||||
}
|
||||
}
|
||||
|
||||
// GetPermissionsPolicyStateReturns return values.
|
||||
type GetPermissionsPolicyStateReturns struct {
|
||||
States []*PermissionsPolicyFeatureState `json:"states,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Page.getPermissionsPolicyState against the provided context.
|
||||
//
|
||||
// returns:
|
||||
// states
|
||||
func (p *GetPermissionsPolicyStateParams) Do(ctx context.Context) (states []*PermissionsPolicyFeatureState, err error) {
|
||||
// execute
|
||||
var res GetPermissionsPolicyStateReturns
|
||||
err = cdp.Execute(ctx, CommandGetPermissionsPolicyState, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.States, nil
|
||||
}
|
||||
|
||||
// SetFontFamiliesParams set generic font families.
|
||||
type SetFontFamiliesParams struct {
|
||||
FontFamilies *FontFamilies `json:"fontFamilies"` // Specifies font families to set. If a font family is not specified, it won't be changed.
|
||||
@@ -1116,6 +1176,36 @@ func (p *SetDocumentContentParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetDocumentContent, 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).
|
||||
DownloadPath string `json:"downloadPath,omitempty"` // The default path to save downloaded files to. This is required if behavior is set to 'allow'
|
||||
}
|
||||
|
||||
// SetDownloadBehavior set the behavior when downloading a file.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-setDownloadBehavior
|
||||
//
|
||||
// parameters:
|
||||
// behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
|
||||
func SetDownloadBehavior(behavior SetDownloadBehaviorBehavior) *SetDownloadBehaviorParams {
|
||||
return &SetDownloadBehaviorParams{
|
||||
Behavior: behavior,
|
||||
}
|
||||
}
|
||||
|
||||
// WithDownloadPath the default path to save downloaded files to. This is
|
||||
// required if behavior is set to 'allow'.
|
||||
func (p SetDownloadBehaviorParams) WithDownloadPath(downloadPath string) *SetDownloadBehaviorParams {
|
||||
p.DownloadPath = downloadPath
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Page.setDownloadBehavior against the provided context.
|
||||
func (p *SetDownloadBehaviorParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetDownloadBehavior, p, nil)
|
||||
}
|
||||
|
||||
// SetLifecycleEventsEnabledParams controls whether page will emit lifecycle
|
||||
// events.
|
||||
type SetLifecycleEventsEnabledParams struct {
|
||||
@@ -1283,13 +1373,13 @@ func (p *StopScreencastParams) Do(ctx context.Context) (err error) {
|
||||
}
|
||||
|
||||
// SetProduceCompilationCacheParams forces compilation cache to be generated
|
||||
// for every subresource script.
|
||||
// for every subresource script. See also: Page.produceCompilationCache.
|
||||
type SetProduceCompilationCacheParams struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SetProduceCompilationCache forces compilation cache to be generated for
|
||||
// every subresource script.
|
||||
// every subresource script. See also: Page.produceCompilationCache.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-setProduceCompilationCache
|
||||
//
|
||||
@@ -1306,6 +1396,44 @@ func (p *SetProduceCompilationCacheParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandSetProduceCompilationCache, p, nil)
|
||||
}
|
||||
|
||||
// ProduceCompilationCacheParams requests backend to produce compilation
|
||||
// cache for the specified scripts. Unlike setProduceCompilationCache, this
|
||||
// allows client to only produce cache for specific scripts. scripts are
|
||||
// appeneded to the list of scripts for which the cache for would produced.
|
||||
// Disabling compilation cache with setProduceCompilationCache would reset all
|
||||
// pending cache requests. The list may also be reset during page navigation.
|
||||
// When script with a matching URL is encountered, the cache is optionally
|
||||
// produced upon backend discretion, based on internal heuristics. See also:
|
||||
// Page.compilationCacheProduced.
|
||||
type ProduceCompilationCacheParams struct {
|
||||
Scripts []*CompilationCacheParams `json:"scripts"`
|
||||
}
|
||||
|
||||
// ProduceCompilationCache requests backend to produce compilation cache for
|
||||
// the specified scripts. Unlike setProduceCompilationCache, this allows client
|
||||
// to only produce cache for specific scripts. scripts are appeneded to the list
|
||||
// of scripts for which the cache for would produced. Disabling compilation
|
||||
// cache with setProduceCompilationCache would reset all pending cache requests.
|
||||
// The list may also be reset during page navigation. When script with a
|
||||
// matching URL is encountered, the cache is optionally produced upon backend
|
||||
// discretion, based on internal heuristics. See also:
|
||||
// Page.compilationCacheProduced.
|
||||
//
|
||||
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-produceCompilationCache
|
||||
//
|
||||
// parameters:
|
||||
// scripts
|
||||
func ProduceCompilationCache(scripts []*CompilationCacheParams) *ProduceCompilationCacheParams {
|
||||
return &ProduceCompilationCacheParams{
|
||||
Scripts: scripts,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Page.produceCompilationCache against the provided context.
|
||||
func (p *ProduceCompilationCacheParams) Do(ctx context.Context) (err error) {
|
||||
return cdp.Execute(ctx, CommandProduceCompilationCache, p, nil)
|
||||
}
|
||||
|
||||
// AddCompilationCacheParams seeds compilation cache for given url.
|
||||
// Compilation cache does not survive cross-process navigation.
|
||||
type AddCompilationCacheParams struct {
|
||||
@@ -1450,9 +1578,11 @@ const (
|
||||
CommandSearchInResource = "Page.searchInResource"
|
||||
CommandSetAdBlockingEnabled = "Page.setAdBlockingEnabled"
|
||||
CommandSetBypassCSP = "Page.setBypassCSP"
|
||||
CommandGetPermissionsPolicyState = "Page.getPermissionsPolicyState"
|
||||
CommandSetFontFamilies = "Page.setFontFamilies"
|
||||
CommandSetFontSizes = "Page.setFontSizes"
|
||||
CommandSetDocumentContent = "Page.setDocumentContent"
|
||||
CommandSetDownloadBehavior = "Page.setDownloadBehavior"
|
||||
CommandSetLifecycleEventsEnabled = "Page.setLifecycleEventsEnabled"
|
||||
CommandStartScreencast = "Page.startScreencast"
|
||||
CommandStopLoading = "Page.stopLoading"
|
||||
@@ -1461,6 +1591,7 @@ const (
|
||||
CommandSetWebLifecycleState = "Page.setWebLifecycleState"
|
||||
CommandStopScreencast = "Page.stopScreencast"
|
||||
CommandSetProduceCompilationCache = "Page.setProduceCompilationCache"
|
||||
CommandProduceCompilationCache = "Page.produceCompilationCache"
|
||||
CommandAddCompilationCache = "Page.addCompilationCache"
|
||||
CommandClearCompilationCache = "Page.clearCompilationCache"
|
||||
CommandGenerateTestReport = "Page.generateTestReport"
|
||||
|
||||
Reference in New Issue
Block a user