Updating to latest protocol.json
This commit is contained in:
parent
60dbb97d45
commit
89723e0ce3
|
@ -188,7 +188,7 @@ const (
|
|||
CommandNetworkSetBypassServiceWorker MethodType = "Network.setBypassServiceWorker"
|
||||
CommandNetworkSetDataSizeLimitsForTest MethodType = "Network.setDataSizeLimitsForTest"
|
||||
CommandNetworkGetCertificate MethodType = "Network.getCertificate"
|
||||
CommandNetworkSetRequestInterceptionEnabled MethodType = "Network.setRequestInterceptionEnabled"
|
||||
CommandNetworkSetRequestInterception MethodType = "Network.setRequestInterception"
|
||||
CommandNetworkContinueInterceptedRequest MethodType = "Network.continueInterceptedRequest"
|
||||
EventDatabaseAddDatabase MethodType = "Database.addDatabase"
|
||||
CommandDatabaseEnable MethodType = "Database.enable"
|
||||
|
@ -797,8 +797,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
*t = CommandNetworkSetDataSizeLimitsForTest
|
||||
case CommandNetworkGetCertificate:
|
||||
*t = CommandNetworkGetCertificate
|
||||
case CommandNetworkSetRequestInterceptionEnabled:
|
||||
*t = CommandNetworkSetRequestInterceptionEnabled
|
||||
case CommandNetworkSetRequestInterception:
|
||||
*t = CommandNetworkSetRequestInterception
|
||||
case CommandNetworkContinueInterceptedRequest:
|
||||
*t = CommandNetworkContinueInterceptedRequest
|
||||
case EventDatabaseAddDatabase:
|
||||
|
|
|
@ -422,7 +422,7 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
|||
case cdp.CommandNetworkGetCertificate:
|
||||
v = new(network.GetCertificateReturns)
|
||||
|
||||
case cdp.CommandNetworkSetRequestInterceptionEnabled:
|
||||
case cdp.CommandNetworkSetRequestInterception:
|
||||
return emptyVal, nil
|
||||
|
||||
case cdp.CommandNetworkContinueInterceptedRequest:
|
||||
|
|
|
@ -42,6 +42,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation(in *jlexer.Lexer, ou
|
|||
(out.Policy).UnmarshalEasyJSON(in)
|
||||
case "budget":
|
||||
out.Budget = int64(in.Int64())
|
||||
case "maxVirtualTimeTaskStarvationCount":
|
||||
out.MaxVirtualTimeTaskStarvationCount = int64(in.Int64())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -70,6 +72,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation(out *jwriter.Writer,
|
|||
out.RawString("\"budget\":")
|
||||
out.Int64(int64(in.Budget))
|
||||
}
|
||||
if in.MaxVirtualTimeTaskStarvationCount != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"maxVirtualTimeTaskStarvationCount\":")
|
||||
out.Int64(int64(in.MaxVirtualTimeTaskStarvationCount))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
|
|
@ -376,8 +376,9 @@ func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool,
|
|||
// 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 int64 `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
|
||||
Policy VirtualTimePolicy `json:"policy"`
|
||||
Budget int64 `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.
|
||||
}
|
||||
|
||||
// SetVirtualTimePolicy turns on virtual time for all frames (replacing
|
||||
|
@ -399,6 +400,14 @@ func (p SetVirtualTimePolicyParams) WithBudget(budget int64) *SetVirtualTimePoli
|
|||
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
|
||||
}
|
||||
|
||||
// Do executes Emulation.setVirtualTimePolicy against the provided context and
|
||||
// target handler.
|
||||
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
|
|
|
@ -362,6 +362,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental5(in *jlex
|
|||
switch key {
|
||||
case "hasDamage":
|
||||
out.HasDamage = bool(in.Bool())
|
||||
case "mainFrameContentUpdated":
|
||||
out.MainFrameContentUpdated = bool(in.Bool())
|
||||
case "screenshotData":
|
||||
out.ScreenshotData = string(in.String())
|
||||
default:
|
||||
|
@ -386,6 +388,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental5(out *jwr
|
|||
out.RawString("\"hasDamage\":")
|
||||
out.Bool(bool(in.HasDamage))
|
||||
}
|
||||
if in.MainFrameContentUpdated {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"mainFrameContentUpdated\":")
|
||||
out.Bool(bool(in.MainFrameContentUpdated))
|
||||
}
|
||||
if in.ScreenshotData != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
|
|
|
@ -95,8 +95,9 @@ func (p BeginFrameParams) WithScreenshot(screenshot *ScreenshotParams) *BeginFra
|
|||
|
||||
// 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.
|
||||
ScreenshotData string `json:"screenshotData,omitempty"` // Base64-encoded image data of the screenshot, if one was requested and successfully taken.
|
||||
HasDamage bool `json:"hasDamage,omitempty"` // Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display.
|
||||
MainFrameContentUpdated bool `json:"mainFrameContentUpdated,omitempty"` // Whether the main frame submitted a new display frame in response to this BeginFrame.
|
||||
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 and
|
||||
|
@ -104,20 +105,21 @@ type BeginFrameReturns struct {
|
|||
//
|
||||
// returns:
|
||||
// hasDamage - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display.
|
||||
// mainFrameContentUpdated - Whether the main frame submitted a new display frame in response to this BeginFrame.
|
||||
// screenshotData - Base64-encoded image data of the screenshot, if one was requested and successfully taken.
|
||||
func (p *BeginFrameParams) Do(ctxt context.Context, h cdp.Handler) (hasDamage bool, screenshotData []byte, err error) {
|
||||
func (p *BeginFrameParams) Do(ctxt context.Context, h cdp.Handler) (hasDamage bool, mainFrameContentUpdated bool, screenshotData []byte, err error) {
|
||||
// execute
|
||||
var res BeginFrameReturns
|
||||
err = h.Execute(ctxt, cdp.CommandHeadlessExperimentalBeginFrame, p, &res)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
return false, false, nil, err
|
||||
}
|
||||
|
||||
// decode
|
||||
var dec []byte
|
||||
dec, err = base64.StdEncoding.DecodeString(res.ScreenshotData)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
return false, false, nil, err
|
||||
}
|
||||
return res.HasDamage, dec, nil
|
||||
return res.HasDamage, res.MainFrameContentUpdated, dec, nil
|
||||
}
|
||||
|
|
|
@ -1102,6 +1102,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput8(in *jlexer.Lexer, out *
|
|||
out.IsKeypad = bool(in.Bool())
|
||||
case "isSystemKey":
|
||||
out.IsSystemKey = bool(in.Bool())
|
||||
case "location":
|
||||
out.Location = int64(in.Int64())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1222,6 +1224,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput8(out *jwriter.Writer, in
|
|||
out.RawString("\"isSystemKey\":")
|
||||
out.Bool(bool(in.IsSystemKey))
|
||||
}
|
||||
if in.Location != 0 {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"location\":")
|
||||
out.Int64(int64(in.Location))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ type DispatchKeyEventParams struct {
|
|||
AutoRepeat bool `json:"autoRepeat,omitempty"` // Whether the event was generated from auto repeat (default: false).
|
||||
IsKeypad bool `json:"isKeypad,omitempty"` // Whether the event was generated from the keypad (default: false).
|
||||
IsSystemKey bool `json:"isSystemKey,omitempty"` // Whether the event was a system key event (default: false).
|
||||
Location int64 `json:"location,omitempty"` // Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
|
||||
}
|
||||
|
||||
// DispatchKeyEvent dispatches a key event to the page.
|
||||
|
@ -143,6 +144,13 @@ func (p DispatchKeyEventParams) WithIsSystemKey(isSystemKey bool) *DispatchKeyEv
|
|||
return &p
|
||||
}
|
||||
|
||||
// WithLocation whether the event was from the left or right side of the
|
||||
// keyboard. 1=Left, 2=Right (default: 0).
|
||||
func (p DispatchKeyEventParams) WithLocation(location int64) *DispatchKeyEventParams {
|
||||
p.Location = location
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Input.dispatchKeyEvent against the provided context and
|
||||
// target handler.
|
||||
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,6 @@ import (
|
|||
"encoding/base64"
|
||||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/page"
|
||||
)
|
||||
|
||||
// EnableParams enables network tracking, network events will now be
|
||||
|
@ -703,45 +702,27 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNam
|
|||
return res.TableNames, nil
|
||||
}
|
||||
|
||||
// SetRequestInterceptionEnabledParams sets the requests to intercept that
|
||||
// match a the provided patterns and optionally resource types.
|
||||
type SetRequestInterceptionEnabledParams struct {
|
||||
Enabled bool `json:"enabled"` // Whether requests should be intercepted. If patterns is not set, matches all and resets any previously set patterns. Other parameters are ignored if false.
|
||||
Patterns []string `json:"patterns,omitempty"` // URLs matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call. Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. If omitted equivalent to ['*'] (intercept all).
|
||||
ResourceTypes []page.ResourceType `json:"resourceTypes,omitempty"` // If set, only requests for matching resource types will be intercepted.
|
||||
// SetRequestInterceptionParams sets the requests to intercept that match a
|
||||
// the provided patterns and optionally resource types.
|
||||
type SetRequestInterceptionParams struct {
|
||||
Patterns []*RequestPattern `json:"patterns"` // Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
|
||||
}
|
||||
|
||||
// SetRequestInterceptionEnabled sets the requests to intercept that match a
|
||||
// the provided patterns and optionally resource types.
|
||||
// SetRequestInterception sets the requests to intercept that match a the
|
||||
// provided patterns and optionally resource types.
|
||||
//
|
||||
// parameters:
|
||||
// enabled - Whether requests should be intercepted. If patterns is not set, matches all and resets any previously set patterns. Other parameters are ignored if false.
|
||||
func SetRequestInterceptionEnabled(enabled bool) *SetRequestInterceptionEnabledParams {
|
||||
return &SetRequestInterceptionEnabledParams{
|
||||
Enabled: enabled,
|
||||
// patterns - Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
|
||||
func SetRequestInterception(patterns []*RequestPattern) *SetRequestInterceptionParams {
|
||||
return &SetRequestInterceptionParams{
|
||||
Patterns: patterns,
|
||||
}
|
||||
}
|
||||
|
||||
// WithPatterns uRLs matching any of these patterns will be forwarded and
|
||||
// wait for the corresponding continueInterceptedRequest call. Wildcards ('*' ->
|
||||
// zero or more, '?' -> exactly one) are allowed. Escape character is backslash.
|
||||
// If omitted equivalent to ['*'] (intercept all).
|
||||
func (p SetRequestInterceptionEnabledParams) WithPatterns(patterns []string) *SetRequestInterceptionEnabledParams {
|
||||
p.Patterns = patterns
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithResourceTypes if set, only requests for matching resource types will
|
||||
// be intercepted.
|
||||
func (p SetRequestInterceptionEnabledParams) WithResourceTypes(resourceTypes []page.ResourceType) *SetRequestInterceptionEnabledParams {
|
||||
p.ResourceTypes = resourceTypes
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Network.setRequestInterceptionEnabled against the provided context and
|
||||
// Do executes Network.setRequestInterception against the provided context and
|
||||
// target handler.
|
||||
func (p *SetRequestInterceptionEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetRequestInterceptionEnabled, p, nil)
|
||||
func (p *SetRequestInterceptionParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandNetworkSetRequestInterception, p, nil)
|
||||
}
|
||||
|
||||
// ContinueInterceptedRequestParams response to Network.requestIntercepted
|
||||
|
|
|
@ -481,6 +481,12 @@ type AuthChallengeResponse struct {
|
|||
Password string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
|
||||
}
|
||||
|
||||
// RequestPattern request pattern for interception.
|
||||
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 page.ResourceType `json:"resourceType,omitempty"` // If set, only requests for matching resource types will be intercepted.
|
||||
}
|
||||
|
||||
// ReferrerPolicy the referrer policy of the request, as defined in
|
||||
// https://www.w3.org/TR/referrer-policy/.
|
||||
type ReferrerPolicy string
|
||||
|
|
|
@ -2329,6 +2329,12 @@
|
|||
"type": "integer",
|
||||
"optional": true,
|
||||
"description": "If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent."
|
||||
},
|
||||
{
|
||||
"name": "maxVirtualTimeTaskStarvationCount",
|
||||
"type": "integer",
|
||||
"optional": true,
|
||||
"description": "If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
|
@ -3485,6 +3491,26 @@
|
|||
}
|
||||
],
|
||||
"experimental": true
|
||||
},
|
||||
{
|
||||
"id": "RequestPattern",
|
||||
"type": "object",
|
||||
"description": "Request pattern for interception.",
|
||||
"properties": [
|
||||
{
|
||||
"name": "urlPattern",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"description": "Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to \"*\"."
|
||||
},
|
||||
{
|
||||
"name": "resourceType",
|
||||
"$ref": "Page.ResourceType",
|
||||
"optional": true,
|
||||
"description": "If set, only requests for matching resource types will be intercepted."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
|
@ -3872,31 +3898,16 @@
|
|||
"experimental": true
|
||||
},
|
||||
{
|
||||
"name": "setRequestInterceptionEnabled",
|
||||
"name": "setRequestInterception",
|
||||
"description": "Sets the requests to intercept that match a the provided patterns and optionally resource types.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "enabled",
|
||||
"type": "boolean",
|
||||
"description": "Whether requests should be intercepted. If patterns is not set, matches all and resets any previously set patterns. Other parameters are ignored if false."
|
||||
},
|
||||
{
|
||||
"name": "patterns",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"items": {
|
||||
"type": "string"
|
||||
"$ref": "RequestPattern"
|
||||
},
|
||||
"description": "URLs matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call. Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. If omitted equivalent to ['*'] (intercept all)."
|
||||
},
|
||||
{
|
||||
"name": "resourceTypes",
|
||||
"type": "array",
|
||||
"optional": true,
|
||||
"items": {
|
||||
"$ref": "Page.ResourceType"
|
||||
},
|
||||
"description": "If set, only requests for matching resource types will be intercepted."
|
||||
"description": "Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call."
|
||||
}
|
||||
],
|
||||
"experimental": true
|
||||
|
@ -9130,6 +9141,11 @@
|
|||
"type": "boolean",
|
||||
"description": "Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display."
|
||||
},
|
||||
{
|
||||
"name": "mainFrameContentUpdated",
|
||||
"type": "boolean",
|
||||
"description": "Whether the main frame submitted a new display frame in response to this BeginFrame."
|
||||
},
|
||||
{
|
||||
"name": "screenshotData",
|
||||
"type": "string",
|
||||
|
@ -9598,6 +9614,13 @@
|
|||
"type": "boolean",
|
||||
"optional": true,
|
||||
"description": "Whether the event was a system key event (default: false)."
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"type": "integer",
|
||||
"optional": true,
|
||||
"experimental": true,
|
||||
"description": "Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0)."
|
||||
}
|
||||
],
|
||||
"description": "Dispatches a key event to the page."
|
||||
|
|
Loading…
Reference in New Issue
Block a user