Updating to latest protocol.json
This commit is contained in:
parent
3a264ed3ff
commit
826072d0bf
|
@ -6,6 +6,7 @@ import (
|
|||
json "encoding/json"
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
debugger "github.com/knq/chromedp/cdp/debugger"
|
||||
dom "github.com/knq/chromedp/cdp/dom"
|
||||
easyjson "github.com/mailru/easyjson"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
|
@ -1717,6 +1718,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage21(in *jlexer.Lexer, out *
|
|||
switch key {
|
||||
case "url":
|
||||
out.URL = string(in.String())
|
||||
case "referrer":
|
||||
out.Referrer = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1737,6 +1740,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage21(out *jwriter.Writer, in
|
|||
first = false
|
||||
out.RawString("\"url\":")
|
||||
out.String(string(in.URL))
|
||||
if in.Referrer != "" {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"referrer\":")
|
||||
out.String(string(in.Referrer))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
@ -2454,6 +2465,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage30(in *jlexer.Lexer, out *
|
|||
}
|
||||
(*out.VisualViewport).UnmarshalEasyJSON(in)
|
||||
}
|
||||
case "contentSize":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.ContentSize = nil
|
||||
} else {
|
||||
if out.ContentSize == nil {
|
||||
out.ContentSize = new(dom.Rect)
|
||||
}
|
||||
(*out.ContentSize).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -2492,6 +2513,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage30(out *jwriter.Writer, in
|
|||
(*in.VisualViewport).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
if in.ContentSize != nil {
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
}
|
||||
first = false
|
||||
out.RawString("\"contentSize\":")
|
||||
if in.ContentSize == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.ContentSize).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
cdp "github.com/knq/chromedp/cdp"
|
||||
"github.com/knq/chromedp/cdp/debugger"
|
||||
"github.com/knq/chromedp/cdp/dom"
|
||||
)
|
||||
|
||||
// EnableParams enables page domain notifications.
|
||||
|
@ -161,6 +162,7 @@ func (p *ReloadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
// NavigateParams navigates current page to the given URL.
|
||||
type NavigateParams struct {
|
||||
URL string `json:"url"` // URL to navigate the page to.
|
||||
Referrer string `json:"referrer,omitempty"` // Referrer URL.
|
||||
}
|
||||
|
||||
// Navigate navigates current page to the given URL.
|
||||
|
@ -173,6 +175,12 @@ func Navigate(url string) *NavigateParams {
|
|||
}
|
||||
}
|
||||
|
||||
// WithReferrer referrer URL.
|
||||
func (p NavigateParams) WithReferrer(referrer string) *NavigateParams {
|
||||
p.Referrer = referrer
|
||||
return &p
|
||||
}
|
||||
|
||||
// NavigateReturns return values.
|
||||
type NavigateReturns struct {
|
||||
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame id that will be navigated.
|
||||
|
@ -795,6 +803,7 @@ func GetLayoutMetrics() *GetLayoutMetricsParams {
|
|||
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.
|
||||
}
|
||||
|
||||
// Do executes Page.getLayoutMetrics against the provided context and
|
||||
|
@ -803,13 +812,14 @@ type GetLayoutMetricsReturns struct {
|
|||
// returns:
|
||||
// layoutViewport - Metrics relating to the layout viewport.
|
||||
// visualViewport - Metrics relating to the visual viewport.
|
||||
func (p *GetLayoutMetricsParams) Do(ctxt context.Context, h cdp.Handler) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, err error) {
|
||||
// contentSize - Size of scrollable area.
|
||||
func (p *GetLayoutMetricsParams) Do(ctxt context.Context, h cdp.Handler) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, contentSize *dom.Rect, err error) {
|
||||
// execute
|
||||
var res GetLayoutMetricsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandPageGetLayoutMetrics, nil, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
return res.LayoutViewport, res.VisualViewport, nil
|
||||
return res.LayoutViewport, res.VisualViewport, res.ContentSize, nil
|
||||
}
|
||||
|
|
|
@ -522,6 +522,13 @@
|
|||
"name": "url",
|
||||
"type": "string",
|
||||
"description": "URL to navigate the page to."
|
||||
},
|
||||
{
|
||||
"name": "referrer",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"experimental": true,
|
||||
"description": "Referrer URL."
|
||||
}
|
||||
],
|
||||
"returns": [
|
||||
|
@ -1092,6 +1099,11 @@
|
|||
"name": "visualViewport",
|
||||
"$ref": "VisualViewport",
|
||||
"description": "Metrics relating to the visual viewport."
|
||||
},
|
||||
{
|
||||
"name": "contentSize",
|
||||
"$ref": "DOM.Rect",
|
||||
"description": "Size of scrollable area."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user