Fixing chromedp-gen and updating protocol.json
- Fixes issues with different flag toggles on chromedp-gen - Updating to latest protocol.json
This commit is contained in:
parent
98a04266f9
commit
c112899581
|
@ -1139,6 +1139,7 @@ type EvaluateOnCallFrameParams struct {
|
||||||
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
||||||
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object that should be sent by value.
|
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object that should be sent by value.
|
||||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
||||||
|
ThrowOnSideEffect bool `json:"throwOnSideEffect,omitempty"` // Whether to throw an exception if side effect cannot be ruled out during evaluation.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EvaluateOnCallFrame evaluates expression on a given call frame.
|
// EvaluateOnCallFrame evaluates expression on a given call frame.
|
||||||
|
@ -1187,6 +1188,13 @@ func (p EvaluateOnCallFrameParams) WithGeneratePreview(generatePreview bool) *Ev
|
||||||
return &p
|
return &p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithThrowOnSideEffect whether to throw an exception if side effect cannot
|
||||||
|
// be ruled out during evaluation.
|
||||||
|
func (p EvaluateOnCallFrameParams) WithThrowOnSideEffect(throwOnSideEffect bool) *EvaluateOnCallFrameParams {
|
||||||
|
p.ThrowOnSideEffect = throwOnSideEffect
|
||||||
|
return &p
|
||||||
|
}
|
||||||
|
|
||||||
// EvaluateOnCallFrameReturns return values.
|
// EvaluateOnCallFrameReturns return values.
|
||||||
type EvaluateOnCallFrameReturns struct {
|
type EvaluateOnCallFrameReturns struct {
|
||||||
Result *runtime.RemoteObject `json:"result,omitempty"` // Object wrapper for the evaluation result.
|
Result *runtime.RemoteObject `json:"result,omitempty"` // Object wrapper for the evaluation result.
|
||||||
|
|
|
@ -3598,6 +3598,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDebugger37(in *jlexer.Lexer, o
|
||||||
out.ReturnByValue = bool(in.Bool())
|
out.ReturnByValue = bool(in.Bool())
|
||||||
case "generatePreview":
|
case "generatePreview":
|
||||||
out.GeneratePreview = bool(in.Bool())
|
out.GeneratePreview = bool(in.Bool())
|
||||||
|
case "throwOnSideEffect":
|
||||||
|
out.ThrowOnSideEffect = bool(in.Bool())
|
||||||
default:
|
default:
|
||||||
in.SkipRecursive()
|
in.SkipRecursive()
|
||||||
}
|
}
|
||||||
|
@ -3664,6 +3666,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDebugger37(out *jwriter.Writer
|
||||||
out.RawString("\"generatePreview\":")
|
out.RawString("\"generatePreview\":")
|
||||||
out.Bool(bool(in.GeneratePreview))
|
out.Bool(bool(in.GeneratePreview))
|
||||||
}
|
}
|
||||||
|
if in.ThrowOnSideEffect {
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
out.RawString("\"throwOnSideEffect\":")
|
||||||
|
out.Bool(bool(in.ThrowOnSideEffect))
|
||||||
|
}
|
||||||
out.RawByte('}')
|
out.RawByte('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ go generate
|
||||||
|
|
||||||
go build
|
go build
|
||||||
|
|
||||||
time ./chromedp-gen
|
time ./chromedp-gen $@
|
||||||
|
|
||||||
go install ../../cdp/...
|
go install ../../cdp/...
|
||||||
|
|
|
@ -8,9 +8,8 @@ import (
|
||||||
"github.com/knq/chromedp/cmd/chromedp-gen/templates"
|
"github.com/knq/chromedp/cmd/chromedp-gen/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func setup() {
|
||||||
// set the internal types
|
types := map[string]bool{
|
||||||
internal.SetCDPTypes(map[string]bool{
|
|
||||||
"DOM.BackendNodeId": true,
|
"DOM.BackendNodeId": true,
|
||||||
"DOM.BackendNode": true,
|
"DOM.BackendNode": true,
|
||||||
"DOM.NodeId": true,
|
"DOM.NodeId": true,
|
||||||
|
@ -27,7 +26,16 @@ func init() {
|
||||||
"Network.Timestamp": true,
|
"Network.Timestamp": true,
|
||||||
"Page.FrameId": true,
|
"Page.FrameId": true,
|
||||||
"Page.Frame": true,
|
"Page.Frame": true,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if *internal.FlagRedirect {
|
||||||
|
types["Network.Cookie"] = true
|
||||||
|
types["Network.CookieSameSite"] = true
|
||||||
|
types["Page.ResourceType"] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the cdp types
|
||||||
|
internal.SetCDPTypes(types)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the internal type locations change above, these will also need to change:
|
// if the internal type locations change above, these will also need to change:
|
||||||
|
@ -58,6 +66,9 @@ const (
|
||||||
// - rename CSS.CSS* types.
|
// - rename CSS.CSS* types.
|
||||||
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
|
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
|
||||||
func FixupDomains(domains []*internal.Domain) {
|
func FixupDomains(domains []*internal.Domain) {
|
||||||
|
// set up the internal types
|
||||||
|
setup()
|
||||||
|
|
||||||
// method type
|
// method type
|
||||||
methodType := &internal.Type{
|
methodType := &internal.Type{
|
||||||
ID: "MethodType",
|
ID: "MethodType",
|
||||||
|
@ -512,6 +523,8 @@ func addEnumValues(d *internal.Domain, n string, p *internal.Type) {
|
||||||
// enumRefMap is the fully qualified parameter name to ref.
|
// enumRefMap is the fully qualified parameter name to ref.
|
||||||
var enumRefMap = map[string]string{
|
var enumRefMap = map[string]string{
|
||||||
"Animation.Animation.type": "Type",
|
"Animation.Animation.type": "Type",
|
||||||
|
"Console.ConsoleMessage.level": "MessageLevel",
|
||||||
|
"Console.ConsoleMessage.source": "MessageSource",
|
||||||
"CSS.CSSMedia.source": "MediaSource",
|
"CSS.CSSMedia.source": "MediaSource",
|
||||||
"CSS.forcePseudoState.forcedPseudoClasses": "PseudoClass",
|
"CSS.forcePseudoState.forcedPseudoClasses": "PseudoClass",
|
||||||
"Debugger.setPauseOnExceptions.state": "ExceptionsState",
|
"Debugger.setPauseOnExceptions.state": "ExceptionsState",
|
||||||
|
|
|
@ -11743,6 +11743,13 @@
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"description": "Whether preview should be generated for the result."
|
"description": "Whether preview should be generated for the result."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "throwOnSideEffect",
|
||||||
|
"type": "boolean",
|
||||||
|
"optional": true,
|
||||||
|
"experimental": true,
|
||||||
|
"description": "Whether to throw an exception if side effect cannot be ruled out during evaluation."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"returns": [
|
"returns": [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user