From fa151e8cf57be2f7cdb3f9b8bf4011d4f015e66c Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Sun, 25 Jun 2017 08:38:47 +0700 Subject: [PATCH] Updating to latest protocol.json --- cdp/cdputil/cdputil.go | 2 +- cdp/network/easyjson.go | 18 ++--- cdp/page/easyjson.go | 141 ++++++++++++++++++++++++--------- cdp/page/page.go | 20 ++++- cdp/profiler/easyjson.go | 10 +++ cdp/profiler/types.go | 5 +- cmd/chromedp-gen/protocol.json | 12 +++ cmd/chromedp-gen/update.sh | 4 +- 8 files changed, 160 insertions(+), 52 deletions(-) diff --git a/cdp/cdputil/cdputil.go b/cdp/cdputil/cdputil.go index 33156a5..fb587f1 100644 --- a/cdp/cdputil/cdputil.go +++ b/cdp/cdputil/cdputil.go @@ -147,7 +147,7 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) { v = new(page.GetLayoutMetricsReturns) case cdp.CommandPageCreateIsolatedWorld: - return emptyVal, nil + v = new(page.CreateIsolatedWorldReturns) case cdp.EventPageDomContentEventFired: v = new(page.EventDomContentEventFired) diff --git a/cdp/network/easyjson.go b/cdp/network/easyjson.go index 33ad94b..bde768e 100644 --- a/cdp/network/easyjson.go +++ b/cdp/network/easyjson.go @@ -60,7 +60,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork(in *jlexer.Lexer, out if m, ok := v1.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v1.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v1 = in.Interface() } @@ -88,7 +88,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork(in *jlexer.Lexer, out if m, ok := v2.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v2.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v2 = in.Interface() } @@ -265,7 +265,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork1(in *jlexer.Lexer, out if m, ok := v5.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v5.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v5 = in.Interface() } @@ -674,7 +674,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork5(in *jlexer.Lexer, out if m, ok := v7.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v7.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v7 = in.Interface() } @@ -1567,7 +1567,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork13(in *jlexer.Lexer, ou if m, ok := v18.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v18.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v18 = in.Interface() } @@ -1597,7 +1597,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork13(in *jlexer.Lexer, ou if m, ok := v19.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v19.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v19 = in.Interface() } @@ -2147,7 +2147,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork15(in *jlexer.Lexer, ou if m, ok := v22.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v22.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v22 = in.Interface() } @@ -4386,7 +4386,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork37(in *jlexer.Lexer, ou if m, ok := v36.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v36.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v36 = in.Interface() } @@ -5538,7 +5538,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork48(in *jlexer.Lexer, ou if m, ok := v38.(easyjson.Unmarshaler); ok { m.UnmarshalEasyJSON(in) } else if m, ok := v38.(json.Unmarshaler); ok { - m.UnmarshalJSON(in.Raw()) + _ = m.UnmarshalJSON(in.Raw()) } else { v38 = in.Interface() } diff --git a/cdp/page/easyjson.go b/cdp/page/easyjson.go index 62c1193..52f902c 100644 --- a/cdp/page/easyjson.go +++ b/cdp/page/easyjson.go @@ -4581,7 +4581,76 @@ func (v *DisableParams) UnmarshalJSON(data []byte) error { func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage53(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(in *jlexer.Lexer, out *CreateIsolatedWorldParams) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(in *jlexer.Lexer, out *CreateIsolatedWorldReturns) { + 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 "executionContextId": + out.ExecutionContextID = runtime.ExecutionContextID(in.Int64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(out *jwriter.Writer, in CreateIsolatedWorldReturns) { + out.RawByte('{') + first := true + _ = first + if in.ExecutionContextID != 0 { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"executionContextId\":") + out.Int64(int64(in.ExecutionContextID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CreateIsolatedWorldReturns) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CreateIsolatedWorldReturns) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CreateIsolatedWorldReturns) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CreateIsolatedWorldReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(l, v) +} +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out *CreateIsolatedWorldParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -4616,7 +4685,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(out *jwriter.Writer, in CreateIsolatedWorldParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in CreateIsolatedWorldParams) { out.RawByte('{') first := true _ = first @@ -4648,27 +4717,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v CreateIsolatedWorldParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CreateIsolatedWorldParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage54(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CreateIsolatedWorldParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CreateIsolatedWorldParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage54(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out *CaptureScreenshotReturns) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *CaptureScreenshotReturns) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -4699,7 +4768,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in CaptureScreenshotReturns) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in CaptureScreenshotReturns) { out.RawByte('{') first := true _ = first @@ -4717,27 +4786,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v CaptureScreenshotReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CaptureScreenshotReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage55(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CaptureScreenshotReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CaptureScreenshotReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage55(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out *CaptureScreenshotParams) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out *CaptureScreenshotParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -4772,7 +4841,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in CaptureScreenshotParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in CaptureScreenshotParams) { out.RawByte('{') first := true _ = first @@ -4806,27 +4875,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v CaptureScreenshotParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CaptureScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage56(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CaptureScreenshotParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CaptureScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage56(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out *AppManifestError) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out *AppManifestError) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -4863,7 +4932,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in AppManifestError) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in AppManifestError) { out.RawByte('{') first := true _ = first @@ -4905,27 +4974,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v AppManifestError) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AppManifestError) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage57(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AppManifestError) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AppManifestError) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage57(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadReturns) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadReturns) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -4956,7 +5025,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in AddScriptToEvaluateOnLoadReturns) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in AddScriptToEvaluateOnLoadReturns) { out.RawByte('{') first := true _ = first @@ -4974,27 +5043,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v AddScriptToEvaluateOnLoadReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AddScriptToEvaluateOnLoadReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage58(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(l, v) } -func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadParams) { +func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -5025,7 +5094,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out * in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in AddScriptToEvaluateOnLoadParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(out *jwriter.Writer, in AddScriptToEvaluateOnLoadParams) { out.RawByte('{') first := true _ = first @@ -5041,23 +5110,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in // MarshalJSON supports json.Marshaler interface func (v AddScriptToEvaluateOnLoadParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AddScriptToEvaluateOnLoadParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AddScriptToEvaluateOnLoadParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AddScriptToEvaluateOnLoadParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(l, v) } diff --git a/cdp/page/page.go b/cdp/page/page.go index 57754fc..4c4fe5b 100644 --- a/cdp/page/page.go +++ b/cdp/page/page.go @@ -16,6 +16,7 @@ import ( cdp "github.com/knq/chromedp/cdp" "github.com/knq/chromedp/cdp/debugger" "github.com/knq/chromedp/cdp/dom" + "github.com/knq/chromedp/cdp/runtime" ) // EnableParams enables page domain notifications. @@ -897,8 +898,23 @@ func (p CreateIsolatedWorldParams) WithGrantUniveralAccess(grantUniveralAccess b return &p } +// CreateIsolatedWorldReturns return values. +type CreateIsolatedWorldReturns struct { + ExecutionContextID runtime.ExecutionContextID `json:"executionContextId,omitempty"` // Execution context of the isolated world. +} + // Do executes Page.createIsolatedWorld against the provided context and // target handler. -func (p *CreateIsolatedWorldParams) Do(ctxt context.Context, h cdp.Handler) (err error) { - return h.Execute(ctxt, cdp.CommandPageCreateIsolatedWorld, p, nil) +// +// returns: +// executionContextID - Execution context of the isolated world. +func (p *CreateIsolatedWorldParams) Do(ctxt context.Context, h cdp.Handler) (executionContextID runtime.ExecutionContextID, err error) { + // execute + var res CreateIsolatedWorldReturns + err = h.Execute(ctxt, cdp.CommandPageCreateIsolatedWorld, p, &res) + if err != nil { + return 0, err + } + + return res.ExecutionContextID, nil } diff --git a/cdp/profiler/easyjson.go b/cdp/profiler/easyjson.go index 80e2b4c..d2e797b 100644 --- a/cdp/profiler/easyjson.go +++ b/cdp/profiler/easyjson.go @@ -1445,6 +1445,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpProfiler14(in *jlexer.Lexer, o } in.Delim(']') } + case "isBlockCoverage": + out.IsBlockCoverage = bool(in.Bool()) default: in.SkipRecursive() } @@ -1490,6 +1492,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpProfiler14(out *jwriter.Writer out.RawByte(']') } } + if in.IsBlockCoverage { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"isBlockCoverage\":") + out.Bool(bool(in.IsBlockCoverage)) + } out.RawByte('}') } diff --git a/cdp/profiler/types.go b/cdp/profiler/types.go index 65a0dff..bbb0adc 100644 --- a/cdp/profiler/types.go +++ b/cdp/profiler/types.go @@ -40,8 +40,9 @@ type CoverageRange struct { // FunctionCoverage coverage data for a JavaScript function. type FunctionCoverage struct { - FunctionName string `json:"functionName,omitempty"` // JavaScript function name. - Ranges []*CoverageRange `json:"ranges,omitempty"` // Source ranges inside the function with coverage data. + FunctionName string `json:"functionName,omitempty"` // JavaScript function name. + Ranges []*CoverageRange `json:"ranges,omitempty"` // Source ranges inside the function with coverage data. + IsBlockCoverage bool `json:"isBlockCoverage,omitempty"` // Whether coverage data for this function has block granularity. } // ScriptCoverage coverage data for a JavaScript script. diff --git a/cmd/chromedp-gen/protocol.json b/cmd/chromedp-gen/protocol.json index 01eabb4..9766ce1 100644 --- a/cmd/chromedp-gen/protocol.json +++ b/cmd/chromedp-gen/protocol.json @@ -1210,6 +1210,13 @@ "optional": true, "description": "Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution." } + ], + "returns": [ + { + "name": "executionContextId", + "$ref": "Runtime.ExecutionContextId", + "description": "Execution context of the isolated world." + } ] } ], @@ -13212,6 +13219,11 @@ "$ref": "CoverageRange" }, "description": "Source ranges inside the function with coverage data." + }, + { + "name": "isBlockCoverage", + "type": "boolean", + "description": "Whether coverage data for this function has block granularity." } ], "experimental": true diff --git a/cmd/chromedp-gen/update.sh b/cmd/chromedp-gen/update.sh index 0c59c93..40cd8fa 100755 --- a/cmd/chromedp-gen/update.sh +++ b/cmd/chromedp-gen/update.sh @@ -34,8 +34,8 @@ if (( "$NOW" >= $(($LASTUPDATE + 86400*5)) )); then fi if [[ "$UPDATE" == 1 ]]; then - go get -u -d \ - github.com/knq/chromedp/cmd/chromedp-gen + #go get -u -d \ + # github.com/knq/chromedp/cmd/chromedp-gen go get -u \ golang.org/x/tools/cmd/goimports \