2017-01-24 15:09:23 +00:00
|
|
|
// This file is automatically generated by qtc from "extra.qtpl".
|
|
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:1
|
|
|
|
package templates
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:1
|
|
|
|
import (
|
|
|
|
qtio422016 "io"
|
|
|
|
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
|
|
)
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:1
|
|
|
|
import (
|
2017-01-26 07:28:34 +00:00
|
|
|
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
|
2017-01-24 15:09:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ExtraTimestampTemplate is a special template for the Timestamp type that
|
|
|
|
// defines its JSON unmarshaling.
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:7
|
|
|
|
var (
|
|
|
|
_ = qtio422016.Copy
|
|
|
|
_ = qt422016.AcquireByteBuffer
|
|
|
|
)
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:7
|
2017-01-26 07:28:34 +00:00
|
|
|
func StreamExtraTimestampTemplate(qw422016 *qt422016.Writer, t *internal.Type, d *internal.Domain) {
|
2017-01-24 15:09:23 +00:00
|
|
|
//line templates/extra.qtpl:8
|
2017-02-12 04:59:33 +00:00
|
|
|
typ := t.IDorName()
|
2017-01-24 15:09:23 +00:00
|
|
|
|
|
|
|
//line templates/extra.qtpl:9
|
|
|
|
qw422016.N().S(`
|
|
|
|
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
|
|
|
func (t `)
|
|
|
|
//line templates/extra.qtpl:11
|
|
|
|
qw422016.N().S(typ)
|
|
|
|
//line templates/extra.qtpl:11
|
|
|
|
qw422016.N().S(`) MarshalEasyJSON(out *jwriter.Writer) {
|
|
|
|
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second))
|
|
|
|
}
|
|
|
|
|
|
|
|
// MarshalJSON satisfies json.Marshaler.
|
|
|
|
func (t `)
|
|
|
|
//line templates/extra.qtpl:16
|
|
|
|
qw422016.N().S(typ)
|
|
|
|
//line templates/extra.qtpl:16
|
|
|
|
qw422016.N().S(`) MarshalJSON() ([]byte, error) {
|
|
|
|
return easyjson.Marshal(t)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
|
|
|
func (t *`)
|
|
|
|
//line templates/extra.qtpl:21
|
|
|
|
qw422016.N().S(typ)
|
|
|
|
//line templates/extra.qtpl:21
|
|
|
|
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
|
|
*t = `)
|
|
|
|
//line templates/extra.qtpl:22
|
|
|
|
qw422016.N().S(typ)
|
|
|
|
//line templates/extra.qtpl:22
|
|
|
|
qw422016.N().S(`(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second))))
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON satisfies json.Unmarshaler.
|
|
|
|
func (t *`)
|
|
|
|
//line templates/extra.qtpl:26
|
|
|
|
qw422016.N().S(typ)
|
|
|
|
//line templates/extra.qtpl:26
|
|
|
|
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
|
|
|
|
return easyjson.Unmarshal(buf, t)
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:29
|
2017-01-26 07:28:34 +00:00
|
|
|
func WriteExtraTimestampTemplate(qq422016 qtio422016.Writer, t *internal.Type, d *internal.Domain) {
|
2017-01-24 15:09:23 +00:00
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
StreamExtraTimestampTemplate(qw422016, t, d)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
qt422016.ReleaseWriter(qw422016)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:29
|
2017-01-26 07:28:34 +00:00
|
|
|
func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) string {
|
2017-01-24 15:09:23 +00:00
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
WriteExtraTimestampTemplate(qb422016, t, d)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
qs422016 := string(qb422016.B)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
return qs422016
|
|
|
|
//line templates/extra.qtpl:29
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExtraFrameTemplate is a special template for the Page.Frame type, adding FrameState.
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:32
|
|
|
|
func StreamExtraFrameTemplate(qw422016 *qt422016.Writer) {
|
|
|
|
//line templates/extra.qtpl:32
|
|
|
|
qw422016.N().S(`
|
|
|
|
// FrameState is the state of a Frame.
|
|
|
|
type FrameState uint16
|
|
|
|
|
|
|
|
// FrameState enum values.
|
|
|
|
const (
|
|
|
|
FrameDOMContentEventFired FrameState = 1 << (15 - iota)
|
|
|
|
FrameLoadEventFired
|
|
|
|
FrameAttached
|
|
|
|
FrameNavigated
|
|
|
|
FrameLoading
|
|
|
|
FrameScheduledNavigation
|
|
|
|
)
|
|
|
|
|
|
|
|
// frameStateNames are the names of the frame states.
|
|
|
|
var frameStateNames = map[FrameState]string{
|
|
|
|
FrameDOMContentEventFired: "DOMContentEventFired",
|
|
|
|
FrameLoadEventFired: "LoadEventFired",
|
|
|
|
FrameAttached: "Attached",
|
|
|
|
FrameNavigated: "Navigated",
|
|
|
|
FrameLoading: "Loading",
|
|
|
|
FrameScheduledNavigation: "ScheduledNavigation",
|
|
|
|
}
|
|
|
|
|
|
|
|
// String satisfies stringer interface.
|
|
|
|
func (fs FrameState) String() string {
|
|
|
|
var s []string
|
|
|
|
for k, v := range frameStateNames {
|
|
|
|
if fs&k != 0 {
|
|
|
|
s = append(s, v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "[" + strings.Join(s, " ") + "]"
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
func WriteExtraFrameTemplate(qq422016 qtio422016.Writer) {
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
StreamExtraFrameTemplate(qw422016)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
qt422016.ReleaseWriter(qw422016)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
func ExtraFrameTemplate() string {
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
WriteExtraFrameTemplate(qb422016)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
qs422016 := string(qb422016.B)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
return qs422016
|
|
|
|
//line templates/extra.qtpl:66
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExtraNodeTemplate is a special template for the DOM.Node type, adding NodeState.
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
func StreamExtraNodeTemplate(qw422016 *qt422016.Writer) {
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S(`
|
|
|
|
// AttributeValue returns the named attribute for the node.
|
|
|
|
func (n *Node) AttributeValue(name string) string {
|
|
|
|
n.RLock()
|
|
|
|
defer n.RUnlock()
|
|
|
|
|
|
|
|
for i := 0; i < len(n.Attributes); i+=2 {
|
|
|
|
if n.Attributes[i] == name {
|
|
|
|
return n.Attributes[i+1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
// xpath builds the xpath string.
|
2017-01-29 03:37:56 +00:00
|
|
|
func (n *Node) xpath(stopAtDocument, stopAtID bool) string {
|
2017-01-24 15:09:23 +00:00
|
|
|
p := ""
|
|
|
|
pos := ""
|
|
|
|
id := n.AttributeValue("id")
|
|
|
|
switch {
|
|
|
|
case n.Parent == nil:
|
|
|
|
return n.LocalName
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
case stopAtDocument && n.NodeType == NodeTypeDocument:
|
|
|
|
return ""
|
|
|
|
|
|
|
|
case stopAtID && id != "":
|
2017-01-24 15:09:23 +00:00
|
|
|
p = "/"
|
|
|
|
pos = `)
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S("`")
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S(`[@id='`)
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S("`")
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S(`+id+`)
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S("`")
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S(`']`)
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S("`")
|
|
|
|
//line templates/extra.qtpl:69
|
|
|
|
qw422016.N().S(`
|
|
|
|
|
|
|
|
case n.Parent != nil:
|
|
|
|
i := 0
|
|
|
|
var found bool
|
|
|
|
for j := 0; j < len(n.Parent.Children); j++ {
|
|
|
|
if n.Parent.Children[j].LocalName == n.LocalName {
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
if n.Parent.Children[j].NodeID == n.NodeID {
|
|
|
|
found = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
p = n.Parent.xpath(stopAtDocument, stopAtID)
|
2017-01-24 15:09:23 +00:00
|
|
|
if found {
|
|
|
|
pos = "["+strconv.Itoa(i)+"]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return p + "/" + n.LocalName + pos
|
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
// PartialXPathByID returns the partial XPath for the node, stopping at the
|
|
|
|
// first parent with an id attribute or at nearest parent document node.
|
|
|
|
func (n *Node) PartialXPathByID() string {
|
|
|
|
return n.xpath(true, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
// PartialXPath returns the partial XPath for the node, stopping at the nearest
|
|
|
|
// parent document node.
|
|
|
|
func (n *Node) PartialXPath() string {
|
|
|
|
return n.xpath(true, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
// FullXPathByID returns the full XPath for the node, stopping at the top most
|
|
|
|
// document root or at the closest parent node with an id attribute.
|
|
|
|
func (n *Node) FullXPathByID() string {
|
|
|
|
return n.xpath(false, true)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
// FullXPath returns the full XPath for the node, stopping only at the top most
|
|
|
|
// document root.
|
|
|
|
func (n *Node) FullXPath() string {
|
|
|
|
return n.xpath(false, false)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NodeState is the state of a DOM node.
|
|
|
|
type NodeState uint8
|
|
|
|
|
|
|
|
// NodeState enum values.
|
|
|
|
const (
|
|
|
|
NodeReady NodeState = 1 << (7 - iota)
|
|
|
|
NodeVisible
|
|
|
|
NodeHighlighted
|
|
|
|
)
|
|
|
|
|
|
|
|
// nodeStateNames are the names of the node states.
|
|
|
|
var nodeStateNames = map[NodeState]string{
|
|
|
|
NodeReady: "Ready",
|
|
|
|
NodeVisible: "Visible",
|
|
|
|
NodeHighlighted: "Highlighted",
|
|
|
|
}
|
|
|
|
|
|
|
|
// String satisfies stringer interface.
|
|
|
|
func (ns NodeState) String() string {
|
|
|
|
var s []string
|
|
|
|
for k, v := range nodeStateNames {
|
|
|
|
if ns&k != 0 {
|
|
|
|
s = append(s, v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "[" + strings.Join(s, " ") + "]"
|
|
|
|
}
|
|
|
|
`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
func WriteExtraNodeTemplate(qq422016 qtio422016.Writer) {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
StreamExtraNodeTemplate(qw422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
func ExtraNodeTemplate() string {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
WriteExtraNodeTemplate(qb422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
return qs422016
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:173
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExtraFixStringUnmarshaler is a template that forces values to be parsed properly.
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:176
|
2017-01-24 15:09:23 +00:00
|
|
|
func StreamExtraFixStringUnmarshaler(qw422016 *qt422016.Writer, typ, parseFunc, extra string) {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:176
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
|
|
|
func (t *`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:178
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(typ)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:178
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
|
|
buf := in.Raw()
|
|
|
|
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
|
|
|
|
buf = buf[1:l-1]
|
|
|
|
}
|
|
|
|
`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:183
|
2017-01-24 15:09:23 +00:00
|
|
|
if parseFunc != "" {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:183
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
v, err := strconv.`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:184
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(parseFunc)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:184
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`(string(buf)`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:184
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(extra)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:184
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`)
|
|
|
|
if err != nil {
|
|
|
|
in.AddError(err)
|
|
|
|
}
|
|
|
|
`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:188
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:188
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
*t = `)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(typ)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`(`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
if parseFunc != "" {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`v`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
} else {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`buf`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:189
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON satisfies json.Unmarshaler.
|
|
|
|
func (t *`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:193
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(typ)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:193
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
|
|
|
|
return easyjson.Unmarshal(buf, t)
|
|
|
|
}
|
|
|
|
`)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
func WriteExtraFixStringUnmarshaler(qq422016 qtio422016.Writer, typ, parseFunc, extra string) {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
StreamExtraFixStringUnmarshaler(qw422016, typ, parseFunc, extra)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
func ExtraFixStringUnmarshaler(typ, parseFunc, extra string) string {
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
WriteExtraFixStringUnmarshaler(qb422016, typ, parseFunc, extra)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
return qs422016
|
2017-01-29 03:37:56 +00:00
|
|
|
//line templates/extra.qtpl:196
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-08 07:27:39 +00:00
|
|
|
// ExtraExceptionDetailsTemplate is a special template for the Runtime.ExceptionDetails type that
|
|
|
|
// defines the standard error interface.
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:200
|
|
|
|
func StreamExtraExceptionDetailsTemplate(qw422016 *qt422016.Writer) {
|
|
|
|
//line templates/extra.qtpl:200
|
|
|
|
qw422016.N().S(`
|
|
|
|
// Error satisfies the error interface.
|
|
|
|
func (e *ExceptionDetails) Error() string {
|
|
|
|
// TODO: watch script parsed events and match the ExceptionDetails.ScriptID
|
|
|
|
// to the name/location of the actual code and display here
|
|
|
|
return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
func WriteExtraExceptionDetailsTemplate(qq422016 qtio422016.Writer) {
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
StreamExtraExceptionDetailsTemplate(qw422016)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
qt422016.ReleaseWriter(qw422016)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
}
|
|
|
|
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
func ExtraExceptionDetailsTemplate() string {
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
WriteExtraExceptionDetailsTemplate(qb422016)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
qs422016 := string(qb422016.B)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
return qs422016
|
|
|
|
//line templates/extra.qtpl:207
|
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// ExtraCDPTypes is the template for additional internal type
|
2017-01-24 15:09:23 +00:00
|
|
|
// declarations.
|
|
|
|
|
2017-02-08 07:27:39 +00:00
|
|
|
//line templates/extra.qtpl:211
|
2017-01-26 07:28:34 +00:00
|
|
|
func StreamExtraCDPTypes(qw422016 *qt422016.Writer) {
|
2017-02-08 07:27:39 +00:00
|
|
|
//line templates/extra.qtpl:211
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
|
|
|
|
// Error satisfies the error interface.
|
|
|
|
func (t ErrorType) Error() string {
|
|
|
|
return string(t)
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Handler is the common interface for a Chrome Debugging Protocol target.
|
|
|
|
type Handler interface {
|
|
|
|
// SetActive changes the top level frame id.
|
2017-01-24 15:09:23 +00:00
|
|
|
SetActive(context.Context, FrameID) error
|
2017-02-12 04:59:33 +00:00
|
|
|
|
|
|
|
// GetRoot returns the root document node for the top level frame.
|
2017-01-24 15:09:23 +00:00
|
|
|
GetRoot(context.Context) (*Node, error)
|
2017-02-12 04:59:33 +00:00
|
|
|
|
|
|
|
// WaitFrame waits for a frame to be available.
|
2017-01-24 15:09:23 +00:00
|
|
|
WaitFrame(context.Context, FrameID) (*Frame, error)
|
2017-02-12 04:59:33 +00:00
|
|
|
|
|
|
|
// WaitNode waits for a node to be available.
|
2017-01-24 15:09:23 +00:00
|
|
|
WaitNode(context.Context, *Frame, NodeID) (*Node, error)
|
|
|
|
|
|
|
|
// Execute executes the specified command using the supplied context and
|
|
|
|
// parameters.
|
2017-02-14 08:41:23 +00:00
|
|
|
Execute(context.Context, MethodType, easyjson.Marshaler, easyjson.Unmarshaler) error
|
2017-02-12 04:59:33 +00:00
|
|
|
|
|
|
|
// Listen creates a channel that will receive an event for the types
|
|
|
|
// specified.
|
|
|
|
Listen(...MethodType) <-chan interface{}
|
|
|
|
|
|
|
|
// Release releases a channel returned from Listen.
|
|
|
|
Release(<-chan interface{})
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-26 07:28:34 +00:00
|
|
|
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-26 07:28:34 +00:00
|
|
|
StreamExtraCDPTypes(qw422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-26 07:28:34 +00:00
|
|
|
func ExtraCDPTypes() string {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-26 07:28:34 +00:00
|
|
|
WriteExtraCDPTypes(qb422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
return qs422016
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:243
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExtraUtilTemplate generates the decode func for the Message type.
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:246
|
2017-01-26 07:28:34 +00:00
|
|
|
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:246
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
type empty struct{}
|
|
|
|
var emptyVal = &empty{}
|
|
|
|
|
|
|
|
// UnmarshalMessage unmarshals the message result or params.
|
2017-01-26 07:28:34 +00:00
|
|
|
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
|
2017-01-24 15:09:23 +00:00
|
|
|
var v easyjson.Unmarshaler
|
|
|
|
switch msg.Method {`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:253
|
2017-01-24 15:09:23 +00:00
|
|
|
for _, d := range domains {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:253
|
2017-01-24 15:09:23 +00:00
|
|
|
for _, c := range d.Commands {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:253
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
2017-01-26 07:28:34 +00:00
|
|
|
case cdp.`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:254
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(c.CommandMethodType(d))
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:254
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`:`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:254
|
2017-01-24 15:09:23 +00:00
|
|
|
if len(c.Returns) == 0 {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:254
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
return emptyVal, nil`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:255
|
2017-01-24 15:09:23 +00:00
|
|
|
} else {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:255
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
v = new(`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(d.PackageRefName())
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`.`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(c.CommandReturnsType())
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`)`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:256
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:257
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:257
|
2017-01-24 15:09:23 +00:00
|
|
|
for _, e := range d.Events {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:257
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
2017-01-26 07:28:34 +00:00
|
|
|
case cdp.`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:258
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(e.EventMethodType(d))
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:258
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`:
|
|
|
|
v = new(`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:259
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(d.PackageRefName())
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:259
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`.`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:259
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(e.EventType())
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:259
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`)
|
|
|
|
`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:260
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:260
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:260
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`}
|
|
|
|
|
|
|
|
var buf easyjson.RawMessage
|
|
|
|
switch {
|
|
|
|
case msg.Params != nil:
|
|
|
|
buf = msg.Params
|
|
|
|
|
|
|
|
case msg.Result != nil:
|
|
|
|
buf = msg.Result
|
|
|
|
|
|
|
|
default:
|
|
|
|
return nil, errors.New("msg missing params or result")
|
|
|
|
}
|
|
|
|
|
|
|
|
err := easyjson.Unmarshal(buf, v)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return v, nil
|
|
|
|
}
|
|
|
|
`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-26 07:28:34 +00:00
|
|
|
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
StreamExtraUtilTemplate(qw422016, domains)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-26 07:28:34 +00:00
|
|
|
func ExtraUtilTemplate(domains []*internal.Domain) string {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
WriteExtraUtilTemplate(qb422016, domains)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
return qs422016
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:281
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:283
|
2017-01-24 15:09:23 +00:00
|
|
|
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:283
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
// Domain returns the Chrome Debugging Protocol domain of the event or command.
|
|
|
|
func (t MethodType) Domain() string {
|
|
|
|
return string(t[:strings.IndexByte(string(t), '.')])
|
|
|
|
}
|
|
|
|
`)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
StreamExtraMethodTypeDomainDecoder(qw422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
func ExtraMethodTypeDomainDecoder() string {
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
WriteExtraMethodTypeDomainDecoder(qb422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
return qs422016
|
2017-02-14 08:41:23 +00:00
|
|
|
//line templates/extra.qtpl:288
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|